win_crypto_ng::asymmetric

Module builder

Source
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.
BuilderWithKeyBits
Builder type with key length provided in bits.
BuilderWithParams
Builder type with provided both key length and algorithm-specific parameters.
DhParameterViewTail
Dynamically-sized part of the DhParameter blob.
DhParams
Algorithm-specific DH parameters.
DsaParameterV2ViewTail
Dynamically-sized part of the DsaParameterV2 blob.
DsaParameterViewTail
Dynamically-sized part of the DsaParameter blob.
DsaParamsV1
Algorithm-specific DSA parameters. Applies to keys with lesser or equal than 1024 bit length.
DsaParamsV2
Algorithm-specific DSA parameters. Applies to keys with greater than 1024 bit length.
KeyBitsGt1024Lte3072
Key size in bits has to be in the (1024, 3072] range.
KeyBitsGte512Lte1024
Key size in bits has to be in the [512, 1024] range.
NoConstraint
No constraint for keys. Used by default.

Enums§

BuilderOptions
Algorithm-specific parameters to generate a key with.
DhParameter
Dynamic struct layout for BCRYPT_DH_PARAMETER_HEADER.
DsaHashAlgorithm
Specifies the hashing algorithm to use in the DSA key context.
DsaParameter
Dynamic struct layout for BCRYPT_DSA_PARAMETER_HEADER.
DsaParameterV2
Dynamic struct layout for BCRYPT_DSA_PARAMETER_HEADER_V2.
DsaParams
Algorithm-specific DH parameters.
FipsVersion
Specifies the Federal Information Processing Standard (FIPS) to apply when used in conjuction with a DSA key of greater than 1024 bit length.

Traits§

BuilderParams
Marker type for additional algorithm-specific parameters.
KeyConstraint
Marker trait for key constraint such as key size.
NeedsKeySize
Marker trait implemented for algorithms that require explicitly providing key size in bits to be generated.
NotNeedsKeySize
Marker trait implemented for algorithms that do not require explicitly providing key size in bits (and, by extension, other parameters).