Trait x509_certificate::signing::Sign
source · [−]pub trait Sign {
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<Vec<u8>>;
fn rsa_primes(&self) -> Result<Option<(Vec<u8>, Vec<u8>)>, Error>;
}
Expand description
Signifies that an entity is capable of producing cryptographic signatures.
Required Methods
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()
.
fn 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.
fn 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.
fn 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.
fn private_key_data(&self) -> Option<Vec<u8>>
fn private_key_data(&self) -> Option<Vec<u8>>
Obtain the raw private key data.