diff options
27 files changed, 132 insertions, 1 deletions
diff --git a/crypto/src/asn1/Asn1GeneralizedTime.cs b/crypto/src/asn1/Asn1GeneralizedTime.cs index 86f5f377f..9a6ed0a8a 100644 --- a/crypto/src/asn1/Asn1GeneralizedTime.cs +++ b/crypto/src/asn1/Asn1GeneralizedTime.cs @@ -73,6 +73,11 @@ namespace Org.BouncyCastle.Asn1 return null; } + public static Asn1GeneralizedTime GetTagged(Asn1TaggedObject taggedObject, bool declaredExplicit) + { + return (Asn1GeneralizedTime)Meta.Instance.GetTagged(taggedObject, declaredExplicit); + } + private readonly string m_timeString; private readonly bool m_timeStringCanonical; private readonly DateTime m_dateTime; diff --git a/crypto/src/asn1/Asn1Null.cs b/crypto/src/asn1/Asn1Null.cs index fa0adf71f..93a56ecc4 100644 --- a/crypto/src/asn1/Asn1Null.cs +++ b/crypto/src/asn1/Asn1Null.cs @@ -73,6 +73,11 @@ namespace Org.BouncyCastle.Asn1 return null; } + public static Asn1Null GetTagged(Asn1TaggedObject taggedObject, bool declaredExplicit) + { + return (Asn1Null)Meta.Instance.GetTagged(taggedObject, declaredExplicit); + } + internal Asn1Null() { } diff --git a/crypto/src/asn1/Asn1ObjectDescriptor.cs b/crypto/src/asn1/Asn1ObjectDescriptor.cs index 1f33eeac8..3f43a5070 100644 --- a/crypto/src/asn1/Asn1ObjectDescriptor.cs +++ b/crypto/src/asn1/Asn1ObjectDescriptor.cs @@ -92,6 +92,11 @@ namespace Org.BouncyCastle.Asn1 return null; } + public static Asn1ObjectDescriptor GetTagged(Asn1TaggedObject taggedObject, bool declaredExplicit) + { + return (Asn1ObjectDescriptor)Meta.Instance.GetTagged(taggedObject, declaredExplicit); + } + private readonly DerGraphicString m_baseGraphicString; public Asn1ObjectDescriptor(DerGraphicString baseGraphicString) diff --git a/crypto/src/asn1/Asn1OctetString.cs b/crypto/src/asn1/Asn1OctetString.cs index 4fb5f96de..e90fa1ef3 100644 --- a/crypto/src/asn1/Asn1OctetString.cs +++ b/crypto/src/asn1/Asn1OctetString.cs @@ -91,6 +91,11 @@ namespace Org.BouncyCastle.Asn1 return null; } + public static Asn1OctetString GetTagged(Asn1TaggedObject taggedObject, bool declaredExplicit) + { + return (Asn1OctetString)Meta.Instance.GetTagged(taggedObject, declaredExplicit); + } + internal readonly byte[] contents; /** diff --git a/crypto/src/asn1/Asn1RelativeOid.cs b/crypto/src/asn1/Asn1RelativeOid.cs index d1d9de882..af0cd99f2 100644 --- a/crypto/src/asn1/Asn1RelativeOid.cs +++ b/crypto/src/asn1/Asn1RelativeOid.cs @@ -91,6 +91,11 @@ namespace Org.BouncyCastle.Asn1 return null; } + public static Asn1RelativeOid GetTagged(Asn1TaggedObject taggedObject, bool declaredExplicit) + { + return (Asn1RelativeOid)Meta.Instance.GetTagged(taggedObject, declaredExplicit); + } + public static bool TryFromID(string identifier, out Asn1RelativeOid oid) { if (identifier == null) diff --git a/crypto/src/asn1/Asn1Sequence.cs b/crypto/src/asn1/Asn1Sequence.cs index 436cc60d4..9f95c780d 100644 --- a/crypto/src/asn1/Asn1Sequence.cs +++ b/crypto/src/asn1/Asn1Sequence.cs @@ -93,6 +93,11 @@ namespace Org.BouncyCastle.Asn1 return null; } + public static Asn1Sequence GetTagged(Asn1TaggedObject taggedObject, bool declaredExplicit) + { + return (Asn1Sequence)Meta.Instance.GetTagged(taggedObject, declaredExplicit); + } + internal static Asn1Encodable[] ConcatenateElements(Asn1Sequence[] sequences) { int count = sequences.Length; diff --git a/crypto/src/asn1/Asn1Set.cs b/crypto/src/asn1/Asn1Set.cs index de3d10380..3cb497457 100644 --- a/crypto/src/asn1/Asn1Set.cs +++ b/crypto/src/asn1/Asn1Set.cs @@ -93,6 +93,11 @@ namespace Org.BouncyCastle.Asn1 return null; } + public static Asn1Set GetTagged(Asn1TaggedObject taggedObject, bool declaredExplicit) + { + return (Asn1Set)Meta.Instance.GetTagged(taggedObject, declaredExplicit); + } + internal readonly Asn1Encodable[] m_elements; internal DerEncoding[] m_sortedDerEncodings; diff --git a/crypto/src/asn1/Asn1TaggedObject.cs b/crypto/src/asn1/Asn1TaggedObject.cs index f817a1343..510133a5b 100644 --- a/crypto/src/asn1/Asn1TaggedObject.cs +++ b/crypto/src/asn1/Asn1TaggedObject.cs @@ -90,6 +90,9 @@ namespace Org.BouncyCastle.Asn1 return null; } + public static Asn1TaggedObject GetTagged(Asn1TaggedObject taggedObject, bool declaredExplicit) => + CheckInstance(taggedObject, declaredExplicit).GetExplicitBaseTagged(); + private static Asn1TaggedObject CheckInstance(object obj) { return GetInstance(obj ?? throw new ArgumentNullException(nameof(obj))); diff --git a/crypto/src/asn1/Asn1UniversalType.cs b/crypto/src/asn1/Asn1UniversalType.cs index dedc29333..c46f6295c 100644 --- a/crypto/src/asn1/Asn1UniversalType.cs +++ b/crypto/src/asn1/Asn1UniversalType.cs @@ -43,6 +43,9 @@ namespace Org.BouncyCastle.Asn1 internal Asn1Object GetContextInstance(Asn1TaggedObject taggedObject, bool declaredExplicit) => CheckedCast(Asn1Utilities.CheckContextTagClass(taggedObject).GetBaseUniversal(declaredExplicit, this)); + internal Asn1Object GetTagged(Asn1TaggedObject taggedObject, bool declaredExplicit) => + CheckedCast(taggedObject.GetBaseUniversal(declaredExplicit, this)); + internal Asn1Tag Tag { get { return m_tag; } diff --git a/crypto/src/asn1/Asn1UtcTime.cs b/crypto/src/asn1/Asn1UtcTime.cs index 665147d51..ffcfec70a 100644 --- a/crypto/src/asn1/Asn1UtcTime.cs +++ b/crypto/src/asn1/Asn1UtcTime.cs @@ -79,6 +79,11 @@ namespace Org.BouncyCastle.Asn1 return null; } + public static Asn1UtcTime GetTagged(Asn1TaggedObject taggedObject, bool declaredExplicit) + { + return (Asn1UtcTime)Meta.Instance.GetTagged(taggedObject, declaredExplicit); + } + private readonly string m_timeString; private readonly DateTime m_dateTime; private readonly bool m_dateTimeLocked; diff --git a/crypto/src/asn1/DERExternal.cs b/crypto/src/asn1/DERExternal.cs index cc9b93490..5d4d9fd92 100644 --- a/crypto/src/asn1/DERExternal.cs +++ b/crypto/src/asn1/DERExternal.cs @@ -73,6 +73,11 @@ namespace Org.BouncyCastle.Asn1 return null; } + public static DerExternal GetTagged(Asn1TaggedObject taggedObject, bool declaredExplicit) + { + return (DerExternal)Meta.Instance.GetTagged(taggedObject, declaredExplicit); + } + internal readonly DerObjectIdentifier directReference; internal readonly DerInteger indirectReference; internal readonly Asn1ObjectDescriptor dataValueDescriptor; diff --git a/crypto/src/asn1/DerBMPString.cs b/crypto/src/asn1/DerBMPString.cs index 4a8ef8c84..37d34897a 100644 --- a/crypto/src/asn1/DerBMPString.cs +++ b/crypto/src/asn1/DerBMPString.cs @@ -89,6 +89,11 @@ namespace Org.BouncyCastle.Asn1 return null; } + public static DerBmpString GetTagged(Asn1TaggedObject taggedObject, bool declaredExplicit) + { + return (DerBmpString)Meta.Instance.GetTagged(taggedObject, declaredExplicit); + } + private readonly string m_str; internal DerBmpString(byte[] contents) diff --git a/crypto/src/asn1/DerBitString.cs b/crypto/src/asn1/DerBitString.cs index 8e3f99fd7..b83f4ebf0 100644 --- a/crypto/src/asn1/DerBitString.cs +++ b/crypto/src/asn1/DerBitString.cs @@ -81,6 +81,11 @@ namespace Org.BouncyCastle.Asn1 return null; } + public static DerBitString GetTagged(Asn1TaggedObject taggedObject, bool declaredExplicit) + { + return (DerBitString)Meta.Instance.GetTagged(taggedObject, declaredExplicit); + } + internal readonly byte[] contents; public DerBitString(byte data, int padBits) diff --git a/crypto/src/asn1/DerBoolean.cs b/crypto/src/asn1/DerBoolean.cs index 419253d2f..a75ada5d3 100644 --- a/crypto/src/asn1/DerBoolean.cs +++ b/crypto/src/asn1/DerBoolean.cs @@ -95,6 +95,11 @@ namespace Org.BouncyCastle.Asn1 return null; } + public static DerBoolean GetTagged(Asn1TaggedObject taggedObject, bool declaredExplicit) + { + return (DerBoolean)Meta.Instance.GetTagged(taggedObject, declaredExplicit); + } + private readonly byte value; public DerBoolean( diff --git a/crypto/src/asn1/DerEnumerated.cs b/crypto/src/asn1/DerEnumerated.cs index 9ec1d1919..5025336bf 100644 --- a/crypto/src/asn1/DerEnumerated.cs +++ b/crypto/src/asn1/DerEnumerated.cs @@ -83,6 +83,11 @@ namespace Org.BouncyCastle.Asn1 return null; } + public static DerEnumerated GetTagged(Asn1TaggedObject taggedObject, bool declaredExplicit) + { + return (DerEnumerated)Meta.Instance.GetTagged(taggedObject, declaredExplicit); + } + private readonly byte[] contents; private readonly int start; diff --git a/crypto/src/asn1/DerGeneralString.cs b/crypto/src/asn1/DerGeneralString.cs index f8291d4e4..a65eb669b 100644 --- a/crypto/src/asn1/DerGeneralString.cs +++ b/crypto/src/asn1/DerGeneralString.cs @@ -70,6 +70,11 @@ namespace Org.BouncyCastle.Asn1 return null; } + public static DerGeneralString GetTagged(Asn1TaggedObject taggedObject, bool declaredExplicit) + { + return (DerGeneralString)Meta.Instance.GetTagged(taggedObject, declaredExplicit); + } + private readonly byte[] m_contents; public DerGeneralString(string str) diff --git a/crypto/src/asn1/DerGraphicString.cs b/crypto/src/asn1/DerGraphicString.cs index 12d2f91a0..be3d70977 100644 --- a/crypto/src/asn1/DerGraphicString.cs +++ b/crypto/src/asn1/DerGraphicString.cs @@ -85,6 +85,11 @@ namespace Org.BouncyCastle.Asn1 return null; } + public static DerGraphicString GetTagged(Asn1TaggedObject taggedObject, bool declaredExplicit) + { + return (DerGraphicString)Meta.Instance.GetTagged(taggedObject, declaredExplicit); + } + private readonly byte[] m_contents; public DerGraphicString(byte[] contents) diff --git a/crypto/src/asn1/DerIA5String.cs b/crypto/src/asn1/DerIA5String.cs index 8c523ce4c..a03ded9c6 100644 --- a/crypto/src/asn1/DerIA5String.cs +++ b/crypto/src/asn1/DerIA5String.cs @@ -85,6 +85,11 @@ namespace Org.BouncyCastle.Asn1 return null; } + public static DerIA5String GetTagged(Asn1TaggedObject taggedObject, bool declaredExplicit) + { + return (DerIA5String)Meta.Instance.GetTagged(taggedObject, declaredExplicit); + } + private readonly byte[] m_contents; public DerIA5String(string str) diff --git a/crypto/src/asn1/DerInteger.cs b/crypto/src/asn1/DerInteger.cs index 666723527..c46aa99df 100644 --- a/crypto/src/asn1/DerInteger.cs +++ b/crypto/src/asn1/DerInteger.cs @@ -104,7 +104,12 @@ namespace Org.BouncyCastle.Asn1 return null; } - public DerInteger(int value) + public static DerInteger GetTagged(Asn1TaggedObject taggedObject, bool declaredExplicit) + { + return (DerInteger)Meta.Instance.GetTagged(taggedObject, declaredExplicit); + } + + public DerInteger(int value) { this.bytes = BigInteger.ValueOf(value).ToByteArray(); this.start = 0; diff --git a/crypto/src/asn1/DerNumericString.cs b/crypto/src/asn1/DerNumericString.cs index 81871f3c9..5c30217d2 100644 --- a/crypto/src/asn1/DerNumericString.cs +++ b/crypto/src/asn1/DerNumericString.cs @@ -85,6 +85,11 @@ namespace Org.BouncyCastle.Asn1 return null; } + public static DerNumericString GetTagged(Asn1TaggedObject taggedObject, bool declaredExplicit) + { + return (DerNumericString)Meta.Instance.GetTagged(taggedObject, declaredExplicit); + } + private readonly byte[] m_contents; public DerNumericString(string str) diff --git a/crypto/src/asn1/DerObjectIdentifier.cs b/crypto/src/asn1/DerObjectIdentifier.cs index ed79ec1d0..b9d52a576 100644 --- a/crypto/src/asn1/DerObjectIdentifier.cs +++ b/crypto/src/asn1/DerObjectIdentifier.cs @@ -108,6 +108,11 @@ namespace Org.BouncyCastle.Asn1 return null; } + public static DerObjectIdentifier GetTagged(Asn1TaggedObject taggedObject, bool declaredExplicit) + { + return (DerObjectIdentifier)Meta.Instance.GetTagged(taggedObject, declaredExplicit); + } + public static bool TryFromID(string identifier, out DerObjectIdentifier oid) { if (identifier == null) diff --git a/crypto/src/asn1/DerPrintableString.cs b/crypto/src/asn1/DerPrintableString.cs index 910fcafe1..fcbe9dc84 100644 --- a/crypto/src/asn1/DerPrintableString.cs +++ b/crypto/src/asn1/DerPrintableString.cs @@ -85,6 +85,11 @@ namespace Org.BouncyCastle.Asn1 return null; } + public static DerPrintableString GetTagged(Asn1TaggedObject taggedObject, bool declaredExplicit) + { + return (DerPrintableString)Meta.Instance.GetTagged(taggedObject, declaredExplicit); + } + private readonly byte[] m_contents; public DerPrintableString(string str) diff --git a/crypto/src/asn1/DerT61String.cs b/crypto/src/asn1/DerT61String.cs index 8d58747e5..653702b55 100644 --- a/crypto/src/asn1/DerT61String.cs +++ b/crypto/src/asn1/DerT61String.cs @@ -85,6 +85,11 @@ namespace Org.BouncyCastle.Asn1 return null; } + public static DerT61String GetTagged(Asn1TaggedObject taggedObject, bool declaredExplicit) + { + return (DerT61String)Meta.Instance.GetTagged(taggedObject, declaredExplicit); + } + private readonly byte[] m_contents; public DerT61String(string str) diff --git a/crypto/src/asn1/DerUTF8String.cs b/crypto/src/asn1/DerUTF8String.cs index 05b061fca..61a76e9b0 100644 --- a/crypto/src/asn1/DerUTF8String.cs +++ b/crypto/src/asn1/DerUTF8String.cs @@ -85,6 +85,11 @@ namespace Org.BouncyCastle.Asn1 return null; } + public static DerUtf8String GetTagged(Asn1TaggedObject taggedObject, bool declaredExplicit) + { + return (DerUtf8String)Meta.Instance.GetTagged(taggedObject, declaredExplicit); + } + private readonly byte[] m_contents; public DerUtf8String(string str) diff --git a/crypto/src/asn1/DerUniversalString.cs b/crypto/src/asn1/DerUniversalString.cs index c05a87a69..47e7cc9a6 100644 --- a/crypto/src/asn1/DerUniversalString.cs +++ b/crypto/src/asn1/DerUniversalString.cs @@ -89,6 +89,11 @@ namespace Org.BouncyCastle.Asn1 return null; } + public static DerUniversalString GetTagged(Asn1TaggedObject taggedObject, bool declaredExplicit) + { + return (DerUniversalString)Meta.Instance.GetTagged(taggedObject, declaredExplicit); + } + private readonly byte[] m_contents; public DerUniversalString(byte[] contents) diff --git a/crypto/src/asn1/DerVideotexString.cs b/crypto/src/asn1/DerVideotexString.cs index 086fdbe94..5ace0cb17 100644 --- a/crypto/src/asn1/DerVideotexString.cs +++ b/crypto/src/asn1/DerVideotexString.cs @@ -85,6 +85,11 @@ namespace Org.BouncyCastle.Asn1 return null; } + public static DerVideotexString GetTagged(Asn1TaggedObject taggedObject, bool declaredExplicit) + { + return (DerVideotexString)Meta.Instance.GetTagged(taggedObject, declaredExplicit); + } + private readonly byte[] m_contents; public DerVideotexString(byte[] contents) diff --git a/crypto/src/asn1/DerVisibleString.cs b/crypto/src/asn1/DerVisibleString.cs index 9eec322e0..c0e296cef 100644 --- a/crypto/src/asn1/DerVisibleString.cs +++ b/crypto/src/asn1/DerVisibleString.cs @@ -85,6 +85,11 @@ namespace Org.BouncyCastle.Asn1 return null; } + public static DerVisibleString GetTagged(Asn1TaggedObject taggedObject, bool declaredExplicit) + { + return (DerVisibleString)Meta.Instance.GetTagged(taggedObject, declaredExplicit); + } + private readonly byte[] m_contents; public DerVisibleString(string str) |