All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.bouncycastle.pqc.asn1.CMCEPublicKey Maven / Gradle / Ivy

Go to download

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 Java 1.8 and later with debug enabled.

The newest version!
package org.bouncycastle.pqc.asn1;


import org.bouncycastle.asn1.ASN1EncodableVector;
import org.bouncycastle.asn1.ASN1Object;
import org.bouncycastle.asn1.ASN1OctetString;
import org.bouncycastle.asn1.ASN1Primitive;
import org.bouncycastle.asn1.ASN1Sequence;
import org.bouncycastle.asn1.DEROctetString;
import org.bouncycastle.asn1.DERSequence;
import org.bouncycastle.util.Arrays;

/**
 *
 *    Classic McEliece Public Key Format.
 *    See https://datatracker.ietf.org/doc/draft-uni-qsckeys/ for details.
 *    
 *        McEliecePublicKey ::= SEQUENCE {
 *        T       OCTET STRING    -- public key
 *    }
 *    
*/ public class CMCEPublicKey extends ASN1Object { private byte[] T; public CMCEPublicKey(byte[] t) { this.T = t; } /** * @deprecated use getInstance() */ public CMCEPublicKey(ASN1Sequence seq) { T = Arrays.clone(ASN1OctetString.getInstance(seq.getObjectAt(0)).getOctets()); } public byte[] getT() { return Arrays.clone(T); } public ASN1Primitive toASN1Primitive() { ASN1EncodableVector v = new ASN1EncodableVector(); v.add(new DEROctetString(T)); return new DERSequence(v); } public static CMCEPublicKey getInstance(Object o) { if (o instanceof CMCEPublicKey) { return (CMCEPublicKey) o; } else if (o != null) { return new CMCEPublicKey(ASN1Sequence.getInstance(o)); } return null; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy