pub struct VerifyingIdentity { /* private fields */ }Expand description
The public half of an identity: shareable, and safe to print.
Implementations§
Source§impl VerifyingIdentity
impl VerifyingIdentity
pub fn from_bytes(bytes: &[u8]) -> Result<Self, SignError>
Sourcepub fn to_bytes(&self) -> [u8; 1984]
pub fn to_bytes(&self) -> [u8; 1984]
Examples found in repository?
examples/generate_signature_vectors.rs (line 14)
5fn main() -> Result<(), Box<dyn Error>> {
6 let directory = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../../conformance/vectors");
7 fs::create_dir_all(&directory)?;
8
9 let seed = [0x55_u8; SEED_LENGTH];
10 let signing = SigningIdentity::from_bytes(&seed)?;
11 fs::write(directory.join("signer.test-seed"), seed)?;
12 fs::write(
13 directory.join("signer.test-public"),
14 signing.verifying_key().to_bytes(),
15 )?;
16
17 for (name, context, message) in [
18 (
19 "hello",
20 b"HIDE/0.5 vector".as_slice(),
21 b"Hello HIDE\n".as_slice(),
22 ),
23 ("empty", b"HIDE/0.5 vector".as_slice(), b"".as_slice()),
24 ] {
25 let signature = signing.sign(context, message);
26 fs::write(directory.join(format!("{name}.sig")), signature)?;
27 println!("generated {name}.sig: {} bytes", signature.len());
28 }
29 Ok(())
30}Sourcepub fn ed25519_bytes(&self) -> [u8; 32]
pub fn ed25519_bytes(&self) -> [u8; 32]
The Ed25519 half, in the 32-byte form OpenSSH uses.
Trait Implementations§
Source§impl Clone for VerifyingIdentity
impl Clone for VerifyingIdentity
Source§impl Debug for VerifyingIdentity
impl Debug for VerifyingIdentity
impl Eq for VerifyingIdentity
Auto Trait Implementations§
impl Forget for VerifyingIdentity
impl Freeze for VerifyingIdentity
impl Move for VerifyingIdentity
impl RefUnwindSafe for VerifyingIdentity
impl Send for VerifyingIdentity
impl Sync for VerifyingIdentity
impl Unpin for VerifyingIdentity
impl UnsafeUnpin for VerifyingIdentity
impl UnwindSafe for VerifyingIdentity
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
Mutably borrows from an owned value. Read more