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

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

Introduction

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

Prototype

public AsymmetricCipherKeyPair generateKeyPair() 

Source Link

Usage

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

License:Open Source License

private byte[] getDataPhase1() {
    valid = false;/*from  www  . ja  v a  2s. c o  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;
}