pub trait Sign {
    // Required methods
    fn sign(
        &self,
        message: &[u8]
    ) -> Result<(Vec<u8>, SignatureAlgorithm), Error>;
    fn key_algorithm(&self) -> Option<KeyAlgorithm>;
    fn public_key_data(&self) -> Bytes;
    fn signature_algorithm(&self) -> Result<SignatureAlgorithm, Error>;
    fn private_key_data(&self) -> Option<Zeroizing<Vec<u8>>>;
    fn rsa_primes(
        &self
    ) -> Result<Option<(Zeroizing<Vec<u8>>, Zeroizing<Vec<u8>>)>, Error>;
}
Expand description

Signifies that an entity is capable of producing cryptographic signatures.

Required Methods§

source

fn sign(&self, message: &[u8]) -> Result<(Vec<u8>, SignatureAlgorithm), Error>

👎Deprecated since 0.13.0: use the signature::Signer trait instead

Create a cyrptographic signature over a message.

Takes the message to be signed, which will be digested by the implementation.

Returns the raw bytes constituting the signature and which signature algorithm was used. The returned SignatureAlgorithm can be serialized into an ASN.1 AlgorithmIdentifier via .into().

source

fn key_algorithm(&self) -> Option<KeyAlgorithm>

Obtain the algorithm of the private key.

If we can’t coerce the key algorithm to KeyAlgorithm, None is returned.

source

fn public_key_data(&self) -> Bytes

Obtain the raw bytes constituting the public key of the signing certificate.

This will be .tbs_certificate.subject_public_key_info.subject_public_key of a parsed X.509 public certificate.

source

fn signature_algorithm(&self) -> Result<SignatureAlgorithm, Error>

Obtain the SignatureAlgorithm that this signer will use.

Instances can be coerced into the ASN.1 AlgorithmIdentifier via .into() for easy inclusion in ASN.1 structures.

source

fn private_key_data(&self) -> Option<Zeroizing<Vec<u8>>>

Obtain the raw private key data.

source

fn rsa_primes( &self ) -> Result<Option<(Zeroizing<Vec<u8>>, Zeroizing<Vec<u8>>)>, Error>

Obtain RSA key primes p and q, if available.

Implementors§