diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2024-05-10 19:04:32 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2024-05-10 19:04:32 +0700 |
commit | b48d562bf5c90759559aab53f1a19a4285313a2f (patch) | |
tree | 582e7f025d688019371d168c2a287714d46ec2ad | |
parent | Improve Asn1OctetString.Asn1Equals (diff) | |
download | BouncyCastle.NET-ed25519-b48d562bf5c90759559aab53f1a19a4285313a2f.tar.xz |
Obsolete several constructors to make private later
-rw-r--r-- | crypto/src/asn1/cms/Attribute.cs | 9 | ||||
-rw-r--r-- | crypto/src/asn1/cms/CompressedData.cs | 9 | ||||
-rw-r--r-- | crypto/src/asn1/cms/EncryptedContentInfo.cs | 9 | ||||
-rw-r--r-- | crypto/src/asn1/cms/KEKIdentifier.cs | 7 | ||||
-rw-r--r-- | crypto/src/asn1/cms/KEKRecipientInfo.cs | 9 | ||||
-rw-r--r-- | crypto/src/asn1/cms/KeyAgreeRecipientInfo.cs | 9 | ||||
-rw-r--r-- | crypto/src/asn1/cms/KeyTransRecipientInfo.cs | 7 | ||||
-rw-r--r-- | crypto/src/asn1/cms/OriginatorInfo.cs | 7 | ||||
-rw-r--r-- | crypto/src/asn1/cms/OtherKeyAttribute.cs | 9 | ||||
-rw-r--r-- | crypto/src/asn1/cms/PasswordRecipientInfo.cs | 9 | ||||
-rw-r--r-- | crypto/src/asn1/cms/RecipientKeyIdentifier.cs | 7 |
11 files changed, 80 insertions, 11 deletions
diff --git a/crypto/src/asn1/cms/Attribute.cs b/crypto/src/asn1/cms/Attribute.cs index d42aefccb..9e2ced198 100644 --- a/crypto/src/asn1/cms/Attribute.cs +++ b/crypto/src/asn1/cms/Attribute.cs @@ -1,3 +1,5 @@ +using System; + namespace Org.BouncyCastle.Asn1.Cms { public class Attribute @@ -9,18 +11,23 @@ namespace Org.BouncyCastle.Asn1.Cms return null; if (obj is Attribute attribute) return attribute; +#pragma warning disable CS0618 // Type or member is obsolete return new Attribute(Asn1Sequence.GetInstance(obj)); +#pragma warning restore CS0618 // Type or member is obsolete } public static Attribute GetInstance(Asn1TaggedObject taggedObject, bool declaredExplicit) { +#pragma warning disable CS0618 // Type or member is obsolete return new Attribute(Asn1Sequence.GetInstance(taggedObject, declaredExplicit)); +#pragma warning restore CS0618 // Type or member is obsolete } private DerObjectIdentifier attrType; private Asn1Set attrValues; - public Attribute( + [Obsolete("Use 'GetInstance' instead")] + public Attribute( Asn1Sequence seq) { attrType = (DerObjectIdentifier)seq[0]; diff --git a/crypto/src/asn1/cms/CompressedData.cs b/crypto/src/asn1/cms/CompressedData.cs index e6ca41687..4b326247e 100644 --- a/crypto/src/asn1/cms/CompressedData.cs +++ b/crypto/src/asn1/cms/CompressedData.cs @@ -1,3 +1,5 @@ +using System; + using Org.BouncyCastle.Asn1.X509; namespace Org.BouncyCastle.Asn1.Cms @@ -21,12 +23,16 @@ namespace Org.BouncyCastle.Asn1.Cms return null; if (obj is CompressedData compressedData) return compressedData; +#pragma warning disable CS0618 // Type or member is obsolete return new CompressedData(Asn1Sequence.GetInstance(obj)); +#pragma warning restore CS0618 // Type or member is obsolete } public static CompressedData GetInstance(Asn1TaggedObject ato, bool explicitly) { +#pragma warning disable CS0618 // Type or member is obsolete return new CompressedData(Asn1Sequence.GetInstance(ato, explicitly)); +#pragma warning restore CS0618 // Type or member is obsolete } private DerInteger version; @@ -42,7 +48,8 @@ namespace Org.BouncyCastle.Asn1.Cms this.encapContentInfo = encapContentInfo; } - public CompressedData( + [Obsolete("Use 'GetInstance' instead")] + public CompressedData( Asn1Sequence seq) { this.version = (DerInteger) seq[0]; diff --git a/crypto/src/asn1/cms/EncryptedContentInfo.cs b/crypto/src/asn1/cms/EncryptedContentInfo.cs index 2d4a744a3..af697af5d 100644 --- a/crypto/src/asn1/cms/EncryptedContentInfo.cs +++ b/crypto/src/asn1/cms/EncryptedContentInfo.cs @@ -1,3 +1,5 @@ +using System; + using Org.BouncyCastle.Asn1.X509; namespace Org.BouncyCastle.Asn1.Cms @@ -11,12 +13,16 @@ namespace Org.BouncyCastle.Asn1.Cms return null; if (obj is EncryptedContentInfo encryptedContentInfo) return encryptedContentInfo; +#pragma warning disable CS0618 // Type or member is obsolete return new EncryptedContentInfo(Asn1Sequence.GetInstance(obj)); +#pragma warning restore CS0618 // Type or member is obsolete } public static EncryptedContentInfo GetInstance(Asn1TaggedObject taggedObject, bool declaredExplicit) { +#pragma warning disable CS0618 // Type or member is obsolete return new EncryptedContentInfo(Asn1Sequence.GetInstance(taggedObject, declaredExplicit)); +#pragma warning restore CS0618 // Type or member is obsolete } private DerObjectIdentifier contentType; @@ -33,7 +39,8 @@ namespace Org.BouncyCastle.Asn1.Cms this.encryptedContent = encryptedContent; } - public EncryptedContentInfo( + [Obsolete("Use 'GetInstance' instead")] + public EncryptedContentInfo( Asn1Sequence seq) { contentType = (DerObjectIdentifier) seq[0]; diff --git a/crypto/src/asn1/cms/KEKIdentifier.cs b/crypto/src/asn1/cms/KEKIdentifier.cs index 09676fd0e..433157ef3 100644 --- a/crypto/src/asn1/cms/KEKIdentifier.cs +++ b/crypto/src/asn1/cms/KEKIdentifier.cs @@ -11,12 +11,16 @@ namespace Org.BouncyCastle.Asn1.Cms return null; if (obj is KekIdentifier kekIdentifier) return kekIdentifier; +#pragma warning disable CS0618 // Type or member is obsolete return new KekIdentifier(Asn1Sequence.GetInstance(obj)); +#pragma warning restore CS0618 // Type or member is obsolete } public static KekIdentifier GetInstance(Asn1TaggedObject obj, bool explicitly) { +#pragma warning disable CS0618 // Type or member is obsolete return new KekIdentifier(Asn1Sequence.GetInstance(obj, explicitly)); +#pragma warning restore CS0618 // Type or member is obsolete } private Asn1OctetString keyIdentifier; @@ -33,7 +37,8 @@ namespace Org.BouncyCastle.Asn1.Cms this.other = other; } - public KekIdentifier(Asn1Sequence seq) + [Obsolete("Use 'GetInstance' instead")] + public KekIdentifier(Asn1Sequence seq) { keyIdentifier = (Asn1OctetString)seq[0]; diff --git a/crypto/src/asn1/cms/KEKRecipientInfo.cs b/crypto/src/asn1/cms/KEKRecipientInfo.cs index 6ab5f264f..76ce9c643 100644 --- a/crypto/src/asn1/cms/KEKRecipientInfo.cs +++ b/crypto/src/asn1/cms/KEKRecipientInfo.cs @@ -1,3 +1,5 @@ +using System; + using Org.BouncyCastle.Asn1.X509; namespace Org.BouncyCastle.Asn1.Cms @@ -11,12 +13,16 @@ namespace Org.BouncyCastle.Asn1.Cms return null; if (obj is KekRecipientInfo kekRecipientInfo) return kekRecipientInfo; +#pragma warning disable CS0618 // Type or member is obsolete return new KekRecipientInfo(Asn1Sequence.GetInstance(obj)); +#pragma warning restore CS0618 // Type or member is obsolete } public static KekRecipientInfo GetInstance(Asn1TaggedObject obj, bool explicitly) { +#pragma warning disable CS0618 // Type or member is obsolete return new KekRecipientInfo(Asn1Sequence.GetInstance(obj, explicitly)); +#pragma warning restore CS0618 // Type or member is obsolete } private DerInteger version; @@ -35,7 +41,8 @@ namespace Org.BouncyCastle.Asn1.Cms this.encryptedKey = encryptedKey; } - public KekRecipientInfo( + [Obsolete("Use 'GetInstance' instead")] + public KekRecipientInfo( Asn1Sequence seq) { version = (DerInteger) seq[0]; diff --git a/crypto/src/asn1/cms/KeyAgreeRecipientInfo.cs b/crypto/src/asn1/cms/KeyAgreeRecipientInfo.cs index 77f3f3748..63eebcea3 100644 --- a/crypto/src/asn1/cms/KeyAgreeRecipientInfo.cs +++ b/crypto/src/asn1/cms/KeyAgreeRecipientInfo.cs @@ -1,3 +1,5 @@ +using System; + using Org.BouncyCastle.Asn1.X509; namespace Org.BouncyCastle.Asn1.Cms @@ -11,12 +13,16 @@ namespace Org.BouncyCastle.Asn1.Cms return null; if (obj is KeyAgreeRecipientInfo keyAgreeRecipientInfo) return keyAgreeRecipientInfo; +#pragma warning disable CS0618 // Type or member is obsolete return new KeyAgreeRecipientInfo(Asn1Sequence.GetInstance(obj)); +#pragma warning restore CS0618 // Type or member is obsolete } public static KeyAgreeRecipientInfo GetInstance(Asn1TaggedObject obj, bool explicitly) { +#pragma warning disable CS0618 // Type or member is obsolete return new KeyAgreeRecipientInfo(Asn1Sequence.GetInstance(obj, explicitly)); +#pragma warning restore CS0618 // Type or member is obsolete } private DerInteger version; @@ -38,7 +44,8 @@ namespace Org.BouncyCastle.Asn1.Cms this.recipientEncryptedKeys = recipientEncryptedKeys; } - public KeyAgreeRecipientInfo(Asn1Sequence seq) + [Obsolete("Use 'GetInstance' instead")] + public KeyAgreeRecipientInfo(Asn1Sequence seq) { int index = 0; diff --git a/crypto/src/asn1/cms/KeyTransRecipientInfo.cs b/crypto/src/asn1/cms/KeyTransRecipientInfo.cs index c33ab8b73..6981e87f9 100644 --- a/crypto/src/asn1/cms/KeyTransRecipientInfo.cs +++ b/crypto/src/asn1/cms/KeyTransRecipientInfo.cs @@ -14,12 +14,16 @@ namespace Org.BouncyCastle.Asn1.Cms return null; if (obj is KeyTransRecipientInfo keyTransRecipientInfo) return keyTransRecipientInfo; +#pragma warning disable CS0618 // Type or member is obsolete return new KeyTransRecipientInfo(Asn1Sequence.GetInstance(obj)); +#pragma warning restore CS0618 // Type or member is obsolete } public static KeyTransRecipientInfo GetInstance(Asn1TaggedObject taggedObject, bool declaredExplicit) { +#pragma warning disable CS0618 // Type or member is obsolete return new KeyTransRecipientInfo(Asn1Sequence.GetInstance(taggedObject, declaredExplicit)); +#pragma warning restore CS0618 // Type or member is obsolete } private DerInteger version; @@ -46,7 +50,8 @@ namespace Org.BouncyCastle.Asn1.Cms this.encryptedKey = encryptedKey; } - public KeyTransRecipientInfo( + [Obsolete("Use 'GetInstance' instead")] + public KeyTransRecipientInfo( Asn1Sequence seq) { this.version = (DerInteger) seq[0]; diff --git a/crypto/src/asn1/cms/OriginatorInfo.cs b/crypto/src/asn1/cms/OriginatorInfo.cs index e98fd0640..48b771bcb 100644 --- a/crypto/src/asn1/cms/OriginatorInfo.cs +++ b/crypto/src/asn1/cms/OriginatorInfo.cs @@ -13,12 +13,16 @@ namespace Org.BouncyCastle.Asn1.Cms return null; if (obj is OriginatorInfo originatorInfo) return originatorInfo; +#pragma warning disable CS0618 // Type or member is obsolete return new OriginatorInfo(Asn1Sequence.GetInstance(obj)); +#pragma warning restore CS0618 // Type or member is obsolete } public static OriginatorInfo GetInstance(Asn1TaggedObject obj, bool explicitly) { +#pragma warning disable CS0618 // Type or member is obsolete return new OriginatorInfo(Asn1Sequence.GetInstance(obj, explicitly)); +#pragma warning restore CS0618 // Type or member is obsolete } private Asn1Set certs; @@ -32,7 +36,8 @@ namespace Org.BouncyCastle.Asn1.Cms this.crls = crls; } - public OriginatorInfo( + [Obsolete("Use 'GetInstance' instead")] + public OriginatorInfo( Asn1Sequence seq) { switch (seq.Count) diff --git a/crypto/src/asn1/cms/OtherKeyAttribute.cs b/crypto/src/asn1/cms/OtherKeyAttribute.cs index 7c85de86e..52f013950 100644 --- a/crypto/src/asn1/cms/OtherKeyAttribute.cs +++ b/crypto/src/asn1/cms/OtherKeyAttribute.cs @@ -1,3 +1,5 @@ +using System; + namespace Org.BouncyCastle.Asn1.Cms { public class OtherKeyAttribute @@ -9,18 +11,23 @@ namespace Org.BouncyCastle.Asn1.Cms return null; if (obj is OtherKeyAttribute otherKeyAttribute) return otherKeyAttribute; +#pragma warning disable CS0618 // Type or member is obsolete return new OtherKeyAttribute(Asn1Sequence.GetInstance(obj)); +#pragma warning restore CS0618 // Type or member is obsolete } public static OtherKeyAttribute GetInstance(Asn1TaggedObject taggedObject, bool declaredExplicit) { +#pragma warning disable CS0618 // Type or member is obsolete return new OtherKeyAttribute(Asn1Sequence.GetInstance(taggedObject, declaredExplicit)); +#pragma warning restore CS0618 // Type or member is obsolete } private DerObjectIdentifier keyAttrId; private Asn1Encodable keyAttr; - public OtherKeyAttribute( + [Obsolete("Use 'GetInstance' instead")] + public OtherKeyAttribute( Asn1Sequence seq) { keyAttrId = (DerObjectIdentifier) seq[0]; diff --git a/crypto/src/asn1/cms/PasswordRecipientInfo.cs b/crypto/src/asn1/cms/PasswordRecipientInfo.cs index c25d61a46..67ff01cf8 100644 --- a/crypto/src/asn1/cms/PasswordRecipientInfo.cs +++ b/crypto/src/asn1/cms/PasswordRecipientInfo.cs @@ -1,3 +1,5 @@ +using System; + using Org.BouncyCastle.Asn1.X509; namespace Org.BouncyCastle.Asn1.Cms @@ -11,12 +13,16 @@ namespace Org.BouncyCastle.Asn1.Cms return null; if (obj is PasswordRecipientInfo passwordRecipientInfo) return passwordRecipientInfo; +#pragma warning disable CS0618 // Type or member is obsolete return new PasswordRecipientInfo(Asn1Sequence.GetInstance(obj)); +#pragma warning restore CS0618 // Type or member is obsolete } public static PasswordRecipientInfo GetInstance(Asn1TaggedObject obj, bool explicitly) { +#pragma warning disable CS0618 // Type or member is obsolete return new PasswordRecipientInfo(Asn1Sequence.GetInstance(obj, explicitly)); +#pragma warning restore CS0618 // Type or member is obsolete } private readonly DerInteger version; @@ -44,7 +50,8 @@ namespace Org.BouncyCastle.Asn1.Cms this.encryptedKey = encryptedKey; } - public PasswordRecipientInfo(Asn1Sequence seq) + [Obsolete("Use 'GetInstance' instead")] + public PasswordRecipientInfo(Asn1Sequence seq) { version = (DerInteger)seq[0]; diff --git a/crypto/src/asn1/cms/RecipientKeyIdentifier.cs b/crypto/src/asn1/cms/RecipientKeyIdentifier.cs index 9a340b24f..daae426d2 100644 --- a/crypto/src/asn1/cms/RecipientKeyIdentifier.cs +++ b/crypto/src/asn1/cms/RecipientKeyIdentifier.cs @@ -13,12 +13,16 @@ namespace Org.BouncyCastle.Asn1.Cms return null; if (obj is RecipientKeyIdentifier recipientKeyIdentifier) return recipientKeyIdentifier; +#pragma warning disable CS0618 // Type or member is obsolete return new RecipientKeyIdentifier(Asn1Sequence.GetInstance(obj)); +#pragma warning restore CS0618 // Type or member is obsolete } public static RecipientKeyIdentifier GetInstance(Asn1TaggedObject ato, bool explicitly) { +#pragma warning disable CS0618 // Type or member is obsolete return new RecipientKeyIdentifier(Asn1Sequence.GetInstance(ato, explicitly)); +#pragma warning restore CS0618 // Type or member is obsolete } private Asn1OctetString subjectKeyIdentifier; @@ -51,7 +55,8 @@ namespace Org.BouncyCastle.Asn1.Cms this.other = other; } - public RecipientKeyIdentifier(Asn1Sequence seq) + [Obsolete("Use 'GetInstance' instead")] + public RecipientKeyIdentifier(Asn1Sequence seq) { subjectKeyIdentifier = Asn1OctetString.GetInstance(seq[0]); |