Skip to content

Instantly share code, notes, and snippets.

@marcodebe
Last active April 23, 2019 20:27
Show Gist options
  • Save marcodebe/6138525 to your computer and use it in GitHub Desktop.
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.
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