[−][src]Trait iota_signing_preview::PrivateKey
Associated Types
type PublicKey: PublicKey
The type of the matching public key
type Signature: Signature
The type of the generated signatures
type Error
Required methods
fn generate_public_key(&self) -> Result<Self::PublicKey, Self::Error>
Returns the public counterpart of a private key
Example
IotaSeed, PrivateKeyGenerator, Seed, WotsPrivateKeyGeneratorBuilder, WotsSecurityLevel, }; use iota_signing_preview::PrivateKey; .security_level(WotsSecurityLevel::Medium) .build() .unwrap(); let public_key = private_key.generate_public_key();
fn sign(&mut self, message: &[i8]) -> Result<Self::Signature, Self::Error>
Generates and returns a signature for a given message
Arguments
message
A slice that holds a message to be signed
Example
IotaSeed, PrivateKeyGenerator, Seed, WotsPrivateKeyGeneratorBuilder, WotsSecurityLevel, }; use iota_signing_preview::PrivateKey; use iota_ternary_preview::{ T1B1Buf, TryteBuf, }; .security_level(WotsSecurityLevel::Medium) .build() .unwrap(); let message = "CHXHLHQLOPYP9NSUXTMWWABIBSBLUFXFRNWOZXJPVJPBCIDI99YBSCFYILCHPXHTSEYSYWIGQFERCRVDD"; let message_trits = TryteBuf::try_from_str(message).unwrap().as_trits().encode::<T1B1Buf>(); let signature = private_key.sign(&message_trits.as_i8_slice());
Implementors
impl<S, K> PrivateKey for MssPrivateKey<S, K> where
S: Sponge + Default,
K: PrivateKey,
<<K as PrivateKey>::PublicKey as PublicKey>::Signature: RecoverableSignature,
[src]
S: Sponge + Default,
K: PrivateKey,
<<K as PrivateKey>::PublicKey as PublicKey>::Signature: RecoverableSignature,