pub fn verifier_from_pem(
        &self,
        input: impl AsRef<[u8]>,
    ) -> Result<EddsaJwsVerifier, JoseError> {
        (|| -> anyhow::Result<EddsaJwsVerifier> {
            let (alg, data) = util::parse_pem(input.as_ref())?;
            let spki_der = match alg.as_str() {
                "PUBLIC KEY" => match EdKeyPair::detect_pkcs8(&data, true) {
                    Some(_) => data.as_slice(),
                    None => bail!(
                        "The EdDSA public key must be wrapped by SubjectPublicKeyInfo format."
                    ),
                },
                alg => bail!("Unacceptable algorithm: {}", alg),
            };

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

            Ok(EddsaJwsVerifier {
                algorithm: self.clone(),
                public_key,
                key_id: None,
            })
        })()
        .map_err(|err| JoseError::InvalidKeyFormat(err))
    }
/// Return a verifier from a key of common PEM format.
///
/// Common PEM format is a DER and base64 encoded SubjectPublicKeyInfo
/// that surrounded by "-----BEGIN/END PUBLIC KEY----".
///
/// # Arguments
/// * `input` - A key of common or traditional PEM format.
Return a verifier from a key of common 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 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<EddsaJwsVerifier, JoseError> {
        (|| -> anyhow::Result<EddsaJwsVerifier> {
            let (alg, data) = util::parse_pem(input.as_ref())?;
            let spki_der = match alg.as_str() {
                "PUBLIC KEY" => match EdKeyPair::detect_pkcs8(&data, true) {
                    Some(_) => data.as_slice(),
                    None => bail!(
                        "The EdDSA public key must be wrapped by SubjectPublicKeyInfo format."
                    ),
                },
                alg => bail!("Unacceptable algorithm: {}", alg),
            };
            let public_key = PKey::public_key_from_der(spki_der)?;
            Ok(EddsaJwsVerifier {
                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 < EddsaJwsVerifier , JoseError > { ( | | -> anyhow :: Result < EddsaJwsVerifier > { let ( alg , data ) = util :: parse_pem ( input . as_ref ( ) ) ? ; let spki_der = match alg . as_str ( ) { " " => match EdKeyPair :: detect_pkcs8 ( & data , true ) { Some ( _ ) => data . as_slice ( ) , None => bail ! ( " " ) , } , alg => bail ! ( " " alg ) , } ; let public_key = PKey :: public_key_from_der ( spki_der ) ? ; Ok ( EddsaJwsVerifier { algorithm : self . clone ( ) , public_key , key_id : None , } ) } ) ( ) . map_err ( | err | JoseError :: InvalidKeyFormat ( err ) ) }
Return a verifier from a key of common PEM format.
Return a verifier from a key of common PEM format .
&self
input
impl AsRef<[u8]>
&self
input
impl AsRef<[u8]>