added basic constructor.
added correct tagging to toASN1Primitive() method.
import org.bouncycastle.asn1.ASN1Sequence;
import org.bouncycastle.asn1.ASN1TaggedObject;
import org.bouncycastle.asn1.DERSequence;
+import org.bouncycastle.asn1.DERTaggedObject;
import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
/**
@@ -119,6 +120,25 @@ private EvidenceRecord(
this.archiveTimeStampSequence = replacementSequence;
}
+ /**
+ * Build a basic evidence record from an initial
+ * ArchiveTimeStamp.
+ *
+ * @param cryptoInfos
+ * @param encryptionInfo
+ * @param archiveTimeStamp
+ */
+ public EvidenceRecord(
+ CryptoInfos cryptoInfos,
+ EncryptionInfo encryptionInfo,
+ ArchiveTimeStamp archiveTimeStamp)
+ {
+ this.digestAlgorithms = new DERSequence(archiveTimeStamp.getDigestAlgorithmIdentifier());
+ this.cryptoInfos = cryptoInfos;
+ this.encryptionInfo = encryptionInfo;
+ this.archiveTimeStampSequence = new ArchiveTimeStampSequence(new ArchiveTimeStampChain(archiveTimeStamp));
+ }
+
public EvidenceRecord(
AlgorithmIdentifier[] digestAlgorithms,
CryptoInfos cryptoInfos,
@@ -232,11 +252,11 @@ public ASN1Primitive toASN1Primitive()
if (null != cryptoInfos)
{
- vector.add(cryptoInfos);
+ vector.add(new DERTaggedObject(false, 0, cryptoInfos));
}
if (null != encryptionInfo)
{
- vector.add(encryptionInfo);
+ vector.add(new DERTaggedObject(false, 1, encryptionInfo));
}
vector.add(archiveTimeStampSequence);
