Hi
Im looking for sha256 crypto sample :
does enyone have done something in Team Developer?
############################################################################
test.key - private key
test.pem -public key from certificate
############################################################################
======== to generate e-invoice hashi to service(service:ForwardInvoice) ============
input= u"%s#%s#%s#%s" % (
provider_code,
transfer_datetime.strftime('%d.%m.%Y %H:%M:%S'),
invoice_xml_file,
invoice_pdf_file,
)
input_hash = hashlib.sha256(input).digest()
========= signing hash with phyton ============
rsa = M2Crypto.RSA.load_key("test.key")
gen_sig = rsa.private_encrypt(input_hash, M2Crypto.RSA.pkcs1_padding)
sig = base64.encodestring(gen_sig)
========= generate sining from hash with openssl ============
openssl rsautl -sign -in rasi.txt -inkey test.key
output -> base64-encoded.
========= verifing signature with openssl ============
openssl rsautl -verify -certin -inkey test.pem -in input.txt
where input.txt is base-64-decoded sign.
Hash ,signature and verify: hashlib.sha256
-
- Founder/Site Admin
- Posts: 2956
- Joined: 24 Feb 2017, 09:12
- Location: Gouda, The Netherlands
Hash ,signature and verify: hashlib.sha256
Regards,
Dave Rabelink

Articles and information on Team Developer Tips & Tricks Wiki
Download samples, documents and resources from TD Sample Vault
Videos on TDWiki YouTube Channel
Dave Rabelink

Articles and information on Team Developer Tips & Tricks Wiki
Download samples, documents and resources from TD Sample Vault
Videos on TDWiki YouTube Channel
Who is online
Users browsing this forum: [Ccbot] and 0 guests