fn sign_ecdsa(
    alg: &'static signature::EcdsaSigningAlgorithm,
    key: Key,
    signing_input: &str,
) -> Result<String> {
    let signing_key = match key {
        Key::Pkcs8(bytes) => {
            signature::EcdsaKeyPair::from_pkcs8(alg, untrusted::Input::from(bytes))?
        }
        _ => {
            return Err(new_error(ErrorKind::InvalidKeyFormat));
        }
    };
    let rng = rand::SystemRandom::new();
    let sig = signing_key.sign(&rng, untrusted::Input::from(signing_input.as_bytes()))?;
    Ok(base64::encode_config(&sig, base64::URL_SAFE_NO_PAD))
}
/// The actual ECDSA signing + encoding
The actual ECDSA signing + encoding
The actual ECDSA signing + encoding
fn sign_ecdsa(
    alg: &'static signature::EcdsaSigningAlgorithm,
    key: Key,
    signing_input: &str,
) -> Result<String> {
    let signing_key = match key {
        Key::Pkcs8(bytes) => {
            signature::EcdsaKeyPair::from_pkcs8(alg, untrusted::Input::from(bytes))?
        }
        _ => {
            return Err(new_error(ErrorKind::InvalidKeyFormat));
        }
    };
    let rng = rand::SystemRandom::new();
    let sig = signing_key.sign(&rng, untrusted::Input::from(signing_input.as_bytes()))?;
    Ok(base64::encode_config(&sig, base64::URL_SAFE_NO_PAD))
}
fn sign_ecdsa ( alg : & ' static signature :: EcdsaSigningAlgorithm , key : Key , signing_input : & str , ) -> Result < String > { let signing_key = match key { Key :: Pkcs8 ( bytes ) => { signature :: EcdsaKeyPair :: from_pkcs8 ( alg , untrusted :: Input :: from ( bytes ) ) ? } _ => { return Err ( new_error ( ErrorKind :: InvalidKeyFormat ) ) ; } } ; let rng = rand :: SystemRandom :: new ( ) ; let sig = signing_key . sign ( & rng , untrusted :: Input :: from ( signing_input . as_bytes ( ) ) ) ? ; Ok ( base64 :: encode_config ( & sig , base64 :: URL_SAFE_NO_PAD ) ) }
The actual ECDSA signing + encoding
The actual ECDSA signing + encoding
alg
&'static signature::EcdsaSigningAlgorithm
key
Key
signing_input
&str