Example usage for org.bouncycastle.crypto.params IESParameters getMacKeySize

List of usage examples for org.bouncycastle.crypto.params IESParameters getMacKeySize

Introduction

In this page you can find the example usage for org.bouncycastle.crypto.params IESParameters getMacKeySize.

Prototype

public int getMacKeySize() 

Source Link

Usage

From source file:dorkbox.util.crypto.CryptoECC.java

License:Apache License

@SuppressWarnings("RedundantIfStatement")
public static boolean compare(IESParameters cipherAParams, IESParameters cipherBParams) {
    if (!Arrays.equals(cipherAParams.getDerivationV(), cipherBParams.getDerivationV())) {
        return false;
    }//from  ww  w  .java  2s. c om
    if (!Arrays.equals(cipherAParams.getEncodingV(), cipherBParams.getEncodingV())) {
        return false;
    }

    if (cipherAParams.getMacKeySize() != cipherBParams.getMacKeySize()) {
        return false;
    }
    return true;
}

From source file:dorkbox.util.serialization.IesParametersSerializer.java

License:Apache License

@Override
public void write(Kryo kryo, Output output, IESParameters key) {
    byte[] bytes;
    int length;// www .ja  v  a 2  s. com

    ///////////
    bytes = key.getDerivationV();
    length = bytes.length;

    output.writeInt(length, true);
    output.writeBytes(bytes, 0, length);

    ///////////
    bytes = key.getEncodingV();
    length = bytes.length;

    output.writeInt(length, true);
    output.writeBytes(bytes, 0, length);

    ///////////
    output.writeInt(key.getMacKeySize(), true);
}

From source file:org.forgerock.openicf.framework.remote.security.ECIESEncryptor.java

License:Open Source License

protected byte[] doFinal(byte[] bytes, IESParameters params, boolean encrypt) {
    try {//from w ww  . j  a v a  2 s  .c om
        final IESEngine engine = initialiseEngine(encrypt, privateKeyParameter, publicKeyParameter,
                new IESParameters(params.getDerivationV(), params.getEncodingV(), params.getMacKeySize()));
        return engine.processBlock(bytes, 0, bytes.length);
    } catch (InvalidCipherTextException e) {
        throw new RuntimeException(e.getMessage(), e);
    }
}