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

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

Introduction

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

Prototype

public void init(KeyGenerationParameters param) 

Source Link

Usage

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

License:Open Source License

private byte[] getDataPhase1() {
    valid = false;//  w  ww  .j  a  v a  2  s  .  com
    //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;
}