diff --git a/crypto/src/asn1/BERSetParser.cs b/crypto/src/asn1/BERSetParser.cs
index 9da964c61..292ae60b1 100644
--- a/crypto/src/asn1/BERSetParser.cs
+++ b/crypto/src/asn1/BERSetParser.cs
@@ -24,7 +24,7 @@ namespace Org.BouncyCastle.Asn1
internal static BerSet Parse(Asn1StreamParser sp)
{
- return new BerSet(sp.ReadVector());
+ return BerSet.FromVector(sp.ReadVector());
}
}
}
diff --git a/crypto/src/asn1/cms/Attributes.cs b/crypto/src/asn1/cms/Attributes.cs
index 6e3691870..41018453d 100644
--- a/crypto/src/asn1/cms/Attributes.cs
+++ b/crypto/src/asn1/cms/Attributes.cs
@@ -26,7 +26,7 @@ namespace Org.BouncyCastle.Asn1.Cms
public Attributes(Asn1EncodableVector v)
{
- m_attributes = new BerSet(v);
+ m_attributes = BerSet.FromVector(v);
}
public virtual Attribute[] GetAttributes() => m_attributes.MapElements(Attribute.GetInstance);
diff --git a/crypto/src/asn1/x509/X509Name.cs b/crypto/src/asn1/x509/X509Name.cs
index d0e304798..3aa2f4e53 100644
--- a/crypto/src/asn1/x509/X509Name.cs
+++ b/crypto/src/asn1/x509/X509Name.cs
@@ -704,7 +704,7 @@ namespace Org.BouncyCastle.Asn1.X509
}
else
{
- vec.Add(new DerSet(sVec));
+ vec.Add(DerSet.FromVector(sVec));
sVec = new Asn1EncodableVector();
}
@@ -716,7 +716,7 @@ namespace Org.BouncyCastle.Asn1.X509
lstOid = oid;
}
- vec.Add(new DerSet(sVec));
+ vec.Add(DerSet.FromVector(sVec));
seq = new DerSequence(vec);
}
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<CmsAttributeTableParameter, object>());
- 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<CmsAttributeTableParameter, object>());
- 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<CmsAttributeTableParameter, object>());
- 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);
diff --git a/crypto/src/pkcs/Pkcs12Store.cs b/crypto/src/pkcs/Pkcs12Store.cs
index 26b94deb9..27cef8090 100644
--- a/crypto/src/pkcs/Pkcs12Store.cs
+++ b/crypto/src/pkcs/Pkcs12Store.cs
@@ -738,7 +738,7 @@ namespace Org.BouncyCastle.Pkcs
new DerSet(subjectKeyID)));
}
- keyBags.Add(new SafeBag(bagOid, bagData.ToAsn1Object(), new DerSet(kName)));
+ keyBags.Add(new SafeBag(bagOid, bagData.ToAsn1Object(), DerSet.FromVector(kName)));
}
byte[] keyBagsEncoding = new DerSequence(keyBags).GetDerEncoded();
@@ -803,7 +803,7 @@ namespace Org.BouncyCastle.Pkcs
new DerSet(subjectKeyID)));
}
- certBags.Add(new SafeBag(PkcsObjectIdentifiers.CertBag, cBag.ToAsn1Object(), new DerSet(fName)));
+ certBags.Add(new SafeBag(PkcsObjectIdentifiers.CertBag, cBag.ToAsn1Object(), DerSet.FromVector(fName)));
doneCerts.Add(certEntry.Certificate);
}
@@ -873,7 +873,7 @@ namespace Org.BouncyCastle.Pkcs
fName.Add(
new DerSequence(
MiscObjectIdentifiers.id_oracle_pkcs12_trusted_key_usage,
- new DerSet(v)));
+ DerSet.FromVector(v)));
}
else
{
@@ -884,7 +884,7 @@ namespace Org.BouncyCastle.Pkcs
}
}
- certBags.Add(new SafeBag(PkcsObjectIdentifiers.CertBag, cBag.ToAsn1Object(), new DerSet(fName)));
+ certBags.Add(new SafeBag(PkcsObjectIdentifiers.CertBag, cBag.ToAsn1Object(), DerSet.FromVector(fName)));
doneCerts.Add(cert.Certificate);
}
@@ -920,7 +920,7 @@ namespace Org.BouncyCastle.Pkcs
fName.Add(new DerSequence(oid, new DerSet(cert[oid])));
}
- certBags.Add(new SafeBag(PkcsObjectIdentifiers.CertBag, cBag.ToAsn1Object(), new DerSet(fName)));
+ certBags.Add(new SafeBag(PkcsObjectIdentifiers.CertBag, cBag.ToAsn1Object(), DerSet.FromVector(fName)));
}
byte[] certBagsEncoding = new DerSequence(certBags).GetDerEncoded();
diff --git a/crypto/src/pkix/PkixCertPath.cs b/crypto/src/pkix/PkixCertPath.cs
index 950b999b2..4aec08f09 100644
--- a/crypto/src/pkix/PkixCertPath.cs
+++ b/crypto/src/pkix/PkixCertPath.cs
@@ -338,7 +338,7 @@ namespace Org.BouncyCastle.Pkix
new DerInteger(1),
new DerSet(),
encInfo,
- new DerSet(v),
+ DerSet.FromVector(v),
null,
new DerSet());
diff --git a/crypto/src/x509/X509Attribute.cs b/crypto/src/x509/X509Attribute.cs
index 248d66cc4..dbb61d9cc 100644
--- a/crypto/src/x509/X509Attribute.cs
+++ b/crypto/src/x509/X509Attribute.cs
@@ -47,7 +47,7 @@ namespace Org.BouncyCastle.X509
string oid,
Asn1EncodableVector value)
{
- this.attr = new AttributeX509(new DerObjectIdentifier(oid), new DerSet(value));
+ this.attr = new AttributeX509(new DerObjectIdentifier(oid), DerSet.FromVector(value));
}
public string Oid
diff --git a/crypto/test/src/asn1/test/SetTest.cs b/crypto/test/src/asn1/test/SetTest.cs
index 09421225e..dabe00ae1 100644
--- a/crypto/test/src/asn1/test/SetTest.cs
+++ b/crypto/test/src/asn1/test/SetTest.cs
@@ -41,7 +41,7 @@ namespace Org.BouncyCastle.Asn1.Tests
v.Add(new DerInteger(100));
v.Add(DerBoolean.True);
- checkSortedSet(0, new DerSet(v));
+ checkSortedSet(0, DerSet.FromVector(v));
v = new Asn1EncodableVector();
v.Add(new DerInteger(100));
@@ -49,7 +49,7 @@ namespace Org.BouncyCastle.Asn1.Tests
v.Add(new DerOctetString(data));
v.Add(new DerBitString(data));
- checkSortedSet(1, new DerSet(v));
+ checkSortedSet(1, DerSet.FromVector(v));
v = new Asn1EncodableVector();
v.Add(DerBoolean.True);
@@ -58,7 +58,7 @@ namespace Org.BouncyCastle.Asn1.Tests
v.Add(new DerInteger(100));
- checkSortedSet(2, new DerSet(v));
+ checkSortedSet(2, DerSet.FromVector(v));
v = new Asn1EncodableVector();
v.Add(new DerBitString(data));
@@ -66,7 +66,7 @@ namespace Org.BouncyCastle.Asn1.Tests
v.Add(new DerInteger(100));
v.Add(DerBoolean.True);
- checkSortedSet(3, new DerSet(v));
+ checkSortedSet(3, DerSet.FromVector(v));
v = new Asn1EncodableVector();
v.Add(new DerOctetString(data));
@@ -74,7 +74,7 @@ namespace Org.BouncyCastle.Asn1.Tests
v.Add(new DerInteger(100));
v.Add(DerBoolean.True);
- Asn1Set s = new BerSet(v);
+ Asn1Set s = BerSet.FromVector(v);
if (!(s[0] is DerOctetString))
{
@@ -101,7 +101,7 @@ namespace Org.BouncyCastle.Asn1.Tests
v.Add(DerBoolean.True);
v.Add(DerBoolean.True);
- s = new DerSet(v);
+ s = DerSet.FromVector(v);
}
[Test]
diff --git a/crypto/test/src/asn1/test/X509NameTest.cs b/crypto/test/src/asn1/test/X509NameTest.cs
index 098500a0b..9eab25952 100644
--- a/crypto/test/src/asn1/test/X509NameTest.cs
+++ b/crypto/test/src/asn1/test/X509NameTest.cs
@@ -389,7 +389,7 @@ namespace Org.BouncyCastle.Asn1.Tests
new DerObjectIdentifier("1.1"),
new DerObjectIdentifier("1.1"));
- if (name1.Equals(new DerSequence(new DerSet(new DerSet(v)))))
+ if (name1.Equals(new DerSequence(new DerSet(DerSet.FromVector(v)))))
{
Fail("inequality test with sequence and bad set");
}
@@ -400,7 +400,7 @@ namespace Org.BouncyCastle.Asn1.Tests
// }
try
{
- X509Name.GetInstance(new DerSequence(new DerSet(new DerSet(v))));
+ X509Name.GetInstance(new DerSequence(new DerSet(DerSet.FromVector(v))));
Fail("GetInstance should reject bad sequence");
}
catch (ArgumentException)
|