Struct fog_crypto::identity::IdentityKey [−][src]
Identity Key that allows signing hashes as a given Identity.
This acts as a wrapper for a specific cryptographic private key, and it is only be used for a specific corresponding signature algorithm. The underlying private key may be located in a hardware module or some other private keystore; in this case, it may be impossible to export the key.
Example
// Make a new temporary key let mut csprng = rand::rngs::OsRng {}; let key = IdentityKey::new_temp(&mut csprng); // Sign some data with it let hash = Hash::new(b"I am data, about to be signed"); let signature = key.sign(&hash);
Implementations
impl IdentityKey
[src]
pub fn new_temp<R>(csprng: &mut R) -> IdentityKey where
R: CryptoRng + RngCore,
[src]
R: CryptoRng + RngCore,
Generate a temporary IdentityKey
that exists in program memory.
pub fn new_temp_with_version<R>(
csprng: &mut R,
version: u8
) -> Result<IdentityKey, CryptoError> where
R: CryptoRng + RngCore,
[src]
csprng: &mut R,
version: u8
) -> Result<IdentityKey, CryptoError> where
R: CryptoRng + RngCore,
Generate a temporary IdentityKey
that exists in program memory. Uses the specified
version instead of the default, and fails if the version is unsupported.
pub fn version(&self) -> u8
[src]
Get the signature algorithm version used by this key.
pub fn id(&self) -> &Identity
[src]
Get the associated Identity
for this key.
pub fn sign(&self, hash: &Hash) -> Signature
[src]
Sign a hash. Signing should be fast and always succeed.
pub fn export_for_lock<R: CryptoRng + RngCore>(
&self,
csprng: &mut R,
lock: &LockId
) -> Option<IdentityLockbox>
[src]
&self,
csprng: &mut R,
lock: &LockId
) -> Option<IdentityLockbox>
Pack this key into a Lockbox
, meant for the recipient specified by lock
. Returns None if
this key cannot be exported.
pub fn export_for_stream<R: CryptoRng + RngCore>(
&self,
csprng: &mut R,
stream: &StreamKey
) -> Option<IdentityLockbox>
[src]
&self,
csprng: &mut R,
stream: &StreamKey
) -> Option<IdentityLockbox>
Pack this key into a Lockbox
, meant for the recipient specified by stream
. Returns None
if this key cannot be exported.
Trait Implementations
impl Clone for IdentityKey
[src]
fn clone(&self) -> IdentityKey
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for IdentityKey
[src]
impl Display for IdentityKey
[src]
Auto Trait Implementations
impl !RefUnwindSafe for IdentityKey
[src]
impl !Send for IdentityKey
[src]
impl !Sync for IdentityKey
[src]
impl Unpin for IdentityKey
[src]
impl !UnwindSafe for IdentityKey
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,