pub fn sign(signing_input: &str, key: Key<'_>, algorithm: Algorithm) -> Result<String, Error> {
    match algorithm {
        Algorithm::RS256 => sign_rsa(&signature::RSA_PKCS1_SHA256, key, signing_input),
        Algorithm::RS384 => sign_rsa(&signature::RSA_PKCS1_SHA384, key, signing_input),
        Algorithm::RS512 => sign_rsa(&signature::RSA_PKCS1_SHA512, key, signing_input),

        Algorithm::PS256 => sign_rsa(&signature::RSA_PSS_SHA256, key, signing_input),
        Algorithm::PS384 => sign_rsa(&signature::RSA_PSS_SHA384, key, signing_input),
        Algorithm::PS512 => sign_rsa(&signature::RSA_PSS_SHA512, key, signing_input),
        _ => panic!("Unsupported algorithm {:?}", algorithm),
    }
}
/// Take the payload of a JWT, sign it using the algorithm given and return
/// the base64 url safe encoded of the result.
///
/// Only use this function if you want to do something other than JWT.
Take the payload of a JWT, sign it using the algorithm given and return
the base64 url safe encoded of the result.

Only use this function if you want to do something other than JWT.
Take the payload of a JWT sign it using the algorithm given and return the base64 url safe encoded of the result . Only use this function if you want to do something other than JWT .
pub fn sign(signing_input: &str, key: Key<'_>, algorithm: Algorithm) -> Result<String, Error> {
    match algorithm {
        Algorithm::RS256 => sign_rsa(&signature::RSA_PKCS1_SHA256, key, signing_input),
        Algorithm::RS384 => sign_rsa(&signature::RSA_PKCS1_SHA384, key, signing_input),
        Algorithm::RS512 => sign_rsa(&signature::RSA_PKCS1_SHA512, key, signing_input),
        Algorithm::PS256 => sign_rsa(&signature::RSA_PSS_SHA256, key, signing_input),
        Algorithm::PS384 => sign_rsa(&signature::RSA_PSS_SHA384, key, signing_input),
        Algorithm::PS512 => sign_rsa(&signature::RSA_PSS_SHA512, key, signing_input),
        _ => panic!("Unsupported algorithm {:?}", algorithm),
    }
}
pub fn sign ( signing_input : & str , key : Key < ' _ > , algorithm : Algorithm ) -> Result < String , Error > { match algorithm { Algorithm :: RS256 => sign_rsa ( & signature :: RSA_PKCS1_SHA256 , key , signing_input ) , Algorithm :: RS384 => sign_rsa ( & signature :: RSA_PKCS1_SHA384 , key , signing_input ) , Algorithm :: RS512 => sign_rsa ( & signature :: RSA_PKCS1_SHA512 , key , signing_input ) , Algorithm :: PS256 => sign_rsa ( & signature :: RSA_PSS_SHA256 , key , signing_input ) , Algorithm :: PS384 => sign_rsa ( & signature :: RSA_PSS_SHA384 , key , signing_input ) , Algorithm :: PS512 => sign_rsa ( & signature :: RSA_PSS_SHA512 , key , signing_input ) , _ => panic ! ( " " algorithm ) , } }
Take the payload of a JWT, sign it using the algorithm given and return
the base64 url safe encoded of the result.
Take the payload of a JWT sign it using the algorithm given and return the base64 url safe encoded of the result .
signing_input
&str
key
Key<'_>
algorithm
Algorithm