Reputation: 185
A simple question but trick for me to know how to do it.
I received a Public Key from the client and I'd like to know which Standard this public key is following.
I.e: PKCS#1, PKCS#2, PKCS#3 and so on.
Why do I need it? Because I want validate a signature given that I already have the signature and the text encrypted.
Upvotes: 0
Views: 278
Reputation: 38821
Most PKCS don't involve public keys at all. All are listed in wikipedia.
PKCS1 defines ASN.1 formats for publickey and privatekey for RSA (only). These are pretty much the only keys described as conforming to any PKCS.
PKCS2-4 and 6 no longer exist, although OpenSSL has caused the PKCS3 format for DH to persist -- but DH is not used for signature.
PKCS5 doesn't involve publickey.
PKCS7 can use publickeys for encryption and/or signature verification of a message and/or can convey one or more X.509 certificate(s) (each) containing a publickey. Such certificate(s) can be for any algorithm.
PKCS8 doesn't involve publickey.
PKCS9 doesn't directly involve any key, although some attributes can be used in an X.509 certificate for a publickey.
PKCS10 is used to request an X.509 certificate, and represents a publickey in the same way as that certificate, which can be for any algorithm.
PKCS11 is an interface; although many types of keys can be transferred over it, those keys are not 'PKCS11' keys.
PKSC12 in practice contains a publickey only as an X.509 certificate, for any algorithm.
So if a key is described as 'PKCS' it's almost certainly PKCS1 and thus RSA. But many publickey algorithms now exist and are more or less widely used (DSA/DH/MQV/EG some, ECDSA/ECDH/ECIES and EdDSA/X a lot, GOST a little, postquantum little but growing) that are not covered by any PKCS.
Upvotes: 2