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 Bouncy Castle Crypto package is a Java implementation of cryptographic algorithms. This jar contains JCE provider and lightweight API for the Bouncy Castle Cryptography APIs for JDK 1.5 to JDK 1.8. Note: this package includes the NTRU encryption algorithms.

There is a newer version: 1.70
Show newest version
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) { 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