Using Bouncy Castle to encrypt a file, I am having trouble generating the private/public keys. The public key needs to be in the OpenSSH or RFC4716 format the problem is when I use ssh-keygen to create the keys they cannot be used to encrypt the file. Why is this? I even used ssh-keygen to export the keys into the RFC4716 format and still i was unable to use it to encrypt the file.
As Robert commented, these formats are not compatible. For PGP file encryption I will use the normally generated keys. Thanks again Robert.
Related
While using GPG for encryption is it safe to rename the file after it is encrypted or depending on the algorithm used for encryption the file uses the name also for verifying the contents.
You can rename the file without issues. The original filename is safely encrypted inside the file. The filename is never used for decryption in any way.
Suppose I would like to encrypt a file with my private key for whatever reason so that only people with my public key can have access to the file. How would I do this?
gpg --sign --armor file
does not work because if you omit the --armor and use
gpg --sign --compress-level 0 file
the plaintext appears in the file.gpg.
gpg --encrypt file
will also not work because that uses public keys. Does anybody know how to do this?
You unfortunately have got some fundamental misconceptions about the cryptography you want use. By definition if you want to asymmetrically encrypt some data you need to use the public key and the encrypted data can only be decrypted with the private key.
If you want to encrypt a message so that only a certain group of people can access it you can asymmetrically encrypt it with all the public keys of each individual in the group or encrypt it symmetrically with a random key and share that key with each individual in the group.
You can encrypt your file symmetrically using your public key, so that everybody with access to your public key can decrypt your file.
Is there a standard file format for public/private key pairs?
Something similar to x509 for certificates.
Many thanks!
The SSH public key format (also used by their private keys) is fairly standard.
I am new to cryptography, hence I want to ask about my company's requirements.
We are using eToken with RSA support.
I have developed a code that encrypt file with public key and stored it in another file.
Now I want to pass the encrypted file to eToken, and here is my issue.
How can I access the eToken from a Java applet?
Is it right that I have to pass encrypted file to eToken and it will decrypt file for me?
How can I do this?
I retrieved the PGP key from the public key server ,Now need help in getting a python method for encryption which can accept this PGP public key .
As i know PGP/Gnupg.py module do not allow me to use encryption/decryption function separately without generating the key.
It seems to me that the easiest approach is use GPGME, which is basically GnuPG wrapped up in a convenient library form (thus the name, GPGME = GnuPG Made Easy). There is a Python wrapper for GPGME named Pyme which will let you do things like import keys, encrypt messages using them, etc, all using the standard PGP formats. There is some basic Pyme documentation online, along with the promise of more complicated examples being included in the source distribution.