Skip to main content

VerifyingIdentity

Struct VerifyingIdentity 

Source
pub struct VerifyingIdentity { /* private fields */ }
Expand description

The public half of an identity: shareable, and safe to print.

Implementations§

Source§

impl VerifyingIdentity

Source

pub fn from_bytes(bytes: &[u8]) -> Result<Self, SignError>

Source

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}
Source

pub fn ed25519_bytes(&self) -> [u8; 32]

The Ed25519 half, in the 32-byte form OpenSSH uses.

Source

pub fn verify( &self, context: &[u8], message: &[u8], signature: &[u8], ) -> Result<(), SignError>

Verifies both halves. Neither alone is accepted.

Trait Implementations§

Source§

impl Clone for VerifyingIdentity

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for VerifyingIdentity

Source§

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

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

impl Eq for VerifyingIdentity

Source§

impl PartialEq for VerifyingIdentity

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.