StaticgenerateGenerates a new key pair.
The key generation options
A PrivateKeyInfo containing the generated key pair
StaticgenerateGenerates an EC (Elliptic Curve) key pair with the specified curve.
Optionaloptions: { namedCurve?: "P-256" | "P-384" | "P-521" }EC key generation options (defaults: namedCurve='P-256')
A PrivateKeyInfo containing the generated EC key pair
StaticgenerateGenerates an RSA key pair with the specified options.
Optionaloptions: {RSA key generation options (defaults: keySize=2048, hash='SHA-256')
A PrivateKeyInfo containing the generated RSA key pair
KeyGen class provides functionality to generate cryptographic key pairs.
This class leverages the configured cryptographic provider to create key pairs for various algorithms such as RSA, ECDSA, and EdDSA. The generated keys are returned in standard formats suitable for storage and usage in cryptographic operations.
Example