You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
746 B
25 lines
746 B
using System;
|
|
|
|
using Org.BouncyCastle.Crypto.Parameters;
|
|
using Org.BouncyCastle.Security;
|
|
|
|
namespace Org.BouncyCastle.Crypto.Generators
|
|
{
|
|
public class Ed25519KeyPairGenerator
|
|
: IAsymmetricCipherKeyPairGenerator
|
|
{
|
|
private SecureRandom random;
|
|
|
|
public virtual void Init(KeyGenerationParameters parameters)
|
|
{
|
|
this.random = parameters.Random;
|
|
}
|
|
|
|
public virtual AsymmetricCipherKeyPair GenerateKeyPair()
|
|
{
|
|
Ed25519PrivateKeyParameters privateKey = new Ed25519PrivateKeyParameters(random);
|
|
Ed25519PublicKeyParameters publicKey = privateKey.GeneratePublicKey();
|
|
return new AsymmetricCipherKeyPair(publicKey, privateKey);
|
|
}
|
|
}
|
|
}
|
|
|