3
$\begingroup$

My client provided PGP public key for data encryption. Can I use any OpenSSL [RSA or AES or any encryption] APIs to encrypt the data with this key?

What are the different types of keys available for asymmetric key encryptions? Is it possible to convert keys from one format to another?

$\endgroup$
1
  • $\begingroup$ Key reuse is not a good idea. $\endgroup$
    – kelalaka
    Nov 19, 2018 at 8:52

3 Answers 3

2
$\begingroup$

My client provided PGP public key for data encryption. Can I use any OpenSSL [RSA or AES or any encryption] APIs to encrypt the data with this key?

That depends. If the key is an RSA key or - to use the more modern method - contains an RSA encryption subkey, then you should be able to do this.

OpenPGP certainly allows hybrid encryption that uses AES.

What are the different types of keys available for asymmetric key encryptions?

You can use either the old ElGamal or you can use RSA with PKCS#1 v1.5 padding. Note that sometimes ElGamal is sometimes (incorrectly) also referred to as DH as it uses the same underlying Discrete Logarithm problem (DLP).

There is also an old proposed internet standard RFC-6637: Elliptic Curve Cryptography (ECC) in OpenPGP that indicates how you can use ECIES to derive session keys rather than to wrap / unwrap them.

Is it possible to convert keys from one format to another?

No. Calculating the public key requires the private key - the public key must be part of a key pair after all. So it is not possible to derive a public key using a public key that uses a different algorithm.

But PGP does allow the holder of the private key to define subkeys. These subkeys could be using any algorithm. Those subkeys need to be signed by the main private key. The sender can then choose any of the valid subkeys to encrypt. Of course this does require you to retrieve an updated "certificate" (PGP container with the public key) containing the public keys.


Beware that OpenPGP may be vulnerable to padding oracle attacks on several levels. You'd better make sure that you do not automate decryption procedures.

$\endgroup$
0
$\begingroup$

If you have the PGP public key then you can encrypt your data, as shown here. Your client can then decrypt the data with his private key.

What are the different types of keys available for asymmetric key encryptions?

Some examples of asymmetric cryptography schemes:

Is it possible to convert keys from one format to another?

If you mean that you can use keys from one scheme for another scheme then the answer is No. You should always create new keys for different schemes.

In addition, keys of different schemes can be very different, because they rely on different principles (multiplication for RSA and exponential calculation for Diffie-Hellman).

$\endgroup$
1
  • $\begingroup$ Is PGP not part of asymmetric cryptography schemes? $\endgroup$
    – Raman Ch
    Nov 19, 2018 at 11:52
0
$\begingroup$

To DECRYPT data you need pair of the keys. Your private and provider's public.

Anyway, openssl is not compatible with PGP messages. related link

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.