because of the faster decryption i am changing my Code from RSA to ElGamal.
So i am using BouncyCastle for the first time now, but i can not figure out hot to convert my keys
ElGamalPublicKeyParameters pub_key;
ElGamalPrivateKeyParameters priv_key;
each to a byte[] (String would also work)
I found a solution for the class both are inheriting "AsymmetricKeyParameter":
PrivateKeyInfo k = PrivateKeyInfoFactory.CreatePrivateKeyInfo(private_key);
byte[] serializedKey = k.ToAsn1Object().GetDerEncoded();
but this works only for the PrivateKey. I could not find a similar was to do it with the public_key
I need a String or byte[] to be able to compress, encrypt, save and send the keys.
-
Thank you for your help in advance.