Last active
April 23, 2019 20:27
-
-
Save marcodebe/6138525 to your computer and use it in GitHub Desktop.
Example of remote sign using Aruba services.The example creates a signed PDF document.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from zeep import Client | |
import sys | |
import os | |
WSDL = 'https://firmaautomatica.aruba.it/ArubaSignService/ArubaSignService?WSDL' | |
document = sys.argv[1] | |
otp = sys.argv[2] | |
output = '.signed'.join(os.path.splitext(document)) | |
client = Client(WSDL) | |
factory = client.type_factory('ns0') | |
sign_request = factory.signRequestV2( | |
requiredmark=True, | |
transport='BYNARYNET', | |
binaryinput=open(document, 'rb').read(), | |
identity=factory.auth( | |
user='username', | |
userPWD=3141592653, | |
typeHSM='cosign', | |
typeOtpAuth='frAzienda', | |
otpPwd=otp | |
)) | |
response = client.service.pdfsignatureV2(SignRequestV2=sign_request) | |
outputfile = open(output, 'wb') | |
outputfile.write(response.binaryoutput) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment