how to make a pkcs8 rsa signature in python

Solutions on MaxInterview for how to make a pkcs8 rsa signature in python by the best coders in the world

we are a community of more than 2 million smartest coders
registration for
employee referral programs
are now open
get referred to google, amazon, flipkart and more
register now
  
pinned-register now
showing results for - "how to make a pkcs8 rsa signature in python"
Lisa
26 Nov 2019
1>>> from Crypto.Signature import PKCS1_v1_5
2>>> from Crypto.Hash import SHA
3>>> from Crypto.PublicKey import RSA
4>>>
5>>> message = 'To be signed'
6>>> key = RSA.importKey(open('privkey.der').read())
7>>> h = SHA.new(message)
8>>> signer = PKCS1_v1_5.new(key)
9>>> signature = signer.sign(h)