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

org.bouncycastle.pqc.asn1.XMSSKeyParams 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.8 and up.

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

import org.bouncycastle.asn1.ASN1EncodableVector;
import org.bouncycastle.asn1.ASN1Integer;
import org.bouncycastle.asn1.ASN1Object;
import org.bouncycastle.asn1.ASN1Primitive;
import org.bouncycastle.asn1.ASN1Sequence;
import org.bouncycastle.asn1.DERSequence;
import org.bouncycastle.asn1.x509.AlgorithmIdentifier;

/**
 * XMSSKeyParams
 * 
 *     XMSSKeyParams ::= SEQUENCE {
 *     version INTEGER -- 0
 *     height INTEGER
 *     treeDigest AlgorithmIdentifier
 * }
 * 
*/ public class XMSSKeyParams extends ASN1Object { private final ASN1Integer version; private final int height; private final AlgorithmIdentifier treeDigest; public XMSSKeyParams(int height, AlgorithmIdentifier treeDigest) { this.version = new ASN1Integer(0); this.height = height; this.treeDigest = treeDigest; } private XMSSKeyParams(ASN1Sequence sequence) { this.version = ASN1Integer.getInstance(sequence.getObjectAt(0)); this.height = ASN1Integer.getInstance(sequence.getObjectAt(1)).intValueExact(); this.treeDigest = AlgorithmIdentifier.getInstance(sequence.getObjectAt(2)); } public static XMSSKeyParams getInstance(Object o) { if (o instanceof XMSSKeyParams) { return (XMSSKeyParams)o; } else if (o != null) { return new XMSSKeyParams(ASN1Sequence.getInstance(o)); } return null; } public int getHeight() { return height; } public AlgorithmIdentifier getTreeDigest() { return treeDigest; } public ASN1Primitive toASN1Primitive() { ASN1EncodableVector v = new ASN1EncodableVector(); v.add(version); v.add(new ASN1Integer(height)); v.add(treeDigest); return new DERSequence(v); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy