Trait x509_certificate::signing::Sign
source · 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§
sourcefn sign(&self, message: &[u8]) -> Result<(Vec<u8>, SignatureAlgorithm), Error>
fn sign(&self, message: &[u8]) -> Result<(Vec<u8>, SignatureAlgorithm), Error>
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()
.
sourcefn key_algorithm(&self) -> Option<KeyAlgorithm>
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.
sourcefn public_key_data(&self) -> Bytes
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.
sourcefn signature_algorithm(&self) -> Result<SignatureAlgorithm, Error>
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.