convertKey method

Key convertKey({
  1. required KeyAlgorithm algorithm,
})

Converts this key or keypair to its equivalent for another key algorithm.

Throws an AskarKeyException if key conversion fails.

Implementation

Key convertKey({required KeyAlgorithm algorithm}) {
  try {
    return Key(askarKeyConvert(localKeyHandle, algorithm).getValueOrException());
  } catch (e) {
    throw AskarKeyException('Failed to convert key from algorithm: $e');
  }
}