pub struct SigningKey {
ed: SigningKey,
ml: PqdsaKeyPair,
ml_seed: Zeroizing<[u8; 32]>,
vk: VerifyingKey,
}Expand description
Hybrid signing key, the ‘private key’. Generate using SigningKey::generate.
Fields§
§ed: SigningKey§ml: PqdsaKeyPair§ml_seed: Zeroizing<[u8; 32]>The 32-byte ML-DSA seed. Kept because PqdsaKeyPair does not retain it, yet we need it to
encode the key compactly.
vk: VerifyingKeyPrecomputed VerifyingKey. Constructing one parses the ML-DSA public key, so we do that
once here and hand out shared references via verifying_key.
Implementations§
Source§impl SigningKey
impl SigningKey
Sourcepub fn generate() -> Result<Self, Opaque>
pub fn generate() -> Result<Self, Opaque>
Generates a SigningKey. Expensive.
Sourcepub fn verifying_key(&self) -> &VerifyingKey
pub fn verifying_key(&self) -> &VerifyingKey
Returns the associated VerifyingKey. Cheap: it is precomputed at construction, and we
return a shared reference rather than cloning — cloning an ML-DSA key calls EVP_PKEY_up_ref
under a global lock, whereas verifying through & is lock-free and safe to share across
threads.
Sourcepub fn encode(&self) -> SigningKeyBytes
pub fn encode(&self) -> SigningKeyBytes
Encodes for storage. Cheap.
Sourcepub fn ed25519_signing_key(&self) -> &SigningKey
pub fn ed25519_signing_key(&self) -> &SigningKey
The ed25519 component, for producing a classical EdDSA signature (alg: "EdDSA").
Used only for the backwards-compatible HHPP that pre-hybrid hubs verify with the
constellation’s phc_jwt_key (= VerifyingKey::ed25519_bytes). This signs the raw JWS
input.
Sourcefn from_parts(ed_seed: [u8; 32], ml_seed: [u8; 32]) -> Result<Self, Opaque>
fn from_parts(ed_seed: [u8; 32], ml_seed: [u8; 32]) -> Result<Self, Opaque>
Assembles a SigningKey from the two 32-byte seeds — the ed25519 secret key and the ML-DSA
seed — deriving both component keys (so neither call site repeats that) and precomputing the
VerifyingKey (parsing the ML-DSA public key once here, not on every
verifying_key).
Trait Implementations§
Source§impl Debug for SigningKey
impl Debug for SigningKey
Source§impl Key for SigningKey
impl Key for SigningKey
Auto Trait Implementations§
impl Freeze for SigningKey
impl !RefUnwindSafe for SigningKey
impl Send for SigningKey
impl Sync for SigningKey
impl Unpin for SigningKey
impl UnsafeUnpin for SigningKey
impl !UnwindSafe 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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more