diff options
author | Daniel Schadt <kingdread@gmx.de> | 2023-11-30 16:25:38 +0100 |
---|---|---|
committer | Daniel Schadt <kingdread@gmx.de> | 2023-11-30 16:25:38 +0100 |
commit | 9925eb2b22d6a4da3b6dcb0effbc5eb014d9cb0d (patch) | |
tree | ca5cd9c37f2ecfc1f856cae350f90788fcc901f0 /src | |
parent | 1737847637522132c1c35e4970d3f5e0f6338b4e (diff) | |
download | hohibe-9925eb2b22d6a4da3b6dcb0effbc5eb014d9cb0d.tar.gz hohibe-9925eb2b22d6a4da3b6dcb0effbc5eb014d9cb0d.tar.bz2 hohibe-9925eb2b22d6a4da3b6dcb0effbc5eb014d9cb0d.zip |
implement conversion from opaque structs to value
Diffstat (limited to 'src')
-rw-r--r-- | src/kem.rs | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -69,6 +69,12 @@ impl From<<BonehBoyenGoh as Hibe>::PublicKey> for PublicKey { } } +impl From<PublicKey> for <BonehBoyenGoh as Hibe>::PublicKey { + fn from(value: PublicKey) -> Self { + value.0 + } +} + impl ByteAccess for PublicKey { fn bytes(&self) -> Vec<u8> { bincode::serialize(&self.0).unwrap() @@ -102,6 +108,12 @@ impl From<<BonehBoyenGoh as Hibe>::MasterKey> for MasterKey { } } +impl From<MasterKey> for <BonehBoyenGoh as Hibe>::MasterKey { + fn from(value: MasterKey) -> Self { + value.0 + } +} + impl ByteAccess for MasterKey { fn bytes(&self) -> Vec<u8> { bincode::serialize(&self.0).unwrap() @@ -135,6 +147,12 @@ impl From<<BonehBoyenGoh as Hibe>::PrivateKey> for PrivateKey { } } +impl From<PrivateKey> for <BonehBoyenGoh as Hibe>::PrivateKey { + fn from(value: PrivateKey) -> Self { + value.0 + } +} + impl ByteAccess for PrivateKey { fn bytes(&self) -> Vec<u8> { bincode::serialize(&self.0).unwrap() @@ -169,6 +187,12 @@ impl From<<BonehBoyenGoh as HibeKem>::EncapsulatedKey> for EncapsulatedKey { } } +impl From<EncapsulatedKey> for <BonehBoyenGoh as HibeKem>::EncapsulatedKey { + fn from(value: EncapsulatedKey) -> Self { + value.0 + } +} + impl ByteAccess for EncapsulatedKey { fn bytes(&self) -> Vec<u8> { bincode::serialize(&self.0).unwrap() |