From 521454273ff2d91222cf4b8ac6ab5f16c54b40df Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Mon, 24 Jul 2023 12:57:09 +0700 Subject: Use Asn1Set FromVector utility methods --- crypto/src/cms/CMSAuthenticatedDataGenerator.cs | 2 +- crypto/src/cms/CMSEnvelopedDataGenerator.cs | 8 ++++---- crypto/src/cms/CMSEnvelopedDataStreamGenerator.cs | 2 +- crypto/src/cms/CMSSignedDataGenerator.cs | 4 ++-- crypto/src/cms/CMSSignedDataStreamGenerator.cs | 4 ++-- crypto/src/cms/CMSSignedGenerator.cs | 2 +- crypto/src/cms/CMSUtils.cs | 2 +- crypto/src/cms/SignerInformation.cs | 6 +++--- 8 files changed, 15 insertions(+), 15 deletions(-) (limited to 'crypto/src/cms') diff --git a/crypto/src/cms/CMSAuthenticatedDataGenerator.cs b/crypto/src/cms/CMSAuthenticatedDataGenerator.cs index 9f6815161..8e36d96a2 100644 --- a/crypto/src/cms/CMSAuthenticatedDataGenerator.cs +++ b/crypto/src/cms/CMSAuthenticatedDataGenerator.cs @@ -116,7 +116,7 @@ namespace Org.BouncyCastle.Cms var contentInfo = new ContentInfo( CmsObjectIdentifiers.AuthenticatedData, - new AuthenticatedData(null, new DerSet(recipientInfos), macAlgId, null, eci, null, macResult, null)); + new AuthenticatedData(null, DerSet.FromVector(recipientInfos), macAlgId, null, eci, null, macResult, null)); return new CmsAuthenticatedData(contentInfo); } diff --git a/crypto/src/cms/CMSEnvelopedDataGenerator.cs b/crypto/src/cms/CMSEnvelopedDataGenerator.cs index 62fff7412..902a97cc5 100644 --- a/crypto/src/cms/CMSEnvelopedDataGenerator.cs +++ b/crypto/src/cms/CMSEnvelopedDataGenerator.cs @@ -117,12 +117,12 @@ namespace Org.BouncyCastle.Cms Asn1.Cms.AttributeTable attrTable = unprotectedAttributeGenerator.GetAttributes( new Dictionary()); - unprotectedAttrSet = new BerSet(attrTable.ToAsn1EncodableVector()); + unprotectedAttrSet = BerSet.FromVector(attrTable.ToAsn1EncodableVector()); } ContentInfo contentInfo = new ContentInfo( CmsObjectIdentifiers.EnvelopedData, - new EnvelopedData(null, new DerSet(recipientInfos), eci, unprotectedAttrSet)); + new EnvelopedData(null, DerSet.FromVector(recipientInfos), eci, unprotectedAttrSet)); return new CmsEnvelopedData(contentInfo); } @@ -209,12 +209,12 @@ namespace Org.BouncyCastle.Cms Asn1.Cms.AttributeTable attrTable = unprotectedAttributeGenerator.GetAttributes( new Dictionary()); - unprotectedAttrSet = new BerSet(attrTable.ToAsn1EncodableVector()); + unprotectedAttrSet = BerSet.FromVector(attrTable.ToAsn1EncodableVector()); } ContentInfo contentInfo = new ContentInfo( CmsObjectIdentifiers.EnvelopedData, - new EnvelopedData(null, new DerSet(recipientInfos), eci, unprotectedAttrSet)); + new EnvelopedData(null, DerSet.FromVector(recipientInfos), eci, unprotectedAttrSet)); return new CmsEnvelopedData(contentInfo); } diff --git a/crypto/src/cms/CMSEnvelopedDataStreamGenerator.cs b/crypto/src/cms/CMSEnvelopedDataStreamGenerator.cs index 48fe2eccc..05ae0d3c1 100644 --- a/crypto/src/cms/CMSEnvelopedDataStreamGenerator.cs +++ b/crypto/src/cms/CMSEnvelopedDataStreamGenerator.cs @@ -270,7 +270,7 @@ namespace Org.BouncyCastle.Cms Asn1.Cms.AttributeTable attrTable = _outer.unprotectedAttributeGenerator.GetAttributes( new Dictionary()); - Asn1Set unprotectedAttrs = new BerSet(attrTable.ToAsn1EncodableVector()); + Asn1Set unprotectedAttrs = BerSet.FromVector(attrTable.ToAsn1EncodableVector()); _envGen.AddObject(new DerTaggedObject(false, 1, unprotectedAttrs)); } diff --git a/crypto/src/cms/CMSSignedDataGenerator.cs b/crypto/src/cms/CMSSignedDataGenerator.cs index fff22e057..646ed2c35 100644 --- a/crypto/src/cms/CMSSignedDataGenerator.cs +++ b/crypto/src/cms/CMSSignedDataGenerator.cs @@ -536,11 +536,11 @@ namespace Org.BouncyCastle.Cms ContentInfo encInfo = new ContentInfo(contentTypeOid, octs); SignedData sd = new SignedData( - new DerSet(digestAlgs), + DerSet.FromVector(digestAlgs), encInfo, certificates, certrevlist, - new DerSet(signerInfos)); + DerSet.FromVector(signerInfos)); ContentInfo contentInfo = new ContentInfo(CmsObjectIdentifiers.SignedData, sd); diff --git a/crypto/src/cms/CMSSignedDataStreamGenerator.cs b/crypto/src/cms/CMSSignedDataStreamGenerator.cs index 4883fc3f9..ad82540eb 100644 --- a/crypto/src/cms/CMSSignedDataStreamGenerator.cs +++ b/crypto/src/cms/CMSSignedDataStreamGenerator.cs @@ -563,7 +563,7 @@ namespace Org.BouncyCastle.Cms digestAlgs.Add(new AlgorithmIdentifier(new DerObjectIdentifier(digestOid), DerNull.Instance)); } - new DerSet(digestAlgs).EncodeTo(sigGen.GetRawOutputStream()); + DerSet.FromVector(digestAlgs).EncodeTo(sigGen.GetRawOutputStream()); BerSequenceGenerator eiGen = new BerSequenceGenerator(sigGen.GetRawOutputStream()); eiGen.AddObject(contentTypeOid); @@ -903,7 +903,7 @@ namespace Org.BouncyCastle.Cms } } - WriteToGenerator(_sigGen, new DerSet(signerInfos)); + WriteToGenerator(_sigGen, DerSet.FromVector(signerInfos)); _sigGen.Dispose(); _sGen.Dispose(); diff --git a/crypto/src/cms/CMSSignedGenerator.cs b/crypto/src/cms/CMSSignedGenerator.cs index 61a4e9ad6..799501789 100644 --- a/crypto/src/cms/CMSSignedGenerator.cs +++ b/crypto/src/cms/CMSSignedGenerator.cs @@ -590,7 +590,7 @@ namespace Org.BouncyCastle.Cms { return attr == null ? null - : new DerSet(attr.ToAsn1EncodableVector()); + : DerSet.FromVector(attr.ToAsn1EncodableVector()); } public void AddAttributeCertificate(X509V2AttributeCertificate attrCert) diff --git a/crypto/src/cms/CMSUtils.cs b/crypto/src/cms/CMSUtils.cs index d84c0afd7..1e3a5734f 100644 --- a/crypto/src/cms/CMSUtils.cs +++ b/crypto/src/cms/CMSUtils.cs @@ -202,7 +202,7 @@ namespace Org.BouncyCastle.Cms v.Add(seq.ToAsn1Object()); } - return new Asn1.Cms.AttributeTable(new DerSet(v)); + return new Asn1.Cms.AttributeTable(DerSet.FromVector(v)); } internal static void ValidateOtherRevocationInfo(OtherRevocationInfoFormat otherRevocationInfo) diff --git a/crypto/src/cms/SignerInformation.cs b/crypto/src/cms/SignerInformation.cs index 116e349f0..24ba20037 100644 --- a/crypto/src/cms/SignerInformation.cs +++ b/crypto/src/cms/SignerInformation.cs @@ -744,7 +744,7 @@ namespace Org.BouncyCastle.Cms if (unsignedAttributes != null) { - unsignedAttr = new DerSet(unsignedAttributes.ToAsn1EncodableVector()); + unsignedAttr = DerSet.FromVector(unsignedAttributes.ToAsn1EncodableVector()); } return new SignerInformation( @@ -794,7 +794,7 @@ namespace Org.BouncyCastle.Cms sigs.Add(sigInf.ToSignerInfo()); } - v.Add(new Asn1.Cms.Attribute(CmsAttributes.CounterSignature, new DerSet(sigs))); + v.Add(new Asn1.Cms.Attribute(CmsAttributes.CounterSignature, DerSet.FromVector(sigs))); return new SignerInformation( new SignerInfo( @@ -803,7 +803,7 @@ namespace Org.BouncyCastle.Cms sInfo.AuthenticatedAttributes, sInfo.DigestEncryptionAlgorithm, sInfo.EncryptedDigest, - new DerSet(v)), + DerSet.FromVector(v)), signerInformation.contentType, signerInformation.content, null); -- cgit 1.4.1