pub fn verifier_from_pem(
        &self,
        input: impl AsRef<[u8]>,
    ) -> Result<RsassaJwsVerifier, JoseError> {
        (|| -> anyhow::Result<RsassaJwsVerifier> {
            let (alg, data) = util::parse_pem(input.as_ref())?;

            let spki_der_vec;
            let spki_der = match alg.as_str() {
                "PUBLIC KEY" => match RsaKeyPair::detect_pkcs8(&data, true) {
                    Some(_) => &data,
                    None => bail!("Invalid PEM contents."),
                },
                "RSA PUBLIC KEY" => {
                    spki_der_vec = RsaKeyPair::to_pkcs8(&data, true);
                    spki_der_vec.as_slice()
                }
                alg => bail!("Inappropriate algorithm: {}", alg),
            };

            let public_key = PKey::public_key_from_der(spki_der)?;

            let rsa = public_key.rsa()?;
            if rsa.size() * 8 < 2048 {
                bail!("key length must be 2048 or more.");
            }

            Ok(RsassaJwsVerifier {
                algorithm: self.clone(),
                public_key,
                key_id: None,
            })
        })()
        .map_err(|err| JoseError::InvalidKeyFormat(err))
    }
/// Return a verifier from a key of common or traditional PEM format.
///
/// Common PEM format is a DER and base64 encoded SubjectPublicKeyInfo
/// that surrounded by "-----BEGIN/END PUBLIC KEY----".
///
/// Traditional PEM format is a DER and base64 PKCS#1 RSAPublicKey
/// that surrounded by "-----BEGIN/END RSA PUBLIC KEY----".
///
/// # Arguments
/// * `input` - A public key of common or traditional PEM format.
Return a verifier from a key of common or traditional PEM format.
Common PEM format is a DER and base64 encoded SubjectPublicKeyInfo
that surrounded by "BEGIN/END PUBLIC KEY----".


Return a verifier from a key of common or traditional PEM format . Common PEM format is a DER and base64 encoded SubjectPublicKeyInfo that surrounded by " BEGIN / END PUBLIC KEY ---- " .
pub fn verifier_from_pem(
        &self,
        input: impl AsRef<[u8]>,
    ) -> Result<RsassaJwsVerifier, JoseError> {
        (|| -> anyhow::Result<RsassaJwsVerifier> {
            let (alg, data) = util::parse_pem(input.as_ref())?;
            let spki_der_vec;
            let spki_der = match alg.as_str() {
                "PUBLIC KEY" => match RsaKeyPair::detect_pkcs8(&data, true) {
                    Some(_) => &data,
                    None => bail!("Invalid PEM contents."),
                },
                "RSA PUBLIC KEY" => {
                    spki_der_vec = RsaKeyPair::to_pkcs8(&data, true);
                    spki_der_vec.as_slice()
                }
                alg => bail!("Inappropriate algorithm: {}", alg),
            };
            let public_key = PKey::public_key_from_der(spki_der)?;
            let rsa = public_key.rsa()?;
            if rsa.size() * 8 < 2048 {
                bail!("key length must be 2048 or more.");
            }
            Ok(RsassaJwsVerifier {
                algorithm: self.clone(),
                public_key,
                key_id: None,
            })
        })()
        .map_err(|err| JoseError::InvalidKeyFormat(err))
    }
pub fn verifier_from_pem ( & self , input : impl AsRef < [ u8 ] > , ) -> Result < RsassaJwsVerifier , JoseError > { ( | | -> anyhow :: Result < RsassaJwsVerifier > { let ( alg , data ) = util :: parse_pem ( input . as_ref ( ) ) ? ; let spki_der_vec ; let spki_der = match alg . as_str ( ) { " " => match RsaKeyPair :: detect_pkcs8 ( & data , true ) { Some ( _ ) => & data , None => bail ! ( " " ) , } , " " => { spki_der_vec = RsaKeyPair :: to_pkcs8 ( & data , true ) ; spki_der_vec . as_slice ( ) } alg => bail ! ( " " alg ) , } ; let public_key = PKey :: public_key_from_der ( spki_der ) ? ; let rsa = public_key . rsa ( ) ? ; if rsa . size ( ) * 8 < 2048 { bail ! ( " " ) ; } Ok ( RsassaJwsVerifier { algorithm : self . clone ( ) , public_key , key_id : None , } ) } ) ( ) . map_err ( | err | JoseError :: InvalidKeyFormat ( err ) ) }
Return a verifier from a key of common or traditional PEM format.
Return a verifier from a key of common or traditional PEM format .
&self
input
impl AsRef<[u8]>
&self
input
impl AsRef<[u8]>