Skip to main content

SigningKey

Trait SigningKey 

Source
pub trait SigningKey<K: KeyName + ?Sized>: Serialize {
    // Required methods
    fn keymap(&self) -> Result<PublicKeyMap, BadJson>;
    fn key_id(&self) -> Result<OwnedSigningKeyId<K>, BadJson>;

    // Provided methods
    fn stripped_canonical_string(&self) -> Result<String, BadJson> { ... }
    fn compare(&self, other: &Self) -> Result<bool, BadJson> { ... }
}
Expand description

This trait provides helper functions on any signing key.

Required Methods§

Source

fn keymap(&self) -> Result<PublicKeyMap, BadJson>

Function that extracts the [PublicKeyMap] from Self.

Source

fn key_id(&self) -> Result<OwnedSigningKeyId<K>, BadJson>

Function that returns Self’s key ID used in signing an object.

There is no single implementation because different keys use different key ID formats.

Provided Methods§

Source

fn stripped_canonical_string(&self) -> Result<String, BadJson>

This converts the key in self into its canonical string, but stripped off of its signatures and unsigned fields. This is useful to compare two objects that were signed and tell if they were the same, or in tests to prepare a key for being signed.

§Error

The function will error out a BadJson in the following cases:

Source

fn compare(&self, other: &Self) -> Result<bool, BadJson>

Compares the key in self with another one, using their stripped canonical strings (See Self::stripped_canonical_string).

This is for example called on every signature upload to compare the uploaded signed key with the corresponding stored one.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl SigningKey<Base64PublicKeyOrDeviceId> for CrossSigningKey

Source§

fn keymap(&self) -> Result<PublicKeyMap, BadJson>

Source§

fn key_id( &self, ) -> Result<OwnedSigningKeyId<Base64PublicKeyOrDeviceId>, BadJson>

Source§

impl SigningKey<Base64PublicKeyOrDeviceId> for DeviceKeys

Source§

fn keymap(&self) -> Result<PublicKeyMap, BadJson>

Source§

fn key_id( &self, ) -> Result<OwnedSigningKeyId<Base64PublicKeyOrDeviceId>, BadJson>

Implementors§