diff options
author | David Hook <dgh@cryptoworkshop.com> | 2021-10-04 19:50:31 +1100 |
---|---|---|
committer | David Hook <dgh@cryptoworkshop.com> | 2021-10-04 19:50:31 +1100 |
commit | 64f8abc147a03de15ff1cbcdea4bfc428f79913f (patch) | |
tree | 677bc0155aa935cfd204b929865d589aed7c3ee6 /crypto/src/cms | |
parent | partial #68 (diff) | |
download | BouncyCastle.NET-ed25519-64f8abc147a03de15ff1cbcdea4bfc428f79913f.tar.xz |
format changes only - relates to github #68
Diffstat (limited to 'crypto/src/cms')
-rw-r--r-- | crypto/src/cms/CMSEnvelopedDataStreamGenerator.cs | 2 | ||||
-rw-r--r-- | crypto/src/cms/CMSSignedDataStreamGenerator.cs | 74 |
2 files changed, 38 insertions, 38 deletions
diff --git a/crypto/src/cms/CMSEnvelopedDataStreamGenerator.cs b/crypto/src/cms/CMSEnvelopedDataStreamGenerator.cs index 8e6d2729b..e0822aa8b 100644 --- a/crypto/src/cms/CMSEnvelopedDataStreamGenerator.cs +++ b/crypto/src/cms/CMSEnvelopedDataStreamGenerator.cs @@ -287,7 +287,7 @@ namespace Org.BouncyCastle.Cms // TODO Parent context(s) should really be closed explicitly - _eiGen.Close(); + _eiGen.Close(); if (_outer.unprotectedAttributeGenerator != null) { diff --git a/crypto/src/cms/CMSSignedDataStreamGenerator.cs b/crypto/src/cms/CMSSignedDataStreamGenerator.cs index f6bdacb06..e32f95d42 100644 --- a/crypto/src/cms/CMSSignedDataStreamGenerator.cs +++ b/crypto/src/cms/CMSSignedDataStreamGenerator.cs @@ -834,7 +834,7 @@ namespace Org.BouncyCastle.Cms _eiGen.Close(); - outer._digests.Clear(); // clear the current preserved digest state + outer._digests.Clear(); // clear the current preserved digest state if (outer._certs.Count > 0) { @@ -842,8 +842,8 @@ namespace Org.BouncyCastle.Cms ? CmsUtilities.CreateDerSetFromList(outer._certs) : CmsUtilities.CreateBerSetFromList(outer._certs); - WriteToGenerator(_sigGen, new BerTaggedObject(false, 0, certs)); - } + WriteToGenerator(_sigGen, new BerTaggedObject(false, 0, certs)); + } if (outer._crls.Count > 0) { @@ -851,48 +851,48 @@ namespace Org.BouncyCastle.Cms ? CmsUtilities.CreateDerSetFromList(outer._crls) : CmsUtilities.CreateBerSetFromList(outer._crls); - WriteToGenerator(_sigGen, new BerTaggedObject(false, 1, crls)); - } + WriteToGenerator(_sigGen, new BerTaggedObject(false, 1, crls)); + } - // - // Calculate the digest hashes - // - foreach (DictionaryEntry de in outer._messageDigests) - { - outer._messageHashes.Add(de.Key, DigestUtilities.DoFinal((IDigest)de.Value)); - } + // + // Calculate the digest hashes + // + foreach (DictionaryEntry de in outer._messageDigests) + { + outer._messageHashes.Add(de.Key, DigestUtilities.DoFinal((IDigest)de.Value)); + } - // TODO If the digest OIDs for precalculated signers weren't mixed in with - // the others, we could fill in outer._digests here, instead of SignerInfoGenerator.Generate + // TODO If the digest OIDs for precalculated signers weren't mixed in with + // the others, we could fill in outer._digests here, instead of SignerInfoGenerator.Generate - // - // collect all the SignerInfo objects - // + // + // collect all the SignerInfo objects + // Asn1EncodableVector signerInfos = new Asn1EncodableVector(); - // + // // add the generated SignerInfo objects // - { - foreach (DigestAndSignerInfoGeneratorHolder holder in outer._signerInfs) - { - AlgorithmIdentifier digestAlgorithm = holder.DigestAlgorithm; + { + foreach (DigestAndSignerInfoGeneratorHolder holder in outer._signerInfs) + { + AlgorithmIdentifier digestAlgorithm = holder.DigestAlgorithm; - byte[] calculatedDigest = (byte[])outer._messageHashes[ - Helper.GetDigestAlgName(holder.digestOID)]; - outer._digests[holder.digestOID] = calculatedDigest.Clone(); + byte[] calculatedDigest = (byte[])outer._messageHashes[ + Helper.GetDigestAlgName(holder.digestOID)]; + outer._digests[holder.digestOID] = calculatedDigest.Clone(); - signerInfos.Add(holder.signerInf.Generate(_contentOID, digestAlgorithm, calculatedDigest)); - } - } + signerInfos.Add(holder.signerInf.Generate(_contentOID, digestAlgorithm, calculatedDigest)); + } + } - // + // // add the precalculated SignerInfo objects. // - { - foreach (SignerInformation signer in outer._signers) - { - // TODO Verify the content type and calculated digest match the precalculated SignerInfo + { + foreach (SignerInformation signer in outer._signers) + { + // TODO Verify the content type and calculated digest match the precalculated SignerInfo // if (!signer.ContentType.Equals(_contentOID)) // { // // TODO The precalculated content type did not match - error? @@ -911,11 +911,11 @@ namespace Org.BouncyCastle.Cms // } // } - signerInfos.Add(signer.ToSignerInfo()); - } - } + signerInfos.Add(signer.ToSignerInfo()); + } + } - WriteToGenerator(_sigGen, new DerSet(signerInfos)); + WriteToGenerator(_sigGen, new DerSet(signerInfos)); _sigGen.Close(); _sGen.Close(); |