generateCryptoKeyPair method

  1. @visibleForTesting
KeyPair generateCryptoKeyPair({
  1. int? keyBitLength,
})

Implementation

@visibleForTesting
KeyPair generateCryptoKeyPair({int? keyBitLength}) {
  switch (type) {
    case 'oct':
      return KeyPair.generateSymmetric(_getKeyBitLength(keyBitLength));
    case 'RSA':
      return KeyPair.generateRsa(bitStrength: _getKeyBitLength(keyBitLength));
    case 'EC':
      return KeyPair.generateEc(curvesByName[curve!]!);
  }
  throw UnsupportedError('Algorithms of type \'$type\' not supported');
}