From 6a939bee94f82fb515144304e81ddbb44c36eda4 Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Sat, 21 Nov 2015 23:40:59 +0700 Subject: Add Platform method for getting the type name of an object --- crypto/src/asn1/crmf/AttributeTypeAndValue.cs | 4 +++- crypto/src/asn1/crmf/CertId.cs | 3 ++- crypto/src/asn1/crmf/CertReqMessages.cs | 4 +++- crypto/src/asn1/crmf/Controls.cs | 4 +++- crypto/src/asn1/crmf/PKIArchiveOptions.cs | 4 +++- crypto/src/asn1/crmf/PKIPublicationInfo.cs | 4 +++- crypto/src/asn1/crmf/PKMacValue.cs | 3 ++- crypto/src/asn1/crmf/PopoSigningKey.cs | 3 ++- crypto/src/asn1/crmf/PopoSigningKeyInput.cs | 3 ++- crypto/src/asn1/crmf/ProofOfPossession.cs | 4 +++- crypto/src/asn1/crmf/SinglePubInfo.cs | 3 ++- 11 files changed, 28 insertions(+), 11 deletions(-) (limited to 'crypto/src/asn1/crmf') diff --git a/crypto/src/asn1/crmf/AttributeTypeAndValue.cs b/crypto/src/asn1/crmf/AttributeTypeAndValue.cs index 823668992..0a4b5bdbe 100644 --- a/crypto/src/asn1/crmf/AttributeTypeAndValue.cs +++ b/crypto/src/asn1/crmf/AttributeTypeAndValue.cs @@ -1,5 +1,7 @@ using System; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1.Crmf { public class AttributeTypeAndValue @@ -22,7 +24,7 @@ namespace Org.BouncyCastle.Asn1.Crmf if (obj is Asn1Sequence) return new AttributeTypeAndValue((Asn1Sequence)obj); - throw new ArgumentException("Invalid object: " + obj.GetType().Name, "obj"); + throw new ArgumentException("Invalid object: " + Platform.GetTypeName(obj), "obj"); } public AttributeTypeAndValue( diff --git a/crypto/src/asn1/crmf/CertId.cs b/crypto/src/asn1/crmf/CertId.cs index 10c2cc8b4..f0cc94691 100644 --- a/crypto/src/asn1/crmf/CertId.cs +++ b/crypto/src/asn1/crmf/CertId.cs @@ -1,6 +1,7 @@ using System; using Org.BouncyCastle.Asn1.X509; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Crmf { @@ -24,7 +25,7 @@ namespace Org.BouncyCastle.Asn1.Crmf if (obj is Asn1Sequence) return new CertId((Asn1Sequence)obj); - throw new ArgumentException("Invalid object: " + obj.GetType().Name, "obj"); + throw new ArgumentException("Invalid object: " + Platform.GetTypeName(obj), "obj"); } public static CertId GetInstance(Asn1TaggedObject obj, bool isExplicit) diff --git a/crypto/src/asn1/crmf/CertReqMessages.cs b/crypto/src/asn1/crmf/CertReqMessages.cs index 9247281e8..422950b9e 100644 --- a/crypto/src/asn1/crmf/CertReqMessages.cs +++ b/crypto/src/asn1/crmf/CertReqMessages.cs @@ -1,5 +1,7 @@ using System; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1.Crmf { public class CertReqMessages @@ -20,7 +22,7 @@ namespace Org.BouncyCastle.Asn1.Crmf if (obj is Asn1Sequence) return new CertReqMessages((Asn1Sequence)obj); - throw new ArgumentException("Invalid object: " + obj.GetType().Name, "obj"); + throw new ArgumentException("Invalid object: " + Platform.GetTypeName(obj), "obj"); } public CertReqMessages(params CertReqMsg[] msgs) diff --git a/crypto/src/asn1/crmf/Controls.cs b/crypto/src/asn1/crmf/Controls.cs index cc52ea4bb..e8b9f3db0 100644 --- a/crypto/src/asn1/crmf/Controls.cs +++ b/crypto/src/asn1/crmf/Controls.cs @@ -1,5 +1,7 @@ using System; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1.Crmf { public class Controls @@ -20,7 +22,7 @@ namespace Org.BouncyCastle.Asn1.Crmf if (obj is Asn1Sequence) return new Controls((Asn1Sequence)obj); - throw new ArgumentException("Invalid object: " + obj.GetType().Name, "obj"); + throw new ArgumentException("Invalid object: " + Platform.GetTypeName(obj), "obj"); } public Controls(params AttributeTypeAndValue[] atvs) diff --git a/crypto/src/asn1/crmf/PKIArchiveOptions.cs b/crypto/src/asn1/crmf/PKIArchiveOptions.cs index 910f73b22..1813d87a7 100644 --- a/crypto/src/asn1/crmf/PKIArchiveOptions.cs +++ b/crypto/src/asn1/crmf/PKIArchiveOptions.cs @@ -1,5 +1,7 @@ using System; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1.Crmf { public class PkiArchiveOptions @@ -19,7 +21,7 @@ namespace Org.BouncyCastle.Asn1.Crmf if (obj is Asn1TaggedObject) return new PkiArchiveOptions((Asn1TaggedObject)obj); - throw new ArgumentException("Invalid object: " + obj.GetType().Name, "obj"); + throw new ArgumentException("Invalid object: " + Platform.GetTypeName(obj), "obj"); } private PkiArchiveOptions(Asn1TaggedObject tagged) diff --git a/crypto/src/asn1/crmf/PKIPublicationInfo.cs b/crypto/src/asn1/crmf/PKIPublicationInfo.cs index c8bc1403e..a7d2bc603 100644 --- a/crypto/src/asn1/crmf/PKIPublicationInfo.cs +++ b/crypto/src/asn1/crmf/PKIPublicationInfo.cs @@ -1,5 +1,7 @@ using System; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1.Crmf { public class PkiPublicationInfo @@ -22,7 +24,7 @@ namespace Org.BouncyCastle.Asn1.Crmf if (obj is Asn1Sequence) return new PkiPublicationInfo((Asn1Sequence)obj); - throw new ArgumentException("Invalid object: " + obj.GetType().Name, "obj"); + throw new ArgumentException("Invalid object: " + Platform.GetTypeName(obj), "obj"); } public virtual DerInteger Action diff --git a/crypto/src/asn1/crmf/PKMacValue.cs b/crypto/src/asn1/crmf/PKMacValue.cs index 20a08fd1d..e104c08dd 100644 --- a/crypto/src/asn1/crmf/PKMacValue.cs +++ b/crypto/src/asn1/crmf/PKMacValue.cs @@ -2,6 +2,7 @@ using Org.BouncyCastle.Asn1.Cmp; using Org.BouncyCastle.Asn1.X509; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Crmf { @@ -28,7 +29,7 @@ namespace Org.BouncyCastle.Asn1.Crmf if (obj is Asn1Sequence) return new PKMacValue((Asn1Sequence)obj); - throw new ArgumentException("Invalid object: " + obj.GetType().Name, "obj"); + throw new ArgumentException("Invalid object: " + Platform.GetTypeName(obj), "obj"); } public static PKMacValue GetInstance(Asn1TaggedObject obj, bool isExplicit) diff --git a/crypto/src/asn1/crmf/PopoSigningKey.cs b/crypto/src/asn1/crmf/PopoSigningKey.cs index 614278eda..1c24db8ee 100644 --- a/crypto/src/asn1/crmf/PopoSigningKey.cs +++ b/crypto/src/asn1/crmf/PopoSigningKey.cs @@ -1,6 +1,7 @@ using System; using Org.BouncyCastle.Asn1.X509; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Crmf { @@ -37,7 +38,7 @@ namespace Org.BouncyCastle.Asn1.Crmf if (obj is Asn1Sequence) return new PopoSigningKey((Asn1Sequence)obj); - throw new ArgumentException("Invalid object: " + obj.GetType().Name, "obj"); + throw new ArgumentException("Invalid object: " + Platform.GetTypeName(obj), "obj"); } public static PopoSigningKey GetInstance(Asn1TaggedObject obj, bool isExplicit) diff --git a/crypto/src/asn1/crmf/PopoSigningKeyInput.cs b/crypto/src/asn1/crmf/PopoSigningKeyInput.cs index 63695262f..e43fa138e 100644 --- a/crypto/src/asn1/crmf/PopoSigningKeyInput.cs +++ b/crypto/src/asn1/crmf/PopoSigningKeyInput.cs @@ -1,6 +1,7 @@ using System; using Org.BouncyCastle.Asn1.X509; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Crmf { @@ -40,7 +41,7 @@ namespace Org.BouncyCastle.Asn1.Crmf if (obj is Asn1Sequence) return new PopoSigningKeyInput((Asn1Sequence)obj); - throw new ArgumentException("Invalid object: " + obj.GetType().Name, "obj"); + throw new ArgumentException("Invalid object: " + Platform.GetTypeName(obj), "obj"); } /** Creates a new PopoSigningKeyInput with sender name as authInfo. */ diff --git a/crypto/src/asn1/crmf/ProofOfPossession.cs b/crypto/src/asn1/crmf/ProofOfPossession.cs index fc00edb32..8957169d7 100644 --- a/crypto/src/asn1/crmf/ProofOfPossession.cs +++ b/crypto/src/asn1/crmf/ProofOfPossession.cs @@ -1,5 +1,7 @@ using System; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1.Crmf { public class ProofOfPossession @@ -41,7 +43,7 @@ namespace Org.BouncyCastle.Asn1.Crmf if (obj is Asn1TaggedObject) return new ProofOfPossession((Asn1TaggedObject)obj); - throw new ArgumentException("Invalid object: " + obj.GetType().Name, "obj"); + throw new ArgumentException("Invalid object: " + Platform.GetTypeName(obj), "obj"); } /** Creates a ProofOfPossession with type raVerified. */ diff --git a/crypto/src/asn1/crmf/SinglePubInfo.cs b/crypto/src/asn1/crmf/SinglePubInfo.cs index eaf8a3efd..5205ce366 100644 --- a/crypto/src/asn1/crmf/SinglePubInfo.cs +++ b/crypto/src/asn1/crmf/SinglePubInfo.cs @@ -1,6 +1,7 @@ using System; using Org.BouncyCastle.Asn1.X509; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Crmf { @@ -28,7 +29,7 @@ namespace Org.BouncyCastle.Asn1.Crmf if (obj is Asn1Sequence) return new SinglePubInfo((Asn1Sequence)obj); - throw new ArgumentException("Invalid object: " + obj.GetType().Name, "obj"); + throw new ArgumentException("Invalid object: " + Platform.GetTypeName(obj), "obj"); } public virtual GeneralName PubLocation -- cgit 1.5.1