Open bgrieder opened 1 year ago
Subject Public Key Info [RFC 5280 § 4.1.2.7] is the format of Public Keys found in Certificates Signing Requests and Certificates.
PKCS#1 is the format used by the BitString of Subject Public Key Infos in Certificate Signing Requests and Certificates.
This is a simple addition; the rsa crate already offers some facilities.
rsa
let rsa_public_key = rsa::RsaPublicKey::from_pkcs1_der(spki.subject_public_key.as_bytes().unwrap()) .unwrap();
where spki is a spki::SubjectPublicKeyInfo
spki
spki::SubjectPublicKeyInfo
NIST EC offers direct deserialization via elliptic_curve::DecodedKey trait and this impl.
elliptic_curve::DecodedKey
impl<T> DecodePublicKey for T where T: for<'a> [TryFrom](https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html)<SubjectPublicKeyInfo<AnyRef<'a>, BitStringRef<'a>>, Error = Error>, ///Deserialize object from ASN.1 DER-encoded [SubjectPublicKeyInfo] (binary format). fn from_public_key_der(bytes: &[u8]) -> Result<T, Error>
let pk = p256::PublicKey::from_public_key_der(csr.info.public_key.to_der().unwrap().as_slice()) .unwrap();
? (TODO)
WIP https://github.com/Cosmian/crypto_core/tree/spki
Subject Public Key Info [RFC 5280 § 4.1.2.7] is the format of Public Keys found in Certificates Signing Requests and Certificates.
RSA
PKCS#1 is the format used by the BitString of Subject Public Key Infos in Certificate Signing Requests and Certificates.
This is a simple addition; the
rsa
crate already offers some facilities.where
spki
is aspki::SubjectPublicKeyInfo
Nist Elliptic Curves
NIST EC offers direct deserialization via
elliptic_curve::DecodedKey
trait and this impl.Curve25519
? (TODO)