asymmetric static method

Creates an asymmetric cipher based on the given algorithm.

algorithm: The asymmetric cipher algorithm (RSA) 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 (ECDSASign), not as cipher.

Implementation

static IAsymmetricCipher asymmetric(
  AsymmetricCipherAlgorithm algorithm,
  InputAsymmetricCipher input,
) {
  return switch (algorithm) {
    RSAAlgorithm() => RSACipher.createFull(InputRSACipher(parent: input)),
    ECDSACipherAlgorithm() => throw ArgumentError(
      'ECDSA is not supported as a cipher. Use ECDSASign for signature operations.',
    ),
  };
}