pub struct SigningKey(/* private fields */);Expand description
Signing key to authenticate an ACME account
Read a signing key from a PKCS#8 PEM-encoded file:
let private = "-----BEGIN PRIVATE KEY-----
MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgm1tOPOUt86+QgoiJ
kirpEl69+tUxLP848nPw9BbyW1ShRANCAASGWHBM2Lj7uUA4i9/jKSDp1vw4+iyu
hxVHBELXhxaD/LOQKtQAOhumi1uCTg8mMTrFrUM1VOtF8R0+rjrB3UXd
-----END PRIVATE KEY-----";
let key = SigningKey::from_pkcs8_pem(private,
SignatureKind::Ecdsa(yacme_key::EcdsaAlgorithm::P256))
.unwrap();⚠️ Do not use this key, it is an example used for testing only!
Implementations§
Source§impl SigningKey
impl SigningKey
Sourcepub fn from_pkcs8_pem(
data: &str,
signature: SignatureKind,
) -> Result<Self, Error>
pub fn from_pkcs8_pem( data: &str, signature: SignatureKind, ) -> Result<Self, Error>
Read a private key from a PEM-encoded PKCS#8 format key (usually the kind produced by OpenSSL) into this signing key document. You must provide the signature kind, as the code does not currently infer the type of key in use.
Sourcepub fn kind(&self) -> SignatureKind
pub fn kind(&self) -> SignatureKind
Return the signature kind, used to recover the key type from a PEM file.
Source§impl SigningKey
impl SigningKey
Sourcepub fn public_key(&self) -> PublicKey
pub fn public_key(&self) -> PublicKey
The public key half of this signing key.
Sourcepub fn as_jwk(&self) -> Jwk
pub fn as_jwk(&self) -> Jwk
A JSON web key type suitable for use in a JWS header and for use when creating a key thumbprint for authentication challenges.
Sourcepub fn algorithm(&self) -> AlgorithmIdentifier<'_>
pub fn algorithm(&self) -> AlgorithmIdentifier<'_>
The pkcs8 algorithm identifier for this key.
Trait Implementations§
Source§impl Debug for SigningKey
impl Debug for SigningKey
Source§impl EncodePrivateKey for SigningKey
impl EncodePrivateKey for SigningKey
Source§fn to_pkcs8_der(&self) -> Result<SecretDocument>
fn to_pkcs8_der(&self) -> Result<SecretDocument>
Serialize a
SecretDocument containing a PKCS#8-encoded private key.Source§fn to_pkcs8_pem(
&self,
line_ending: LineEnding,
) -> Result<Zeroizing<String>, Error>
fn to_pkcs8_pem( &self, line_ending: LineEnding, ) -> Result<Zeroizing<String>, Error>
Serialize this private key as PEM-encoded PKCS#8 with the given
LineEnding.impl Eq for SigningKey
Source§impl PartialEq for SigningKey
impl PartialEq for SigningKey
Source§impl Signer<Signature> for SigningKey
impl Signer<Signature> for SigningKey
impl StructuralPartialEq for SigningKey
Auto Trait Implementations§
impl !RefUnwindSafe for SigningKey
impl !Send for SigningKey
impl !Sync for SigningKey
impl !UnwindSafe for SigningKey
impl Freeze for SigningKey
impl Unpin for SigningKey
impl UnsafeUnpin for SigningKey
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> EncodeEcPrivateKey for Twhere
T: EncodePrivateKey,
impl<T> EncodeEcPrivateKey for Twhere
T: EncodePrivateKey,
Source§fn to_sec1_der(&self) -> Result<SecretDocument, Error>
fn to_sec1_der(&self) -> Result<SecretDocument, Error>
Serialize a
SecretDocument containing a SEC1-encoded private key.Source§fn to_sec1_pem(
&self,
line_ending: LineEnding,
) -> Result<Zeroizing<String>, Error>
fn to_sec1_pem( &self, line_ending: LineEnding, ) -> Result<Zeroizing<String>, Error>
Serialize this private key as PEM-encoded SEC1 with the given
LineEnding. Read more