![]() _, serverPublicKey := generateRsaPair(2048)ĬlientPrivateKeyAsByte := privateKeyToBytes(clientPrivateKey)ĮncryptWithPublicKey(clientPrivateKeyAsByte, serverPublicKey)įatal error crypto/rsa: message too long for RSA public key size /* Functions */įunc generateRsaPair(bits int) (*rsa.PrivateKey, *rsa. ![]() Also you can always obtain the public key from a private key but not possible from the other way round. For RSA, youll need public key for encryption & verification, private key is needed for decryption & signing. * main */ĬlientPrivateKey, _ := generateRsaPair(2048) In order to do encryption, you will need to call rsa.encrypt (msg1, public). but I saw a similar task was done in Python, so I want to know your opinion. from Crypto.PublicKey import RSA from Crypto.Signature import PKCS1v15 from base64 import b64decode rsakey RSA.importKey (open ('private.txt', 'rb').read ()) cipher PKCS1v15. I know that private key is obviously longer than the public key and I'm not sure if it's possible. I need to encrypt client-private-key with RSA-2048 server-public-key.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |