I'm using pointycastle to generate a new RSA-Key for asymmetric encryption of data. To identify the key I want the fingerprint/hash of that key. How do I get it?
Here is my code to generate the RSA key (feel free to give me feedback when I do something wrong or insecure):
final secureRandom = FortunaRandom();
final seedSource = Random.secure();
final seeds = <int>[];
for (int i = 0; i < 32; i++) {
seeds.add(seedSource.nextInt(255));
}
secureRandom.seed(KeyParameter(Uint8List.fromList(seeds)));
final keyGen = RSAKeyGenerator()
..init(ParametersWithRandom(RSAKeyGeneratorParameters(BigInt.parse('65537'), 4096, 64), secureRandom));
final pair = keyGen.generateKeyPair();
final myPublic = pair.publicKey as RSAPublicKey;
final myPrivate = pair.privateKey as RSAPrivateKey;
What do I need hash exactly of my RSA key pair to get a fingerprint? sha1(myPublic.publicExponent)
?