Converts symmetric encryption algorithm parameters to a content encryption algorithm identifier.
The symmetric encryption algorithm parameters
Content encryption algorithm as an AlgorithmIdentifier
Decrypts the given data using the specified private key and asymmetric algorithm.
The data to decrypt
The private key information
The decryption algorithm to use
Promise resolving to the decrypted data as a Uint8Array
Decrypts the given data using the specified symmetric key and algorithm.
The data to decrypt
The symmetric key to use for decryption
The decryption algorithm to use
Promise resolving to the decrypted data as a Uint8Array
Derives a cryptographic key from a password using the specified algorithm.
The password or key material to derive from
The key derivation algorithm parameters
Promise resolving to the derived key as a Uint8Array
Computes the cryptographic hash digest of the given data.
The data to hash
Promise resolving to the hash digest bytes
Converts a hash algorithm to a digest algorithm identifier.
The hash algorithm
Digest algorithm as a Uint8Array or AlgorithmIdentifier
Encrypts data using asymmetric (public key) cryptography.
The data to encrypt
The public key information
The encryption algorithm to use
Promise resolving to the encrypted data as a Uint8Array
Encrypts the given data using the specified symmetric key and algorithm.
The data to encrypt
The symmetric key to use for encryption
The encryption algorithm to use
Promise resolving to the encrypted data as a Uint8Array
Generates an asymmetric key pair for the specified algorithm and options.
Configuration options including algorithm, key size, and other parameters
A Promise that resolves to an object containing the public and private keys
Generates a symmetric key for the specified encryption algorithm.
The encryption algorithm to use
The generated symmetric key as a Uint8Array
Gets the EC curve parameters for a given asymmetric encryption algorithm.
The asymmetric encryption algorithm parameters
EC curve parameters as a Uint8Array or ObjectIdentifier
Extracts the EC named curve from an algorithm identifier or public key.
The ASN.1 algorithm identifier
Optional
publicKeyInfo: SubjectPublicKeyInfoOptional public key information to extract curve from
The EC named curve identifier
Generates cryptographically secure random bytes.
The number of random bytes to generate
Array containing the random bytes
Converts asymmetric encryption algorithm parameters to a key encryption algorithm identifier.
The asymmetric encryption algorithm parameters
Key encryption algorithm as an AlgorithmIdentifier
Creates a digital signature for the given data.
The data to sign
The signer's private key
The signature algorithm and parameters
Promise resolving to the signature bytes
Converts asymmetric encryption algorithm parameters to a signature algorithm identifier.
The asymmetric encryption algorithm parameters
Signature algorithm as a Uint8Array or AlgorithmIdentifier
Converts an ASN.1 algorithm identifier to asymmetric encryption algorithm parameters.
The ASN.1 algorithm identifier
Optional
publicKeyInfo: SubjectPublicKeyInfoOptional public key information for context
Asymmetric encryption algorithm parameters
Converts an ASN.1 algorithm identifier to a hash algorithm.
The ASN.1 algorithm identifier
The hash algorithm
Converts an ASN.1 algorithm identifier to symmetric encryption algorithm parameters.
The ASN.1 algorithm identifier
Symmetric encryption algorithm parameters
Verifies a digital signature against the original data.
The original data that was signed
The signer's public key
The signature to verify
The signature algorithm and parameters
Promise resolving to true if signature is valid
Interface defining the cryptographic operations required by the PKI library.
This interface abstracts cryptographic operations to allow different implementations based on available platforms and algorithm requirements. The default WebCryptoProvider uses the Web Crypto API, while extended providers can support additional algorithms and legacy cryptographic functions.
Implementations must provide:
Example