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 FIPS 140-3 Bouncy Castle Crypto package is a Java implementation of cryptographic algorithms certified to FIPS 140-3 level 1. This jar contains JCE provider and low-level API for the BC-FJA version 2.0.0, FIPS Certificate #4743. Please see certificate for certified platform details.

There is a newer version: 2.0.0
Show 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