Struct openmls::schedule::psk::PreSharedKeyId
source · pub struct PreSharedKeyId { /* private fields */ }
Expand description
A PreSharedKeyID
is used to uniquely identify the PSKs that get injected
in the key schedule.
// draft-ietf-mls-protocol-19
struct {
PSKType psktype;
select (PreSharedKeyID.psktype) {
case external:
opaque psk_id<V>;
case resumption:
ResumptionPSKUsage usage;
opaque psk_group_id<V>;
uint64 psk_epoch;
};
opaque psk_nonce<V>;
} PreSharedKeyID;
Implementations§
sourcepub fn new(
ciphersuite: Ciphersuite,
rand: &impl OpenMlsRand,
psk: Psk
) -> Result<Self, CryptoError>
pub fn new( ciphersuite: Ciphersuite, rand: &impl OpenMlsRand, psk: Psk ) -> Result<Self, CryptoError>
Construct a PreSharedKeyID
with a random nonce.
sourcepub fn external(psk_id: Vec<u8>, psk_nonce: Vec<u8>) -> Self
pub fn external(psk_id: Vec<u8>, psk_nonce: Vec<u8>) -> Self
Construct an external PreSharedKeyID
.
sourcepub fn resumption(
usage: ResumptionPskUsage,
psk_group_id: GroupId,
psk_epoch: GroupEpoch,
psk_nonce: Vec<u8>
) -> Self
pub fn resumption( usage: ResumptionPskUsage, psk_group_id: GroupId, psk_epoch: GroupEpoch, psk_nonce: Vec<u8> ) -> Self
Construct a resumption PreSharedKeyID
.
sourcepub fn write_to_key_store<KeyStore: OpenMlsKeyStore>(
&self,
backend: &impl OpenMlsCryptoProvider<KeyStoreProvider = KeyStore>,
ciphersuite: Ciphersuite,
psk: &[u8]
) -> Result<(), PskError>
pub fn write_to_key_store<KeyStore: OpenMlsKeyStore>( &self, backend: &impl OpenMlsCryptoProvider<KeyStoreProvider = KeyStore>, ciphersuite: Ciphersuite, psk: &[u8] ) -> Result<(), PskError>
Save this PreSharedKeyId
in the keystore.
Note: The nonce is not saved as it must be unique for each time it’s being applied.
Trait Implementations§
source§fn clone(&self) -> PreSharedKeyId
fn clone(&self) -> PreSharedKeyId
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§fn tls_deserialize<R: Read>(bytes: &mut R) -> Result<Self, Error>
fn tls_deserialize<R: Read>(bytes: &mut R) -> Result<Self, Error>
This function deserializes the
bytes
from the provided a std::io::Read
and returns the populated struct. Read moresource§fn cmp(&self, other: &PreSharedKeyId) -> Ordering
fn cmp(&self, other: &PreSharedKeyId) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
Compares and returns the maximum of two values. Read more
source§fn eq(&self, other: &PreSharedKeyId) -> bool
fn eq(&self, other: &PreSharedKeyId) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§fn partial_cmp(&self, other: &PreSharedKeyId) -> Option<Ordering>
fn partial_cmp(&self, other: &PreSharedKeyId) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read more