nethsm::openpgp

Struct HsmKey

source
struct HsmKey<'a, 'b> {
    public_key: PublicKey,
    nethsm: &'a NetHsm,
    key_id: &'b KeyId,
}
Expand description

PGP-adapter for a NetHSM key.

All PGP-related operations executed on objects of this type will be forwarded to the NetHSM instance.

Fields§

§public_key: PublicKey§nethsm: &'a NetHsm§key_id: &'b KeyId

Implementations§

source§

impl<'a, 'b> HsmKey<'a, 'b>

source

fn new(nethsm: &'a NetHsm, public_key: PublicKey, key_id: &'b KeyId) -> Self

Creates a new remote signing key which will use key_id key for signing.

source

fn sign_mode(&self) -> Result<SignatureType>

Returns correct mode to use for signatures which depend on the public key.

Trait Implementations§

source§

impl Debug for HsmKey<'_, '_>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl PublicKeyTrait for HsmKey<'_, '_>

source§

fn verify_signature( &self, hash: HashAlgorithm, data: &[u8], sig: &SignatureBytes, ) -> Result<()>

Verify a signed message. Data will be hashed using hash, before verifying.
source§

fn encrypt<R: CryptoRng + Rng>( &self, rng: R, plain: &[u8], esk_type: EskType, ) -> Result<PkeskBytes>

Encrypt the given plain for this key.
source§

fn serialize_for_hashing(&self, writer: &mut impl Write) -> Result<()>

This is the data used for hashing in a signature. Only uses the public portion of the key.
source§

fn version(&self) -> KeyVersion

source§

fn fingerprint(&self) -> Fingerprint

source§

fn key_id(&self) -> KeyId

Returns the Key ID of the associated primary key.
source§

fn algorithm(&self) -> PublicKeyAlgorithm

source§

fn created_at(&self) -> &DateTime<Utc>

source§

fn expiration(&self) -> Option<u16>

source§

fn public_params(&self) -> &PublicParams

§

fn is_signing_key(&self) -> bool

§

fn is_encryption_key(&self) -> bool

source§

impl SecretKeyTrait for HsmKey<'_, '_>

source§

type PublicKey = PublicKey

source§

type Unlocked = HsmKey<'_, '_>

The type representing the unlocked version of this.
source§

fn unlock<F, G, T>(&self, _pw: F, work: G) -> Result<T>
where F: FnOnce() -> String, G: FnOnce(&Self::Unlocked) -> Result<T>,

Unlock the raw data in the secret parameters.
source§

fn create_signature<F>( &self, _key_pw: F, hash: HashAlgorithm, data: &[u8], ) -> Result<SignatureBytes>
where F: FnOnce() -> String,

source§

fn public_key(&self) -> Self::PublicKey

source§

fn hash_alg(&self) -> HashAlgorithm

The suggested hash algorithm to calculate the signature hash digest with, when using this key as a signer

Auto Trait Implementations§

§

impl<'a, 'b> Freeze for HsmKey<'a, 'b>

§

impl<'a, 'b> !RefUnwindSafe for HsmKey<'a, 'b>

§

impl<'a, 'b> !Send for HsmKey<'a, 'b>

§

impl<'a, 'b> !Sync for HsmKey<'a, 'b>

§

impl<'a, 'b> Unpin for HsmKey<'a, 'b>

§

impl<'a, 'b> !UnwindSafe for HsmKey<'a, 'b>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

source§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> MaybeSendSync for T