aboutsummaryrefslogtreecommitdiff
path: root/src/kem.rs
diff options
context:
space:
mode:
authorDaniel Schadt <kingdread@gmx.de>2023-11-30 16:25:38 +0100
committerDaniel Schadt <kingdread@gmx.de>2023-11-30 16:25:38 +0100
commit9925eb2b22d6a4da3b6dcb0effbc5eb014d9cb0d (patch)
treeca5cd9c37f2ecfc1f856cae350f90788fcc901f0 /src/kem.rs
parent1737847637522132c1c35e4970d3f5e0f6338b4e (diff)
downloadhohibe-9925eb2b22d6a4da3b6dcb0effbc5eb014d9cb0d.tar.gz
hohibe-9925eb2b22d6a4da3b6dcb0effbc5eb014d9cb0d.tar.bz2
hohibe-9925eb2b22d6a4da3b6dcb0effbc5eb014d9cb0d.zip
implement conversion from opaque structs to value
Diffstat (limited to 'src/kem.rs')
-rw-r--r--src/kem.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/kem.rs b/src/kem.rs
index 091247d..a97d34f 100644
--- a/src/kem.rs
+++ b/src/kem.rs
@@ -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()