asymmetric static method
Creates an asymmetric cipher based on the given algorithm.
algorithm: The asymmetric cipher algorithm (RSA, ECDSA)
input: The complete input record with configuration
Returns: An instance of the specified asymmetric cipher
Throws: ArgumentError if algorithm is not supported
Note: ECDSA is supported only as signature, not as cipher.
Implementation
static IAsymmetricCipher asymmetric(
CryptoAlgorithm algorithm,
InputAsymmetricCipher input,
) {
return switch (algorithm) {
CryptoAlgorithm.rsa => RSACipher.createFull(InputRSACipher(parent: input)),
CryptoAlgorithm.ecdsa => throw ArgumentError(
'ECDSA is not supported as a cipher. Use asymmetricSign() for signature operations.',
),
_ => throw ArgumentError('Not an asymmetric cipher algorithm: $algorithm'),
};
}