pub fn verifier_from_der(
        &self,
        input: impl AsRef<[u8]>,
    ) -> Result<EcdsaJwsVerifier, JoseError> {
        (|| -> anyhow::Result<EcdsaJwsVerifier> {
            let spki_der = match EcKeyPair::detect_pkcs8(input.as_ref(), true) {
                Some(curve) if curve == self.curve() => input.as_ref(),
                Some(curve) => bail!("The curve is mismatched: {}", curve),
                None => {
                    bail!("The ECDSA public key must be wrapped by SubjectPublicKeyInfo format.")
                }
            };

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

            Ok(EcdsaJwsVerifier {
                algorithm: self.clone(),
                public_key,
                key_id: None,
            })
        })()
        .map_err(|err| JoseError::InvalidKeyFormat(err))
    }
/// Return a verifier from a public key that is a DER encoded SubjectPublicKeyInfo.
///
/// # Arguments
/// * `input` - A public key that is a DER encoded SubjectPublicKeyInfo.
Return a verifier from a public key that is a DER encoded SubjectPublicKeyInfo.
Return a verifier from a public key that is a DER encoded SubjectPublicKeyInfo .
pub fn verifier_from_der(
        &self,
        input: impl AsRef<[u8]>,
    ) -> Result<EcdsaJwsVerifier, JoseError> {
        (|| -> anyhow::Result<EcdsaJwsVerifier> {
            let spki_der = match EcKeyPair::detect_pkcs8(input.as_ref(), true) {
                Some(curve) if curve == self.curve() => input.as_ref(),
                Some(curve) => bail!("The curve is mismatched: {}", curve),
                None => {
                    bail!("The ECDSA public key must be wrapped by SubjectPublicKeyInfo format.")
                }
            };
            let public_key = PKey::public_key_from_der(spki_der)?;
            Ok(EcdsaJwsVerifier {
                algorithm: self.clone(),
                public_key,
                key_id: None,
            })
        })()
        .map_err(|err| JoseError::InvalidKeyFormat(err))
    }
pub fn verifier_from_der ( & self , input : impl AsRef < [ u8 ] > , ) -> Result < EcdsaJwsVerifier , JoseError > { ( | | -> anyhow :: Result < EcdsaJwsVerifier > { let spki_der = match EcKeyPair :: detect_pkcs8 ( input . as_ref ( ) , true ) { Some ( curve ) if curve == self . curve ( ) => input . as_ref ( ) , Some ( curve ) => bail ! ( " " curve ) , None => { bail ! ( " " ) } } ; let public_key = PKey :: public_key_from_der ( spki_der ) ? ; Ok ( EcdsaJwsVerifier { algorithm : self . clone ( ) , public_key , key_id : None , } ) } ) ( ) . map_err ( | err | JoseError :: InvalidKeyFormat ( err ) ) }
Return a verifier from a public key that is a DER encoded SubjectPublicKeyInfo.
Return a verifier from a public key that is a DER encoded SubjectPublicKeyInfo .
&self
input
impl AsRef<[u8]>
&self
input
impl AsRef<[u8]>