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

org.bouncycastle.asn1.cryptopro.GostR3410KeyTransport Maven / Gradle / Ivy

Go to download

The Bouncy Castle Java APIs for CMS, PKCS, EAC, TSP, CMP, CRMF, OCSP, and certificate generation. This jar contains APIs for JDK 1.5 and up. The APIs can be used in conjunction with a JCE/JCA provider such as the one provided with the Bouncy Castle Cryptography APIs.

There is a newer version: 1.2.2.1-jre17
Show newest version
package org.bouncycastle.asn1.cryptopro;

import org.bouncycastle.asn1.ASN1EncodableVector;
import org.bouncycastle.asn1.ASN1Object;
import org.bouncycastle.asn1.ASN1Primitive;
import org.bouncycastle.asn1.ASN1Sequence;
import org.bouncycastle.asn1.ASN1TaggedObject;
import org.bouncycastle.asn1.DERSequence;
import org.bouncycastle.asn1.DERTaggedObject;

/**
 * 
 *     GostR3410-KeyTransport ::= SEQUENCE {
 *       sessionEncryptedKey   Gost28147-89-EncryptedKey,
 *       transportParameters
 *          [0] IMPLICIT GostR3410-TransportParameters OPTIONAL
 *    }
 * 
*/ public class GostR3410KeyTransport extends ASN1Object { private final Gost2814789EncryptedKey sessionEncryptedKey; private final GostR3410TransportParameters transportParameters; private GostR3410KeyTransport(ASN1Sequence seq) { this.sessionEncryptedKey = Gost2814789EncryptedKey.getInstance(seq.getObjectAt(0)); this.transportParameters = GostR3410TransportParameters.getInstance(ASN1TaggedObject.getInstance(seq.getObjectAt(1)), false); } public GostR3410KeyTransport(Gost2814789EncryptedKey sessionEncryptedKey, GostR3410TransportParameters transportParameters) { this.sessionEncryptedKey = sessionEncryptedKey; this.transportParameters = transportParameters; } public static GostR3410KeyTransport getInstance( Object obj) { if (obj instanceof GostR3410KeyTransport) { return (GostR3410KeyTransport)obj; } if (obj != null) { return new GostR3410KeyTransport(ASN1Sequence.getInstance(obj)); } return null; } public Gost2814789EncryptedKey getSessionEncryptedKey() { return sessionEncryptedKey; } public GostR3410TransportParameters getTransportParameters() { return transportParameters; } public ASN1Primitive toASN1Primitive() { ASN1EncodableVector v = new ASN1EncodableVector(2); v.add(sessionEncryptedKey); if (transportParameters != null) { v.add(new DERTaggedObject(false, 0, transportParameters)); } return new DERSequence(v); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy