org.bouncycastle.crypto.parsers.DHIESPublicKeyParser Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bcprov-lts8on Show documentation
Show all versions of bcprov-lts8on Show documentation
The Long Term Stable (LTS) Bouncy Castle Crypto package is a Java implementation of cryptographic algorithms. This jar contains the JCA/JCE provider and low-level API for the BC LTS version 2.73.7 for Java 8 and later.
package org.bouncycastle.crypto.parsers;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigInteger;
import org.bouncycastle.crypto.KeyParser;
import org.bouncycastle.crypto.params.AsymmetricKeyParameter;
import org.bouncycastle.crypto.params.DHParameters;
import org.bouncycastle.crypto.params.DHPublicKeyParameters;
import org.bouncycastle.util.io.Streams;
public class DHIESPublicKeyParser
implements KeyParser
{
private DHParameters dhParams;
public DHIESPublicKeyParser(DHParameters dhParams)
{
this.dhParams = dhParams;
}
public AsymmetricKeyParameter readKey(InputStream stream)
throws IOException
{
byte[] V = new byte[(dhParams.getP().bitLength() + 7) / 8];
Streams.readFully(stream, V, 0, V.length);
return new DHPublicKeyParameters(new BigInteger(1, V), dhParams);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy