Expand description
Type-safe asymmetric key generation.
§Example
use win_crypto_ng::asymmetric::{AsymmetricAlgorithm, AsymmetricAlgorithmId, AsymmetricKey};
use win_crypto_ng::asymmetric::{ecc::NistP384, Ecdh, Rsa};
// Handle to an asymmetric key whose algorithm ID is known at run-time
let handle: AsymmetricKey<AsymmetricAlgorithmId, _> =
AsymmetricKey::builder(AsymmetricAlgorithmId::Rsa).key_bits(512).build().unwrap();
// Handle to an asymmetric key whose algorithm is known to be RSA
let handle: AsymmetricKey<Rsa, _> =
AsymmetricKey::builder(Rsa).key_bits(512).build().unwrap();
let handle = AsymmetricKey::builder(Ecdh(NistP384)).build().unwrap();
Structs§
- Builder
- Main builder type used to generate asymmetric key pairs.
- Builder
With KeyBits - Builder type with key length provided in bits.
- Builder
With Params - Builder type with provided both key length and algorithm-specific parameters.
- DhParameter
View Tail - Dynamically-sized part of the
DhParameter
blob. - DhParams
- Algorithm-specific DH parameters.
- DsaParameter
V2View Tail - Dynamically-sized part of the
DsaParameterV2
blob. - DsaParameter
View Tail - Dynamically-sized part of the
DsaParameter
blob. - DsaParams
V1 - Algorithm-specific DSA parameters. Applies to keys with lesser or equal than 1024 bit length.
- DsaParams
V2 - Algorithm-specific DSA parameters. Applies to keys with greater than 1024 bit length.
- KeyBits
Gt1024 Lte3072 - Key size in bits has to be in the (1024, 3072] range.
- KeyBits
Gte512 Lte1024 - Key size in bits has to be in the [512, 1024] range.
- NoConstraint
- No constraint for keys. Used by default.
Enums§
- Builder
Options - Algorithm-specific parameters to generate a key with.
- DhParameter
- Dynamic struct layout for
BCRYPT_DH_PARAMETER_HEADER
. - DsaHash
Algorithm - Specifies the hashing algorithm to use in the DSA key context.
- DsaParameter
- Dynamic struct layout for
BCRYPT_DSA_PARAMETER_HEADER
. - DsaParameter
V2 - Dynamic struct layout for
BCRYPT_DSA_PARAMETER_HEADER_V2
. - DsaParams
- Algorithm-specific DH parameters.
- Fips
Version - Specifies the Federal Information Processing Standard (FIPS) to apply when used in conjuction with a DSA key of greater than 1024 bit length.
Traits§
- Builder
Params - Marker type for additional algorithm-specific parameters.
- KeyConstraint
- Marker trait for key constraint such as key size.
- Needs
KeySize - Marker trait implemented for algorithms that require explicitly providing key size in bits to be generated.
- NotNeeds
KeySize - Marker trait implemented for algorithms that do not require explicitly providing key size in bits (and, by extension, other parameters).