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

org.bouncycastle.asn1.cms.GenericHybridParameters 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.

The newest version!
/***************************************************************/
/******    DO NOT EDIT THIS CLASS bc-java SOURCE FILE     ******/
/***************************************************************/
package org.bouncycastle.asn1.cms;

import org.bouncycastle.asn1.ASN1EncodableVector;
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;

/**
 * RFC 5990 GenericHybridParameters class.
 * 
 * GenericHybridParameters ::= SEQUENCE {
 *    kem  KeyEncapsulationMechanism,
 *    dem  DataEncapsulationMechanism
 * }
 *
 * KeyEncapsulationMechanism ::= AlgorithmIdentifier {{KEMAlgorithms}}
 * DataEncapsulationMechanism ::= AlgorithmIdentifier {{DEMAlgorithms}}
 * 
*/ public class GenericHybridParameters extends ASN1Object { private final AlgorithmIdentifier kem; private final AlgorithmIdentifier dem; private GenericHybridParameters(ASN1Sequence sequence) { if (sequence.size() != 2) { throw new IllegalArgumentException("ASN.1 SEQUENCE should be of length 2"); } this.kem = AlgorithmIdentifier.getInstance(sequence.getObjectAt(0)); this.dem = AlgorithmIdentifier.getInstance(sequence.getObjectAt(1)); } public static GenericHybridParameters getInstance( Object o) { if (o instanceof GenericHybridParameters) { return (GenericHybridParameters)o; } else if (o != null) { return new GenericHybridParameters(ASN1Sequence.getInstance(o)); } return null; } public GenericHybridParameters(AlgorithmIdentifier kem, AlgorithmIdentifier dem) { this.kem = kem; this.dem = dem; } public AlgorithmIdentifier getDem() { return dem; } public AlgorithmIdentifier getKem() { return kem; } public ASN1Primitive toASN1Primitive() { ASN1EncodableVector v = new ASN1EncodableVector(); v.add(kem); v.add(dem); return new DERSequence(v); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy