|
11 | 11 | // [NIST FIPS 203]: https://doi.org/10.6028/NIST.FIPS.203 |
12 | 12 | package mlkem |
13 | 13 |
|
14 | | -import "crypto/internal/fips140/mlkem" |
| 14 | +import ( |
| 15 | + "crypto" |
| 16 | + "crypto/internal/fips140/mlkem" |
| 17 | +) |
15 | 18 |
|
16 | 19 | const ( |
17 | 20 | // SharedKeySize is the size of a shared key produced by ML-KEM. |
@@ -82,6 +85,16 @@ func (dk *DecapsulationKey768) EncapsulationKey() *EncapsulationKey768 { |
82 | 85 | return &EncapsulationKey768{dk.key.EncapsulationKey()} |
83 | 86 | } |
84 | 87 |
|
| 88 | +// Encapsulator returns the encapsulation key, like |
| 89 | +// [DecapsulationKey768.EncapsulationKey]. |
| 90 | +// |
| 91 | +// It implements [crypto.Decapsulator]. |
| 92 | +func (dk *DecapsulationKey768) Encapsulator() crypto.Encapsulator { |
| 93 | + return dk.EncapsulationKey() |
| 94 | +} |
| 95 | + |
| 96 | +var _ crypto.Decapsulator = (*DecapsulationKey768)(nil) |
| 97 | + |
85 | 98 | // An EncapsulationKey768 is the public key used to produce ciphertexts to be |
86 | 99 | // decapsulated by the corresponding DecapsulationKey768. |
87 | 100 | type EncapsulationKey768 struct { |
@@ -164,6 +177,16 @@ func (dk *DecapsulationKey1024) EncapsulationKey() *EncapsulationKey1024 { |
164 | 177 | return &EncapsulationKey1024{dk.key.EncapsulationKey()} |
165 | 178 | } |
166 | 179 |
|
| 180 | +// Encapsulator returns the encapsulation key, like |
| 181 | +// [DecapsulationKey1024.EncapsulationKey]. |
| 182 | +// |
| 183 | +// It implements [crypto.Decapsulator]. |
| 184 | +func (dk *DecapsulationKey1024) Encapsulator() crypto.Encapsulator { |
| 185 | + return dk.EncapsulationKey() |
| 186 | +} |
| 187 | + |
| 188 | +var _ crypto.Decapsulator = (*DecapsulationKey1024)(nil) |
| 189 | + |
167 | 190 | // An EncapsulationKey1024 is the public key used to produce ciphertexts to be |
168 | 191 | // decapsulated by the corresponding DecapsulationKey1024. |
169 | 192 | type EncapsulationKey1024 struct { |
|
0 commit comments