org.bouncycastle.pqc.asn1.FalconPublicKey Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bcprov-jdk15to18 Show documentation
Show all versions of bcprov-jdk15to18 Show documentation
The Bouncy Castle Crypto package is a Java implementation of cryptographic algorithms. This jar contains JCE provider and lightweight API for the Bouncy Castle Cryptography APIs for JDK 1.5 to JDK 1.8.
package org.bouncycastle.pqc.asn1;
import org.bouncycastle.asn1.*;
import org.bouncycastle.util.Arrays;
/**
*
* Classic McEliece Public Key Format.
* See https://datatracker.ietf.org/doc/draft-uni-qsckeys/ for details.
*
* FALCONPublicKey := SEQUENCE {
* h OCTET STRING -- integer polynomial h
* }
*
*/
public class FalconPublicKey
extends ASN1Object
{
private byte[] h;
public FalconPublicKey(byte[] h)
{
this.h = h;
}
public byte[] getH()
{
return h;
}
public FalconPublicKey(ASN1Sequence seq)
{
h = Arrays.clone(ASN1OctetString.getInstance(seq.getObjectAt(0)).getOctets());
}
public ASN1Primitive toASN1Primitive()
{
ASN1EncodableVector v = new ASN1EncodableVector();
v.add(new DEROctetString(h));
return new DERSequence(v);
}
public static FalconPublicKey getInstance(Object o)
{
if (o instanceof FalconPublicKey)
{
return (FalconPublicKey) o;
}
else if (o != null)
{
return new FalconPublicKey(ASN1Sequence.getInstance(o));
}
return null;
}
}