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

org.bouncycastle.asn1.bc.ObjectStore 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.bc;

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

/**
 * 
 * ObjectStore ::= SEQUENCE {
 *     CHOICE {
 *          encryptedObjectStoreData EncryptedObjectStoreData,
 *          objectStoreData ObjectStoreData
 *     }
 *     integrityCheck ObjectStoreIntegrityCheck
 * }
 * 
*/ public class ObjectStore extends ASN1Object { private final ASN1Encodable storeData; private final ObjectStoreIntegrityCheck integrityCheck; public ObjectStore(ObjectStoreData objectStoreData, ObjectStoreIntegrityCheck integrityCheck) { this.storeData = objectStoreData; this.integrityCheck = integrityCheck; } public ObjectStore(EncryptedObjectStoreData encryptedObjectStoreData, ObjectStoreIntegrityCheck integrityCheck) { this.storeData = encryptedObjectStoreData; this.integrityCheck = integrityCheck; } private ObjectStore(ASN1Sequence seq) { if (seq.size() != 2) { throw new IllegalArgumentException("malformed sequence"); } ASN1Encodable sData = seq.getObjectAt(0); if (sData instanceof EncryptedObjectStoreData) { this.storeData = sData; } else if (sData instanceof ObjectStoreData) { this.storeData = sData; } else { ASN1Sequence seqData = ASN1Sequence.getInstance(sData); if (seqData.size() == 2) { this.storeData = EncryptedObjectStoreData.getInstance(seqData); } else { this.storeData = ObjectStoreData.getInstance(seqData); } } this.integrityCheck = ObjectStoreIntegrityCheck.getInstance(seq.getObjectAt(1)); } public static ObjectStore getInstance(Object o) { if (o instanceof ObjectStore) { return (ObjectStore)o; } else if (o != null) { return new ObjectStore(ASN1Sequence.getInstance(o)); } return null; } public ObjectStoreIntegrityCheck getIntegrityCheck() { return integrityCheck; } public ASN1Encodable getStoreData() { return storeData; } public ASN1Primitive toASN1Primitive() { ASN1EncodableVector v = new ASN1EncodableVector(); v.add(storeData); v.add(integrityCheck); return new DERSequence(v); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy