Take the 2-minute tour ×
Information Security Stack Exchange is a question and answer site for Information security professionals. It's 100% free, no registration required.

Is there a way that I can use a RSA keypair with PGP? What I mean is that I have 2048 length keypair and i want to use that to encrypt and decrypt data. But all I have found is that the PGP uses some keyrings and some pgp keys. And I haven't found anywhere why they are different? Why I am asking is that I need to store keys in HSM but i cant do that with PGP keys. Looked around and didn't find anything about that on google also.

Can anyone explain it to me or share some link.

share|improve this question
    
This may be a little off the wall as a question - but why PGP? Is that a mandated architecture? I'm just surprised, since I don't often hear of requirements for PGP and key storage in an HSM. Usually I see PGP as a low end security mechanism - not that it's so bad, just that it isn't used in the bigger enterprise-ish stuff –  bethlakshmi Jun 28 '11 at 18:21
    
There might be some miscommunication, but thats what i was told that they need to hold pgp keys in HSM. When i asked what keys they sayd RSA 2048, so maybe they just holding private key in HSM. –  t678 Jun 28 '11 at 18:29
    
Why did you ask the same question twice within 30 minutes? This should be merged with Store PGP keys in HSM - IT Security - Stack Exchange. –  nealmcb Jun 29 '11 at 1:33
1  
@bethlakshmi: Why would PGP be low-end? It's PKI does not quite match the hierarchy of an enterprise, but nobody prevents you from building a hierarchical infrastructure of PGP keys. In contrast, everyone can get SMIME certificates and clients have about a hundret CAs, including foreign governments and rather low-cost CAs. And most clients don't really warn the user if the cert signer is different/unexpected. X509 is a mess. Security needs simple, scalable infrastructures. –  pepe Jun 29 '11 at 8:40
    
@pepe - I'm not saying there's anything wrong with it... it's just that not once in 10 years of building enterprise level security has PGP ever come up as something desired. Usually the desire is for a straight up PKI. And I really don't see a lot of enterprise level products out there touting their PGP compatibility... –  bethlakshmi Jun 29 '11 at 13:43
add comment

5 Answers

up vote 6 down vote accepted

What PGP does is described in the OpenPGP standard. In OpenPGP, "key rings" are some terminology for "public and/or private keys encoded in the format described by OpenPGP".

Among the types of keys for which OpenPGP describes a key ring format are RSA keys. There is no fundamental issue which would prevent an OpenPGP implementation from using a RSA private key which is stored in a HSM. Practically speaking, though, the free OpenPGP implementation, called GnuPG, does not inherently supports that -- but the gnupg-pkcs11 project may help: it allows integration of a cryptographic device which offers a PKCS#11 driver (virtually all HSM do that) into the GnuPG world.

Importing an existing "PGP key" (i.e. a RSA private key currently stored as a file in the OpenPGP format) into a HSM is not necessarily a good idea: a HSM is an expensive device which aims at never allowing a private key to ever exist outside of the tamper-resistant hardware of the HSM. If the key is imported, then it does/did exist somewhere in the outer world, which makes the use of the HSM much less justified.

share|improve this answer
add comment

I don't know about PGP, but GPG can use Smartcards (and sometimes more interesting, PKCS#11 USB-Tokens) to protect the private key:

http://www.gnupg.org/howtos/card-howto/en/smartcard-howto-single.html

If you take the hassle to use a HSM, you should consider using one with a dedicated key pad. Otherwise the protection is of very little use.

You might also want to bring this to the attention of your IT security department: http://secgroup.ext.dsi.unive.it/projects/security-apis/pkcs11-security/tookan/

They have a paper at ACM CCS 2010 explaining the issue.

share|improve this answer
    
Actually GPG support for smart cards (other than their own "OpenPGP" card) has poor support for "other" smart cards. Meaning it is not that simple to deploy PGP on top of existing X509 oriented cards, with open source software. –  martin Jul 7 '11 at 18:19
    
For PKCS#11 tokens have a look at gnupg-pkcs11.sourceforge.net, it is only about as broken as all the other (free) PKCS#11 middleware. –  pepe Jul 8 '11 at 22:17
add comment

You can't use anything in PGP other that PGP keys. Some features will also work with certificates and S/MIME keys but not all (e.g. Additional Decryption Key will not work). I'm hoping you have not bought it without knowing this.

You can though set the RSA algorithm in PGP on key generation and in PGP Universal as a policy setting:

PGP Key

Some lessons learned implementing PGP email encryption in an organization

share|improve this answer
    
+1 interesting blog post. And definite similarity in lessons learned from implementations I have been involved with :-) –  Rory Alsop Jun 29 '11 at 7:46
    
@rory-alsop yeah was very stressful at the time but good learning experience. Always good to be doing rather than advising. Would never implement PGP by choice again though. –  Rakkhi Jun 29 '11 at 8:13
add comment

If you are using RSA certificates, then you should use cms (evolved from PCCS#7 and s/mime) this is supported by openssl. http://www.openssl.org/docs/apps/cms.html

To sign and encrypt a file:

openssl cms –encrypt –text –in compressed-file.txt –out encrypted-file.txt public-key.pem

Next we sign the file contents:

openssl cms –sign –text –in encrypted-file.zip –signer certificate.pem –inkey certtificate.key –out signed-file.txt

To verify and decrypt:

openssl cms –verify –in file –signer certificate.pem 

If the verification is successful then the file contents can be decrypted.

openssl cms –decrypt –in file –inkey private-key.pem –out decrypted-file
share|improve this answer
add comment

You can't import keys to HSM AFAIK. They are devices designed to perform cryptographic onboard generation/storage/use of cryptographic critical data. Being able to import a private key to the HSM will negate the purpose of the HSM itself.

I think there is a backup procedure although. But I never had an HSM card in my hands (I wish I had :P) You can't export unencrypted information out of the HSM as well.

But you are right, they embeds 2048-length RSA keys (NIST recommendation since 2010).

Most of information available on Wikipedia

share|improve this answer
    
You can import keys, both plaintext as well as wrapped (from one HSM to another HSM). It all depends on established policies and configurations. And it depends on the "HSM" as well. If you have HSMs in the first place, you usually want to make sure that cleartext key material never leaves the HSM, be it a "big one" or a smart card/USB token. –  martin Jul 7 '11 at 18:22
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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