![]() I also tried going the other way and generating a new key using P圜rypto with something like: from Crypto.PublicKey import RSAį.write(key.publickey().exportKey('PEM'))Īnd then reading it via Bouncy Castle's API like this: PemReader reader = new PemReader(new FileReader("/tmp/public.pem")) ![]() ![]() I have been reading up on the different types of keys and algorithms but I thought that an ASCII file holding a key like this should work but there is obviously something I'm missing. RSA.importKey(open('/path/to/private/key/file').read()) When I try from Crypto.PublicKey import RSA On the Python side I have tried using both the cryptography.hazmat and P圜rypto api's but can't figure out how to import the private key file. I can parse the public key file with Bouncy Castle in Java with PGPUtil.getDecoderStream(), getting a PGPPublicKeyRingCollection and a PGPPublicKey which can be converted to a. I tried generating RSA keys with gpg -generate-key and in an armor file get a file that looks like: -BEGIN PGP PRIVATE KEY BLOCK-Īnd create a public key from that which looks like: -BEGIN PGP PUBLIC KEY BLOCK. The plan is to use the public key in Java to encrypt the file, and the private key in Python to decrypt it. ![]() I am trying to figure out what kind of keys I need that can be used by both Java and Python API's, and how to generate them. We have one system written in Java that will write encrypted files that need to be decrypted by a Python system. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |