pub fn from_der(input: impl AsRef<[u8]>) -> Result<Self, JoseError> {
        (|| -> anyhow::Result<Self> {
            let pkcs8_der_vec;
            let pkcs8_der = match Self::detect_pkcs8(input.as_ref(), false) {
                Some(_) => input.as_ref(),
                None => {
                    pkcs8_der_vec = Self::to_pkcs8(input.as_ref(), false);
                    pkcs8_der_vec.as_slice()
                }
            };

            let private_key = PKey::private_key_from_der(pkcs8_der)?;
            let rsa = private_key.rsa()?;
            let key_len = rsa.size();

            Ok(Self {
                private_key,
                key_len,
                algorithm: None,
                key_id: None,
            })
        })()
        .map_err(|err| JoseError::InvalidKeyFormat(err))
    }
/// Create a RSA key pair from a private key that is a DER encoded PKCS#8 PrivateKeyInfo or PKCS#1 RSAPrivateKey.
///
/// # Arguments
/// * `input` - A private key that is a DER encoded PKCS#8 PrivateKeyInfo or PKCS#1 RSAPrivateKey.
Create a RSA key pair from a private key that is a DER encoded PKCS#8 PrivateKeyInfo or PKCS#1 RSAPrivateKey.
Create a RSA key pair from a private key that is a DER encoded PKCS#8 PrivateKeyInfo or PKCS#1 RSAPrivateKey .
pub fn from_der(input: impl AsRef<[u8]>) -> Result<Self, JoseError> {
        (|| -> anyhow::Result<Self> {
            let pkcs8_der_vec;
            let pkcs8_der = match Self::detect_pkcs8(input.as_ref(), false) {
                Some(_) => input.as_ref(),
                None => {
                    pkcs8_der_vec = Self::to_pkcs8(input.as_ref(), false);
                    pkcs8_der_vec.as_slice()
                }
            };
            let private_key = PKey::private_key_from_der(pkcs8_der)?;
            let rsa = private_key.rsa()?;
            let key_len = rsa.size();
            Ok(Self {
                private_key,
                key_len,
                algorithm: None,
                key_id: None,
            })
        })()
        .map_err(|err| JoseError::InvalidKeyFormat(err))
    }
pub fn from_der ( input : impl AsRef < [ u8 ] > ) -> Result < Self , JoseError > { ( | | -> anyhow :: Result < Self > { let pkcs8_der_vec ; let pkcs8_der = match Self :: detect_pkcs8 ( input . as_ref ( ) , false ) { Some ( _ ) => input . as_ref ( ) , None => { pkcs8_der_vec = Self :: to_pkcs8 ( input . as_ref ( ) , false ) ; pkcs8_der_vec . as_slice ( ) } } ; let private_key = PKey :: private_key_from_der ( pkcs8_der ) ? ; let rsa = private_key . rsa ( ) ? ; let key_len = rsa . size ( ) ; Ok ( Self { private_key , key_len , algorithm : None , key_id : None , } ) } ) ( ) . map_err ( | err | JoseError :: InvalidKeyFormat ( err ) ) }
Create a RSA key pair from a private key that is a DER encoded PKCS#8 PrivateKeyInfo or PKCS#1 RSAPrivateKey.
Create a RSA key pair from a private key that is a DER encoded PKCS#8 PrivateKeyInfo or PKCS#1 RSAPrivateKey .
input
impl AsRef<[u8]>
input
impl AsRef<[u8]>