Example usage for org.bouncycastle.pqc.crypto.newhope NHKeyPairGenerator NHKeyPairGenerator

List of usage examples for org.bouncycastle.pqc.crypto.newhope NHKeyPairGenerator NHKeyPairGenerator

Introduction

In this page you can find the example usage for org.bouncycastle.pqc.crypto.newhope NHKeyPairGenerator NHKeyPairGenerator.

Prototype

NHKeyPairGenerator

Source Link

Usage

From source file:com.distrimind.util.crypto.NewHopeKeyAgreementClient.java

License:Open Source License

private byte[] getDataPhase1() {
    valid = false;/*from   w w w . ja v a 2s.  co m*/
    //init key pair
    NHKeyPairGenerator keyPairEngine = new NHKeyPairGenerator();

    keyPairEngine.init(new KeyGenerationParameters(randomForKeys, 1024));
    AsymmetricCipherKeyPair pair = keyPairEngine.generateKeyPair();
    NHPublicKeyParameters pub = (NHPublicKeyParameters) pair.getPublic();
    priv = (NHPrivateKeyParameters) pair.getPrivate();

    byte[] res = pub.getPubData();
    valid = true;
    return res;
}