diff --git a/cryptoki/src/mechanism/elliptic_curve.rs b/cryptoki/src/mechanism/elliptic_curve.rs index e044fe6..69e43c9 100644 --- a/cryptoki/src/mechanism/elliptic_curve.rs +++ b/cryptoki/src/mechanism/elliptic_curve.rs @@ -93,6 +93,17 @@ impl EcKdf<'_> { } } + /// The key derivation function based on sha256 as defined in the ANSI X9.63 standard. The + /// derived key is produced by concatenating hashes of the shared + /// value followed by 00000001, 00000002, etc. until we find + /// enough bytes to fill the `CKA_VALUE_LEN` of the derived key. + pub fn sha256() -> Self { + Self { + kdf_type: CKD_SHA256_KDF, + shared_data: None, + } + } + // The intention here is to be able to support other methods with // shared data, without it being a breaking change, by just adding // additional constructors here.