org.bouncycastle.crypto.general.X448PublicKeyParameters Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bc-fips Show documentation
Show all versions of bc-fips Show documentation
The FIPS 140-3 Bouncy Castle Crypto package is a Java implementation of cryptographic algorithms certified to FIPS 140-3 level 1. This jar contains JCE provider and low-level API for the BC-FJA version 2.0.0, FIPS Certificate #4743. Please see certificate for certified platform details.
package org.bouncycastle.crypto.general;
import java.io.EOFException;
import java.io.IOException;
import java.io.InputStream;
import org.bouncycastle.crypto.internal.params.AsymmetricKeyParameter;
import org.bouncycastle.math.ec.rfc7748.X448;
import org.bouncycastle.util.Arrays;
import org.bouncycastle.util.io.Streams;
final class X448PublicKeyParameters
extends AsymmetricKeyParameter
{
public static final int KEY_SIZE = X448.POINT_SIZE;
private final byte[] data = new byte[KEY_SIZE];
public X448PublicKeyParameters(byte[] buf, int off)
{
super(false);
System.arraycopy(buf, off, data, 0, KEY_SIZE);
}
public X448PublicKeyParameters(InputStream input) throws IOException
{
super(false);
if (KEY_SIZE != Streams.readFully(input, data))
{
throw new EOFException("EOF encountered in middle of X448 public key");
}
}
public void encode(byte[] buf, int off)
{
System.arraycopy(data, 0, buf, off, KEY_SIZE);
}
public byte[] getEncoded()
{
return Arrays.clone(data);
}
}