Struct noise_sv2::Responder

source ·
pub struct Responder { /* private fields */ }

Implementations§

source§

impl Responder

source

pub fn from_authority_kp( public: &[u8; 32], private: &[u8; 32], cert_validity: Duration ) -> Result<Box<Self>, Error>

source

pub fn new(a: Keypair, cert_validity: u32) -> Box<Self>

source

pub fn step_1( &mut self, elligatorswift_theirs_ephemeral_serialized: [u8; 64] ) -> Result<([u8; 234], NoiseCodec), Error>

§4.5.1.2 Responder
  1. receives ephemeral public key message with ElligatorSwift encoding (64 bytes plaintext)
  2. parses these 64 byte as PubKey and interprets is as re.public_key
  3. calls MixHash(re.public_key)
  4. calls DecryptAndHash() on remaining bytes (i.e. on empty data with empty k, thus effectively only calls MixHash() on empty data)
§4.5.2.1 Responder
  1. initializes empty output buffer
  2. generates ephemeral keypair e, appends the 64 bytes ElligatorSwift encoding of e.public_key to the buffer
  3. calls MixHash(e.public_key)
  4. calls MixKey(ECDH(e.private_key, re.public_key))
  5. appends EncryptAndHash(s.public_key) (80 bytes: 64 bytes encrypted elliswift public key, 16 bytes MAC)
  6. calls MixKey(ECDH(s.private_key, re.public_key))
  7. appends EncryptAndHash(SIGNATURE_NOISE_MESSAGE) (74 + 16 bytes) to the buffer
  8. submits the buffer for sending to the initiator
  9. return pair of CipherState objects, the first for encrypting transport messages from initiator to responder, and the second for messages in the other direction:
    1. sets temp_k1, temp_k2 = HKDF(ck, zerolen, 2)
    2. creates two new CipherState objects c1 and c2
    3. calls c1.InitializeKey(temp_k1) and c2.InitializeKey(temp_k2)
    4. returns the pair (c1, c2)
§Message format of NX-handshake part 2
Field nameDescription
PUBKEYResponder’s plaintext ephemeral public key
PUBKEYResponder’s encrypted static public key
MACMessage authentication code for responder’s static public key
SIGNATURE_NOISE_MESSAGESigned message containing Responder’s static key. Signature is issued by authority that is generally known to operate the server acting as the noise responder
MACMessage authentication code for SIGNATURE_NOISE_MESSAGE

Message length: 234 bytes

Trait Implementations§

source§

impl Debug for Responder

source§

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

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

impl Drop for Responder

source§

fn drop(&mut self)

Executes the destructor for this type. 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> 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

§

type Output = T

Should always be Self
source§

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

§

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>,

§

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