asymmetricSign static method

IAsymmetricSign asymmetricSign(
  1. CryptoAlgorithm algorithm,
  2. InputAsymmetricSign input
)

Creates an asymmetric signature instance based on the given algorithm.

algorithm: The asymmetric signature algorithm (RSA Signature, ECDSA) input: The complete input record with configuration

Returns: An instance of the specified signature handler

Throws: ArgumentError if algorithm is not supported

Implementation

static IAsymmetricSign asymmetricSign(
  CryptoAlgorithm algorithm,
  InputAsymmetricSign input,
) {
  return switch (algorithm) {
    CryptoAlgorithm.rsaSignature =>
      RSASignatureCipher.createFull(InputRSASignatureCipher(parent: input)),
    CryptoAlgorithm.ecdsaSign =>
      ECDSASign.createFull(InputECDSASign(parent: input)),
    _ => throw ArgumentError('Not an asymmetric signature algorithm: $algorithm'),
  };
}