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

org.bouncycastle.pqc.asn1.SPHINCSPLUSPublicKey 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 JDK 1.4.

There is a newer version: 1.79
Show newest version
package org.bouncycastle.pqc.asn1;

import org.bouncycastle.asn1.*;
import org.bouncycastle.util.Arrays;

/**
 * See https://datatracker.ietf.org/doc/draft-uni-qsckeys-sphincsplus/00/ for details.
 * ASN.1 Encoding for a
 * SphincsPlus public key for fully populated:
 *  
 *   SPHINCSPPLUSPublicKey := SEQUENCE {
 *     pkseed          OCTET STRING,     --n-byte public key seed
 *     pkroot          OCTET STRING      --n-byte public hypertree root
 *   }
 * 
*/ public class SPHINCSPLUSPublicKey extends ASN1Object { private byte[] pkseed; private byte[] pkroot; public SPHINCSPLUSPublicKey(byte[] pkseed, byte[] pkroot) { this.pkseed = pkseed; this.pkroot = pkroot; } public SPHINCSPLUSPublicKey(ASN1Sequence seq) { pkseed = Arrays.clone(ASN1OctetString.getInstance(seq.getObjectAt(0)).getOctets()); pkroot = Arrays.clone(ASN1OctetString.getInstance(seq.getObjectAt(1)).getOctets()); } public byte[] getPkseed() { return Arrays.clone(pkseed); } public byte[] getPkroot() { return Arrays.clone(pkroot); } public ASN1Primitive toASN1Primitive() { ASN1EncodableVector v = new ASN1EncodableVector(); v.add(new DEROctetString(pkseed)); v.add(new DEROctetString(pkroot)); return new DERSequence(v); } public static SPHINCSPLUSPublicKey getInstance(Object o) { if (o instanceof SPHINCSPLUSPublicKey) { return (SPHINCSPLUSPublicKey) o; } else if (o != null) { return new SPHINCSPLUSPublicKey(ASN1Sequence.getInstance(o)); } return null; } }



© 2015 - 2024 Weber Informatics LLC | Privacy Policy