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

org.bouncycastle.oer.its.ieee1609dot2.VerificationKeyIndicator Maven / Gradle / Ivy

Go to download

The Bouncy Castle Java APIs for ASN.1 extension and utility APIs used to support bcpkix and bctls with the BC FIPS provider. The APIs may also be used with other providers although if being used in a FIPS context it is the responsibility of the user to ensure that any other providers used are FIPS certified and used appropriately.

There is a newer version: 2.0.3
Show newest version
package org.bouncycastle.oer.its.ieee1609dot2;

import org.bouncycastle.asn1.ASN1Choice;
import org.bouncycastle.asn1.ASN1Encodable;
import org.bouncycastle.asn1.ASN1Object;
import org.bouncycastle.asn1.ASN1Primitive;
import org.bouncycastle.asn1.ASN1TaggedObject;
import org.bouncycastle.asn1.BERTags;
import org.bouncycastle.asn1.DERTaggedObject;
import org.bouncycastle.oer.its.ieee1609dot2.basetypes.EccP256CurvePoint;
import org.bouncycastle.oer.its.ieee1609dot2.basetypes.PublicVerificationKey;

/**
 * 
 *     VerificationKeyIndicator ::= CHOICE {
 *         verificationKey PublicVerificationKey,
 *         reconstructionValue EccP256CurvePoint,
 *         ...
 *     }
 * 
*/ public class VerificationKeyIndicator extends ASN1Object implements ASN1Choice { public static final int verificationKey = 0; public static final int reconstructionValue = 1; private final int choice; private final ASN1Encodable verificationKeyIndicator; public VerificationKeyIndicator(int choice, ASN1Encodable value) { this.choice = choice; this.verificationKeyIndicator = value; } private VerificationKeyIndicator(ASN1TaggedObject ato) { this.choice = ato.getTagNo(); switch (choice) { case verificationKey: verificationKeyIndicator = PublicVerificationKey.getInstance(ato.getObject()); break; case reconstructionValue: verificationKeyIndicator = EccP256CurvePoint.getInstance(ato.getObject()); break; default: throw new IllegalArgumentException("invalid choice value " + choice); } } public static VerificationKeyIndicator verificationKey(PublicVerificationKey value) { return new VerificationKeyIndicator(verificationKey, value); } public static VerificationKeyIndicator reconstructionValue(EccP256CurvePoint value) { return new VerificationKeyIndicator(reconstructionValue, value); } public static VerificationKeyIndicator getInstance(Object src) { if (src instanceof VerificationKeyIndicator) { return (VerificationKeyIndicator)src; } if (src != null) { return new VerificationKeyIndicator(ASN1TaggedObject.getInstance(src)); } return null; } public int getChoice() { return choice; } public ASN1Encodable getVerificationKeyIndicator() { return verificationKeyIndicator; } public ASN1Primitive toASN1Primitive() { return new DERTaggedObject(choice, verificationKeyIndicator); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy