Skip to content

Commit 5e7c1bb

Browse files
authored
x-wing: impl KeyExport for DecapsulationKey (#229)
1 parent 569e43f commit 5e7c1bb

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

x-wing/src/lib.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,13 +242,19 @@ impl KeySizeUser for DecapsulationKey {
242242
}
243243

244244
impl KeyInit for DecapsulationKey {
245-
fn new(key: &ArrayN<u8, 32>) -> Self {
245+
fn new(key: &Key<Self>) -> Self {
246246
let (_sk_m, _sk_x, pk_m, pk_x) = expand_key(key.as_ref());
247247
let ek = EncapsulationKey { pk_m, pk_x };
248248
Self { sk: key.0, ek }
249249
}
250250
}
251251

252+
impl KeyExport for DecapsulationKey {
253+
fn to_bytes(&self) -> Key<Self> {
254+
self.sk.into()
255+
}
256+
}
257+
252258
#[cfg(feature = "zeroize")]
253259
impl ZeroizeOnDrop for DecapsulationKey {}
254260

0 commit comments

Comments
 (0)