pub enum UnsignedSharedKey {
Rsa2048_OaepSha256_B64 {
data: Vec<u8>,
},
Rsa2048_OaepSha1_B64 {
data: Vec<u8>,
},
Rsa2048_OaepSha256_HmacSha256_B64 {
data: Vec<u8>,
mac: Vec<u8>,
},
Rsa2048_OaepSha1_HmacSha256_B64 {
data: Vec<u8>,
mac: Vec<u8>,
},
}Expand description
§Encrypted string primitive
UnsignedSharedKey is a Bitwarden specific primitive that represents an asymmetrically encrypted symmetric key. Since the symmetric key is directly encrypted with the public key, without any further signature, the receiver cannot guarantee the senders identity.
UnsignedSharedKey type allows for different encryption algorithms to be used which is represented by the different variants of the enum.
§Note
For backwards compatibility we will rarely if ever be able to remove support for decrypting old variants, but we should be opinionated in which variants are used for encrypting.
§Variants
§Serialization
UnsignedSharedKey implements std::fmt::Display and std::str::FromStr to allow for easy serialization and uses a custom scheme to represent the different variants.
The scheme is one of the following schemes:
[type].[data]
Where:
[type]: is a digit number representing the variant.[data]: is the encrypted data.
Variants§
Rsa2048_OaepSha256_B64
3
Rsa2048_OaepSha1_B64
4
Rsa2048_OaepSha256_HmacSha256_B64
5
Rsa2048_OaepSha1_HmacSha256_B64
6
Implementations§
Sourcepub fn encapsulate_key_unsigned(
encapsulated_key: &SymmetricCryptoKey,
encapsulation_key: &AsymmetricPublicCryptoKey,
) -> Result<UnsignedSharedKey, CryptoError>
pub fn encapsulate_key_unsigned( encapsulated_key: &SymmetricCryptoKey, encapsulation_key: &AsymmetricPublicCryptoKey, ) -> Result<UnsignedSharedKey, CryptoError>
Encapsulate a symmetric key, to be shared asymmetrically. Produces a UnsignedSharedKey::Rsa2048_OaepSha1_B64 variant. Note, this does not sign the data and thus does not guarantee sender authenticity.
Sourcepub fn decapsulate_key_unsigned(
&self,
decapsulation_key: &AsymmetricCryptoKey,
) -> Result<SymmetricCryptoKey, CryptoError>
pub fn decapsulate_key_unsigned( &self, decapsulation_key: &AsymmetricCryptoKey, ) -> Result<SymmetricCryptoKey, CryptoError>
Decapsulate a symmetric key, shared asymmetrically. Note: The shared key does not have a sender signature and sender authenticity is not guaranteed.
Trait Implementations§
Source§fn clone(&self) -> UnsignedSharedKey
fn clone(&self) -> UnsignedSharedKey
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
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>,
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreAuto Trait Implementations§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more