From 36057f66032c5e2942a8c3797be39f20693318f3 Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Mon, 9 Nov 2015 12:10:58 +0700 Subject: Add DOTNET and LIB preprocessor flags as per BouncyCastle-PCL --- crypto/src/openpgp/PgpLiteralDataGenerator.cs | 4 ++-- crypto/src/openpgp/PgpUtilities.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'crypto/src/openpgp') diff --git a/crypto/src/openpgp/PgpLiteralDataGenerator.cs b/crypto/src/openpgp/PgpLiteralDataGenerator.cs index 17a6eeef2..7672659ca 100644 --- a/crypto/src/openpgp/PgpLiteralDataGenerator.cs +++ b/crypto/src/openpgp/PgpLiteralDataGenerator.cs @@ -141,8 +141,8 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp return new WrappedGeneratorStream(this, pkOut); } -#if !PORTABLE - /// +#if !PORTABLE || DOTNET + /// ///

/// Open a literal data packet for the passed in FileInfo object, returning /// an output stream for saving the file contents. diff --git a/crypto/src/openpgp/PgpUtilities.cs b/crypto/src/openpgp/PgpUtilities.cs index 9238edcfc..055f99636 100644 --- a/crypto/src/openpgp/PgpUtilities.cs +++ b/crypto/src/openpgp/PgpUtilities.cs @@ -347,7 +347,7 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp return MakeKey(algorithm, keyBytes); } -#if !PORTABLE +#if !PORTABLE || DOTNET ///

Write out the passed in file as a literal data packet. public static void WriteFileToLiteralData( Stream output, -- cgit 1.5.1 From 809e86bbf8ed478e7aa7b9de8a3bfc3014289bd5 Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Thu, 12 Nov 2015 22:57:06 +0700 Subject: Review of culture-independent String comparison methods --- crypto/src/asn1/DerGeneralizedTime.cs | 6 +- crypto/src/asn1/DerObjectIdentifier.cs | 2 +- crypto/src/asn1/anssi/ANSSINamedCurves.cs | 4 +- crypto/src/asn1/sec/SECNamedCurves.cs | 4 +- crypto/src/asn1/teletrust/TeleTrusTNamedCurves.cs | 4 +- crypto/src/asn1/x509/GeneralName.cs | 5 +- crypto/src/asn1/x509/X509Name.cs | 16 ++--- crypto/src/asn1/x9/X962NamedCurves.cs | 4 +- crypto/src/cms/KEKRecipientInfoGenerator.cs | 11 +-- crypto/src/cms/PasswordRecipientInfoGenerator.cs | 3 +- crypto/src/crypto/ec/CustomNamedCurves.cs | 10 +-- crypto/src/openpgp/PgpPublicKeyRingBundle.cs | 6 +- crypto/src/openpgp/PgpSecretKey.cs | 2 +- crypto/src/openpgp/PgpSecretKeyRingBundle.cs | 6 +- crypto/src/openssl/MiscPemGenerator.cs | 2 +- crypto/src/openssl/PEMReader.cs | 4 +- crypto/src/pkcs/Pkcs10CertificationRequest.cs | 2 +- crypto/src/pkcs/Pkcs12Store.cs | 16 ++--- crypto/src/pkix/PkixCertPath.cs | 6 +- crypto/src/pkix/PkixCertPathValidatorUtilities.cs | 2 +- crypto/src/pkix/PkixNameConstraintValidator.cs | 87 ++++++++++++----------- crypto/src/security/CipherUtilities.cs | 6 +- crypto/src/security/GeneratorUtilities.cs | 2 +- crypto/src/security/MacUtilities.cs | 6 +- crypto/src/security/PbeUtilities.cs | 32 ++++----- crypto/src/security/SecureRandom.cs | 2 +- crypto/src/security/SignerUtilities.cs | 6 +- crypto/src/util/Platform.cs | 34 ++++++--- crypto/src/util/io/pem/PemReader.cs | 10 +-- crypto/src/util/net/IPAddress.cs | 4 +- crypto/src/x509/PEMParser.cs | 5 +- crypto/src/x509/X509SignatureUtil.cs | 2 +- 32 files changed, 165 insertions(+), 146 deletions(-) (limited to 'crypto/src/openpgp') diff --git a/crypto/src/asn1/DerGeneralizedTime.cs b/crypto/src/asn1/DerGeneralizedTime.cs index 17c42e7cf..79b008768 100644 --- a/crypto/src/asn1/DerGeneralizedTime.cs +++ b/crypto/src/asn1/DerGeneralizedTime.cs @@ -204,7 +204,7 @@ namespace Org.BouncyCastle.Asn1 string d = time; bool makeUniversal = false; - if (d.EndsWith("Z")) + if (Platform.EndsWith(d, "Z")) { if (HasFractionalSeconds) { @@ -223,7 +223,7 @@ namespace Org.BouncyCastle.Asn1 if (HasFractionalSeconds) { - int fCount = d.IndexOf("GMT") - 1 - d.IndexOf('.'); + int fCount = Platform.IndexOf(d, "GMT") - 1 - d.IndexOf('.'); formatStr = @"yyyyMMddHHmmss." + FString(fCount) + @"'GMT'zzz"; } else @@ -267,7 +267,7 @@ namespace Org.BouncyCastle.Asn1 * NOTE: DateTime.Kind and DateTimeStyles.AssumeUniversal not available in .NET 1.1 */ DateTimeStyles style = DateTimeStyles.None; - if (format.EndsWith("Z")) + if (Platform.EndsWith(format, "Z")) { try { diff --git a/crypto/src/asn1/DerObjectIdentifier.cs b/crypto/src/asn1/DerObjectIdentifier.cs index f9f6a79d6..563c637e5 100644 --- a/crypto/src/asn1/DerObjectIdentifier.cs +++ b/crypto/src/asn1/DerObjectIdentifier.cs @@ -83,7 +83,7 @@ namespace Org.BouncyCastle.Asn1 public virtual bool On(DerObjectIdentifier stem) { string id = Id, stemId = stem.Id; - return id.Length > stemId.Length && id[stemId.Length] == '.' && id.StartsWith(stemId); + return id.Length > stemId.Length && id[stemId.Length] == '.' && Platform.StartsWith(id, stemId); } internal DerObjectIdentifier(byte[] bytes) diff --git a/crypto/src/asn1/anssi/ANSSINamedCurves.cs b/crypto/src/asn1/anssi/ANSSINamedCurves.cs index c7f9545f2..d0c90ebf1 100644 --- a/crypto/src/asn1/anssi/ANSSINamedCurves.cs +++ b/crypto/src/asn1/anssi/ANSSINamedCurves.cs @@ -60,7 +60,7 @@ namespace Org.BouncyCastle.Asn1.Anssi DerObjectIdentifier oid, X9ECParametersHolder holder) { - objIds.Add(Platform.ToLowerInvariant(name), oid); + objIds.Add(Platform.ToUpperInvariant(name), oid); names.Add(oid, name); curves.Add(oid, holder); } @@ -99,7 +99,7 @@ namespace Org.BouncyCastle.Asn1.Anssi public static DerObjectIdentifier GetOid( string name) { - return (DerObjectIdentifier)objIds[Platform.ToLowerInvariant(name)]; + return (DerObjectIdentifier)objIds[Platform.ToUpperInvariant(name)]; } /** diff --git a/crypto/src/asn1/sec/SECNamedCurves.cs b/crypto/src/asn1/sec/SECNamedCurves.cs index ca71a4e66..b753ac5d1 100644 --- a/crypto/src/asn1/sec/SECNamedCurves.cs +++ b/crypto/src/asn1/sec/SECNamedCurves.cs @@ -1088,7 +1088,7 @@ namespace Org.BouncyCastle.Asn1.Sec DerObjectIdentifier oid, X9ECParametersHolder holder) { - objIds.Add(Platform.ToLowerInvariant(name), oid); + objIds.Add(Platform.ToUpperInvariant(name), oid); names.Add(oid, name); curves.Add(oid, holder); } @@ -1160,7 +1160,7 @@ namespace Org.BouncyCastle.Asn1.Sec public static DerObjectIdentifier GetOid( string name) { - return (DerObjectIdentifier)objIds[Platform.ToLowerInvariant(name)]; + return (DerObjectIdentifier)objIds[Platform.ToUpperInvariant(name)]; } /** diff --git a/crypto/src/asn1/teletrust/TeleTrusTNamedCurves.cs b/crypto/src/asn1/teletrust/TeleTrusTNamedCurves.cs index ba3eda620..9a82db319 100644 --- a/crypto/src/asn1/teletrust/TeleTrusTNamedCurves.cs +++ b/crypto/src/asn1/teletrust/TeleTrusTNamedCurves.cs @@ -387,7 +387,7 @@ namespace Org.BouncyCastle.Asn1.TeleTrust DerObjectIdentifier oid, X9ECParametersHolder holder) { - objIds.Add(Platform.ToLowerInvariant(name), oid); + objIds.Add(Platform.ToUpperInvariant(name), oid); names.Add(oid, name); curves.Add(oid, holder); } @@ -439,7 +439,7 @@ namespace Org.BouncyCastle.Asn1.TeleTrust public static DerObjectIdentifier GetOid( string name) { - return (DerObjectIdentifier)objIds[Platform.ToLowerInvariant(name)]; + return (DerObjectIdentifier)objIds[Platform.ToUpperInvariant(name)]; } /** diff --git a/crypto/src/asn1/x509/GeneralName.cs b/crypto/src/asn1/x509/GeneralName.cs index 710ddc922..16096623c 100644 --- a/crypto/src/asn1/x509/GeneralName.cs +++ b/crypto/src/asn1/x509/GeneralName.cs @@ -4,6 +4,7 @@ using System.Globalization; using System.IO; using System.Text; +using Org.BouncyCastle.Utilities; using NetUtils = Org.BouncyCastle.Utilities.Net; namespace Org.BouncyCastle.Asn1.X509 @@ -356,11 +357,11 @@ namespace Org.BouncyCastle.Asn1.X509 private int[] parseIPv6(string ip) { - if (ip.StartsWith("::")) + if (Platform.StartsWith(ip, "::")) { ip = ip.Substring(1); } - else if (ip.EndsWith("::")) + else if (Platform.EndsWith(ip, "::")) { ip = ip.Substring(0, ip.Length - 1); } diff --git a/crypto/src/asn1/x509/X509Name.cs b/crypto/src/asn1/x509/X509Name.cs index fb404a3ec..01a7ec04a 100644 --- a/crypto/src/asn1/x509/X509Name.cs +++ b/crypto/src/asn1/x509/X509Name.cs @@ -399,7 +399,7 @@ namespace Org.BouncyCastle.Asn1.X509 if (derValue is IAsn1String && !(derValue is DerUniversalString)) { string v = ((IAsn1String)derValue).GetString(); - if (v.StartsWith("#")) + if (Platform.StartsWith(v, "#")) { v = "\\" + v; } @@ -499,12 +499,6 @@ namespace Org.BouncyCastle.Asn1.X509 } } -// private static bool IsEncoded( -// string s) -// { -// return s.StartsWith("#"); -// } - /** * Takes an X509 dir name as a string of the format "C=AU, ST=Victoria", or * some such, converting it into an ordered set of name attributes. @@ -581,7 +575,7 @@ namespace Org.BouncyCastle.Asn1.X509 string name, IDictionary lookUp) { - if (Platform.ToUpperInvariant(name).StartsWith("OID.")) + if (Platform.StartsWith(Platform.ToUpperInvariant(name), "OID.")) { return new DerObjectIdentifier(name.Substring(4)); } @@ -724,7 +718,7 @@ namespace Org.BouncyCastle.Asn1.X509 { string val = (string)values[i]; - if (val.StartsWith("\\#")) + if (Platform.StartsWith(val, "\\#")) { val = val.Substring(1); } @@ -911,7 +905,7 @@ namespace Org.BouncyCastle.Asn1.X509 { string v = Platform.ToLowerInvariant(s).Trim(); - if (v.StartsWith("#")) + if (Platform.StartsWith(v, "#")) { Asn1Object obj = decodeObject(v); @@ -987,7 +981,7 @@ namespace Org.BouncyCastle.Asn1.X509 int end = buf.Length; - if (val.StartsWith("\\#")) + if (Platform.StartsWith(val, "\\#")) { index += 2; } diff --git a/crypto/src/asn1/x9/X962NamedCurves.cs b/crypto/src/asn1/x9/X962NamedCurves.cs index 6fa4e7c4b..14f7f818a 100644 --- a/crypto/src/asn1/x9/X962NamedCurves.cs +++ b/crypto/src/asn1/x9/X962NamedCurves.cs @@ -666,7 +666,7 @@ namespace Org.BouncyCastle.Asn1.X9 DerObjectIdentifier oid, X9ECParametersHolder holder) { - objIds.Add(Platform.ToLowerInvariant(name), oid); + objIds.Add(Platform.ToUpperInvariant(name), oid); names.Add(oid, name); curves.Add(oid, holder); } @@ -727,7 +727,7 @@ namespace Org.BouncyCastle.Asn1.X9 public static DerObjectIdentifier GetOid( string name) { - return (DerObjectIdentifier)objIds[Platform.ToLowerInvariant(name)]; + return (DerObjectIdentifier)objIds[Platform.ToUpperInvariant(name)]; } /** diff --git a/crypto/src/cms/KEKRecipientInfoGenerator.cs b/crypto/src/cms/KEKRecipientInfoGenerator.cs index c66f27547..6f34fec43 100644 --- a/crypto/src/cms/KEKRecipientInfoGenerator.cs +++ b/crypto/src/cms/KEKRecipientInfoGenerator.cs @@ -10,6 +10,7 @@ using Org.BouncyCastle.Asn1.X509; using Org.BouncyCastle.Crypto; using Org.BouncyCastle.Crypto.Parameters; using Org.BouncyCastle.Security; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Cms { @@ -63,19 +64,19 @@ namespace Org.BouncyCastle.Cms private static AlgorithmIdentifier DetermineKeyEncAlg( string algorithm, KeyParameter key) { - if (algorithm.StartsWith("DES")) + if (Platform.StartsWith(algorithm, "DES")) { return new AlgorithmIdentifier( PkcsObjectIdentifiers.IdAlgCms3DesWrap, DerNull.Instance); } - else if (algorithm.StartsWith("RC2")) + else if (Platform.StartsWith(algorithm, "RC2")) { return new AlgorithmIdentifier( PkcsObjectIdentifiers.IdAlgCmsRC2Wrap, new DerInteger(58)); } - else if (algorithm.StartsWith("AES")) + else if (Platform.StartsWith(algorithm, "AES")) { int length = key.GetKey().Length * 8; DerObjectIdentifier wrapOid; @@ -99,12 +100,12 @@ namespace Org.BouncyCastle.Cms return new AlgorithmIdentifier(wrapOid); // parameters absent } - else if (algorithm.StartsWith("SEED")) + else if (Platform.StartsWith(algorithm, "SEED")) { // parameters absent return new AlgorithmIdentifier(KisaObjectIdentifiers.IdNpkiAppCmsSeedWrap); } - else if (algorithm.StartsWith("CAMELLIA")) + else if (Platform.StartsWith(algorithm, "CAMELLIA")) { int length = key.GetKey().Length * 8; DerObjectIdentifier wrapOid; diff --git a/crypto/src/cms/PasswordRecipientInfoGenerator.cs b/crypto/src/cms/PasswordRecipientInfoGenerator.cs index 0a0b27b53..9916edfc4 100644 --- a/crypto/src/cms/PasswordRecipientInfoGenerator.cs +++ b/crypto/src/cms/PasswordRecipientInfoGenerator.cs @@ -7,6 +7,7 @@ using Org.BouncyCastle.Asn1.X509; using Org.BouncyCastle.Crypto; using Org.BouncyCastle.Crypto.Parameters; using Org.BouncyCastle.Security; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Cms { @@ -46,7 +47,7 @@ namespace Org.BouncyCastle.Cms IWrapper keyWrapper = Helper.CreateWrapper(rfc3211WrapperName); // Note: In Java build, the IV is automatically generated in JCE layer - int ivLength = rfc3211WrapperName.StartsWith("DESEDE") ? 8 : 16; + int ivLength = Platform.StartsWith(rfc3211WrapperName, "DESEDE") ? 8 : 16; byte[] iv = new byte[ivLength]; random.NextBytes(iv); diff --git a/crypto/src/crypto/ec/CustomNamedCurves.cs b/crypto/src/crypto/ec/CustomNamedCurves.cs index 51bb1829a..8a0c50a47 100644 --- a/crypto/src/crypto/ec/CustomNamedCurves.cs +++ b/crypto/src/crypto/ec/CustomNamedCurves.cs @@ -756,7 +756,7 @@ namespace Org.BouncyCastle.Crypto.EC private static void DefineCurve(string name, X9ECParametersHolder holder) { names.Add(name); - name = Platform.ToLowerInvariant(name); + name = Platform.ToUpperInvariant(name); nameToCurve.Add(name, holder); } @@ -765,7 +765,7 @@ namespace Org.BouncyCastle.Crypto.EC names.Add(name); oidToName.Add(oid, name); oidToCurve.Add(oid, holder); - name = Platform.ToLowerInvariant(name); + name = Platform.ToUpperInvariant(name); nameToOid.Add(name, oid); nameToCurve.Add(name, holder); } @@ -776,7 +776,7 @@ namespace Org.BouncyCastle.Crypto.EC if (curve == null) throw new InvalidOperationException(); - name = Platform.ToLowerInvariant(name); + name = Platform.ToUpperInvariant(name); nameToOid.Add(name, oid); nameToCurve.Add(name, curve); } @@ -841,7 +841,7 @@ namespace Org.BouncyCastle.Crypto.EC public static X9ECParameters GetByName(string name) { - X9ECParametersHolder holder = (X9ECParametersHolder)nameToCurve[Platform.ToLowerInvariant(name)]; + X9ECParametersHolder holder = (X9ECParametersHolder)nameToCurve[Platform.ToUpperInvariant(name)]; return holder == null ? null : holder.Parameters; } @@ -865,7 +865,7 @@ namespace Org.BouncyCastle.Crypto.EC */ public static DerObjectIdentifier GetOid(string name) { - return (DerObjectIdentifier)nameToOid[Platform.ToLowerInvariant(name)]; + return (DerObjectIdentifier)nameToOid[Platform.ToUpperInvariant(name)]; } /** diff --git a/crypto/src/openpgp/PgpPublicKeyRingBundle.cs b/crypto/src/openpgp/PgpPublicKeyRingBundle.cs index 519a2f884..e73848439 100644 --- a/crypto/src/openpgp/PgpPublicKeyRingBundle.cs +++ b/crypto/src/openpgp/PgpPublicKeyRingBundle.cs @@ -113,7 +113,7 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp if (ignoreCase) { - userId = Platform.ToLowerInvariant(userId); + userId = Platform.ToUpperInvariant(userId); } foreach (PgpPublicKeyRing pubRing in GetKeyRings()) @@ -123,12 +123,12 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp string next = nextUserID; if (ignoreCase) { - next = Platform.ToLowerInvariant(next); + next = Platform.ToUpperInvariant(next); } if (matchPartial) { - if (next.IndexOf(userId) > -1) + if (Platform.IndexOf(next, userId) > -1) { rings.Add(pubRing); } diff --git a/crypto/src/openpgp/PgpSecretKey.cs b/crypto/src/openpgp/PgpSecretKey.cs index d3811c44c..b3986073d 100644 --- a/crypto/src/openpgp/PgpSecretKey.cs +++ b/crypto/src/openpgp/PgpSecretKey.cs @@ -1204,7 +1204,7 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp string curveID = SXprUtilities.ReadString(inputStream, inputStream.ReadByte()); curveName = SXprUtilities.ReadString(inputStream, inputStream.ReadByte()); - if (curveName.StartsWith("NIST ")) + if (Platform.StartsWith(curveName, "NIST ")) { curveName = curveName.Substring("NIST ".Length); } diff --git a/crypto/src/openpgp/PgpSecretKeyRingBundle.cs b/crypto/src/openpgp/PgpSecretKeyRingBundle.cs index 12c7c098c..b0df0ed3f 100644 --- a/crypto/src/openpgp/PgpSecretKeyRingBundle.cs +++ b/crypto/src/openpgp/PgpSecretKeyRingBundle.cs @@ -114,7 +114,7 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp if (ignoreCase) { - userId = Platform.ToLowerInvariant(userId); + userId = Platform.ToUpperInvariant(userId); } foreach (PgpSecretKeyRing secRing in GetKeyRings()) @@ -124,12 +124,12 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp string next = nextUserID; if (ignoreCase) { - next = Platform.ToLowerInvariant(next); + next = Platform.ToUpperInvariant(next); } if (matchPartial) { - if (next.IndexOf(userId) > -1) + if (Platform.IndexOf(next, userId) > -1) { rings.Add(secRing); } diff --git a/crypto/src/openssl/MiscPemGenerator.cs b/crypto/src/openssl/MiscPemGenerator.cs index 568465fe4..443e446f7 100644 --- a/crypto/src/openssl/MiscPemGenerator.cs +++ b/crypto/src/openssl/MiscPemGenerator.cs @@ -197,7 +197,7 @@ namespace Org.BouncyCastle.OpenSsl dekAlgName = "DES-EDE3-CBC"; } - int ivLength = dekAlgName.StartsWith("AES-") ? 16 : 8; + int ivLength = Platform.StartsWith(dekAlgName, "AES-") ? 16 : 8; byte[] iv = new byte[ivLength]; random.NextBytes(iv); diff --git a/crypto/src/openssl/PEMReader.cs b/crypto/src/openssl/PEMReader.cs index ec5d1b414..987f4471c 100644 --- a/crypto/src/openssl/PEMReader.cs +++ b/crypto/src/openssl/PEMReader.cs @@ -93,7 +93,7 @@ namespace Org.BouncyCastle.OpenSsl // if (parsers.Contains(obj.Type)) // return ((PemObjectParser)parsers[obj.Type]).ParseObject(obj); - if (obj.Type.EndsWith("PRIVATE KEY")) + if (Platform.EndsWith(obj.Type, "PRIVATE KEY")) return ReadPrivateKey(obj); switch (obj.Type) @@ -233,7 +233,7 @@ namespace Org.BouncyCastle.OpenSsl // // extract the key // - Debug.Assert(pemObject.Type.EndsWith("PRIVATE KEY")); + Debug.Assert(Platform.EndsWith(pemObject.Type, "PRIVATE KEY")); string type = pemObject.Type.Substring(0, pemObject.Type.Length - "PRIVATE KEY".Length).Trim(); byte[] keyBytes = pemObject.Content; diff --git a/crypto/src/pkcs/Pkcs10CertificationRequest.cs b/crypto/src/pkcs/Pkcs10CertificationRequest.cs index 0411d9190..c2504e6e5 100644 --- a/crypto/src/pkcs/Pkcs10CertificationRequest.cs +++ b/crypto/src/pkcs/Pkcs10CertificationRequest.cs @@ -379,7 +379,7 @@ namespace Org.BouncyCastle.Pkcs // throw new SignatureException("IOException decoding parameters: " + e.Message); // } - if (signature.AlgorithmName.EndsWith("MGF1")) + if (Platform.EndsWith(signature.AlgorithmName, "MGF1")) { throw Platform.CreateNotImplementedException("signature algorithm with MGF1"); diff --git a/crypto/src/pkcs/Pkcs12Store.cs b/crypto/src/pkcs/Pkcs12Store.cs index b649a726e..e65788733 100644 --- a/crypto/src/pkcs/Pkcs12Store.cs +++ b/crypto/src/pkcs/Pkcs12Store.cs @@ -1052,13 +1052,13 @@ namespace Org.BouncyCastle.Pkcs public object Remove( string alias) { - string lower = Platform.ToLowerInvariant(alias); - string k = (string) keys[lower]; + string upper = Platform.ToUpperInvariant(alias); + string k = (string)keys[upper]; if (k == null) return null; - keys.Remove(lower); + keys.Remove(upper); object o = orig[k]; orig.Remove(k); @@ -1070,8 +1070,8 @@ namespace Org.BouncyCastle.Pkcs { get { - string lower = Platform.ToLowerInvariant(alias); - string k = (string)keys[lower]; + string upper = Platform.ToUpperInvariant(alias); + string k = (string)keys[upper]; if (k == null) return null; @@ -1080,13 +1080,13 @@ namespace Org.BouncyCastle.Pkcs } set { - string lower = Platform.ToLowerInvariant(alias); - string k = (string)keys[lower]; + string upper = Platform.ToUpperInvariant(alias); + string k = (string)keys[upper]; if (k != null) { orig.Remove(k); } - keys[lower] = alias; + keys[upper] = alias; orig[alias] = value; } } diff --git a/crypto/src/pkix/PkixCertPath.cs b/crypto/src/pkix/PkixCertPath.cs index d03709167..3c428f6fb 100644 --- a/crypto/src/pkix/PkixCertPath.cs +++ b/crypto/src/pkix/PkixCertPath.cs @@ -357,7 +357,7 @@ namespace Org.BouncyCastle.Pkix public virtual byte[] GetEncoded( string encoding) { - if (Platform.CompareIgnoreCase(encoding, "PkiPath") == 0) + if (Platform.EqualsIgnoreCase(encoding, "PkiPath")) { Asn1EncodableVector v = new Asn1EncodableVector(); @@ -368,7 +368,7 @@ namespace Org.BouncyCastle.Pkix return ToDerEncoded(new DerSequence(v)); } - else if (Platform.CompareIgnoreCase(encoding, "PKCS7") == 0) + else if (Platform.EqualsIgnoreCase(encoding, "PKCS7")) { Asn1.Pkcs.ContentInfo encInfo = new Asn1.Pkcs.ContentInfo( PkcsObjectIdentifiers.Data, null); @@ -389,7 +389,7 @@ namespace Org.BouncyCastle.Pkix return ToDerEncoded(new Asn1.Pkcs.ContentInfo(PkcsObjectIdentifiers.SignedData, sd)); } - else if (Platform.CompareIgnoreCase(encoding, "PEM") == 0) + else if (Platform.EqualsIgnoreCase(encoding, "PEM")) { MemoryStream bOut = new MemoryStream(); PemWriter pWrt = new PemWriter(new StreamWriter(bOut)); diff --git a/crypto/src/pkix/PkixCertPathValidatorUtilities.cs b/crypto/src/pkix/PkixCertPathValidatorUtilities.cs index acea77856..a2704a746 100644 --- a/crypto/src/pkix/PkixCertPathValidatorUtilities.cs +++ b/crypto/src/pkix/PkixCertPathValidatorUtilities.cs @@ -230,7 +230,7 @@ namespace Org.BouncyCastle.Pkix { try { - if (location.StartsWith("ldap://")) + if (Platform.StartsWith(location, "ldap://")) { // ldap://directory.d-trust.net/CN=D-TRUST // Qualified CA 2003 1:PN,O=D-Trust GmbH,C=DE diff --git a/crypto/src/pkix/PkixNameConstraintValidator.cs b/crypto/src/pkix/PkixNameConstraintValidator.cs index cf944beae..f4ae73925 100644 --- a/crypto/src/pkix/PkixNameConstraintValidator.cs +++ b/crypto/src/pkix/PkixNameConstraintValidator.cs @@ -662,7 +662,7 @@ namespace Org.BouncyCastle.Pkix private bool WithinDomain(String testDomain, String domain) { String tempDomain = domain; - if (tempDomain.StartsWith(".")) + if (Platform.StartsWith(tempDomain, ".")) { tempDomain = tempDomain.Substring(1); } @@ -685,7 +685,7 @@ namespace Org.BouncyCastle.Pkix return false; } } - else if (!(Platform.CompareIgnoreCase(testDomainParts[i + d], domainParts[i]) == 0)) + else if (!Platform.EqualsIgnoreCase(testDomainParts[i + d], domainParts[i])) { return false; } @@ -737,7 +737,7 @@ namespace Org.BouncyCastle.Pkix String str = ((String)it.Current); // is sub domain or the same - if (WithinDomain(dns, str) || (Platform.CompareIgnoreCase(dns, str) == 0)) + if (WithinDomain(dns, str) || Platform.EqualsIgnoreCase(dns, str)) { throw new PkixNameConstraintValidatorException( "DNS is from an excluded subtree."); @@ -763,7 +763,7 @@ namespace Org.BouncyCastle.Pkix // both are a particular mailbox if (email2.IndexOf('@') != -1) { - if (Platform.CompareIgnoreCase(email1, email2) == 0) + if (Platform.EqualsIgnoreCase(email1, email2)) { union.Add(email1); } @@ -774,7 +774,7 @@ namespace Org.BouncyCastle.Pkix } } // email2 specifies a domain - else if (email2.StartsWith(".")) + else if (Platform.StartsWith(email2, ".")) { if (WithinDomain(_sub, email2)) { @@ -789,7 +789,7 @@ namespace Org.BouncyCastle.Pkix // email2 specifies a particular host else { - if (Platform.CompareIgnoreCase(_sub, email2) == 0) + if (Platform.EqualsIgnoreCase(_sub, email2)) { union.Add(email2); } @@ -801,7 +801,7 @@ namespace Org.BouncyCastle.Pkix } } // email1 specifies a domain - else if (email1.StartsWith(".")) + else if (Platform.StartsWith(email1, ".")) { if (email2.IndexOf('@') != -1) { @@ -817,9 +817,9 @@ namespace Org.BouncyCastle.Pkix } } // email2 specifies a domain - else if (email2.StartsWith(".")) + else if (Platform.StartsWith(email2, ".")) { - if (WithinDomain(email1, email2) || Platform.CompareIgnoreCase(email1, email2) == 0) + if (WithinDomain(email1, email2) || Platform.EqualsIgnoreCase(email1, email2)) { union.Add(email2); } @@ -852,7 +852,7 @@ namespace Org.BouncyCastle.Pkix if (email2.IndexOf('@') != -1) { String _sub = email2.Substring(email1.IndexOf('@') + 1); - if (Platform.CompareIgnoreCase(_sub, email1) == 0) + if (Platform.EqualsIgnoreCase(_sub, email1)) { union.Add(email1); } @@ -863,7 +863,7 @@ namespace Org.BouncyCastle.Pkix } } // email2 specifies a domain - else if (email2.StartsWith(".")) + else if (Platform.StartsWith(email2, ".")) { if (WithinDomain(email1, email2)) { @@ -878,7 +878,7 @@ namespace Org.BouncyCastle.Pkix // email2 specifies a particular host else { - if (Platform.CompareIgnoreCase(email1, email2) == 0) + if (Platform.EqualsIgnoreCase(email1, email2)) { union.Add(email1); } @@ -900,7 +900,7 @@ namespace Org.BouncyCastle.Pkix // both are a particular mailbox if (email2.IndexOf('@') != -1) { - if (Platform.CompareIgnoreCase(email1, email2) == 0) + if (Platform.EqualsIgnoreCase(email1, email2)) { union.Add(email1); } @@ -911,7 +911,7 @@ namespace Org.BouncyCastle.Pkix } } // email2 specifies a domain - else if (email2.StartsWith(".")) + else if (Platform.StartsWith(email2, ".")) { if (WithinDomain(_sub, email2)) { @@ -926,7 +926,7 @@ namespace Org.BouncyCastle.Pkix // email2 specifies a particular host else { - if (Platform.CompareIgnoreCase(_sub, email2) == 0) + if (Platform.EqualsIgnoreCase(_sub, email2)) { union.Add(email2); } @@ -939,7 +939,7 @@ namespace Org.BouncyCastle.Pkix } } // email1 specifies a domain - else if (email1.StartsWith(".")) + else if (Platform.StartsWith(email1, ".")) { if (email2.IndexOf('@') != -1) { @@ -955,9 +955,9 @@ namespace Org.BouncyCastle.Pkix } } // email2 specifies a domain - else if (email2.StartsWith(".")) + else if (Platform.StartsWith(email2, ".")) { - if (WithinDomain(email1, email2) || Platform.CompareIgnoreCase(email1, email2) == 0) + if (WithinDomain(email1, email2) || Platform.EqualsIgnoreCase(email1, email2)) { union.Add(email2); } @@ -990,7 +990,7 @@ namespace Org.BouncyCastle.Pkix if (email2.IndexOf('@') != -1) { String _sub = email2.Substring(email1.IndexOf('@') + 1); - if (Platform.CompareIgnoreCase(_sub, email1) == 0) + if (Platform.EqualsIgnoreCase(_sub, email1)) { union.Add(email1); } @@ -1001,7 +1001,7 @@ namespace Org.BouncyCastle.Pkix } } // email2 specifies a domain - else if (email2.StartsWith(".")) + else if (Platform.StartsWith(email2, ".")) { if (WithinDomain(email1, email2)) { @@ -1016,7 +1016,7 @@ namespace Org.BouncyCastle.Pkix // email2 specifies a particular host else { - if (Platform.CompareIgnoreCase(email1, email2) == 0) + if (Platform.EqualsIgnoreCase(email1, email2)) { union.Add(email1); } @@ -1122,13 +1122,13 @@ namespace Org.BouncyCastle.Pkix // both are a particular mailbox if (email2.IndexOf('@') != -1) { - if (Platform.CompareIgnoreCase(email1, email2) == 0) + if (Platform.EqualsIgnoreCase(email1, email2)) { intersect.Add(email1); } } // email2 specifies a domain - else if (email2.StartsWith(".")) + else if (Platform.StartsWith(email2, ".")) { if (WithinDomain(_sub, email2)) { @@ -1138,14 +1138,14 @@ namespace Org.BouncyCastle.Pkix // email2 specifies a particular host else { - if (Platform.CompareIgnoreCase(_sub, email2) == 0) + if (Platform.EqualsIgnoreCase(_sub, email2)) { intersect.Add(email1); } } } // email specifies a domain - else if (email1.StartsWith(".")) + else if (Platform.StartsWith(email1, ".")) { if (email2.IndexOf('@') != -1) { @@ -1156,9 +1156,9 @@ namespace Org.BouncyCastle.Pkix } } // email2 specifies a domain - else if (email2.StartsWith(".")) + else if (Platform.StartsWith(email2, ".")) { - if (WithinDomain(email1, email2) || (Platform.CompareIgnoreCase(email1, email2) == 0)) + if (WithinDomain(email1, email2) || Platform.EqualsIgnoreCase(email1, email2)) { intersect.Add(email1); } @@ -1181,13 +1181,13 @@ namespace Org.BouncyCastle.Pkix if (email2.IndexOf('@') != -1) { String _sub = email2.Substring(email2.IndexOf('@') + 1); - if (Platform.CompareIgnoreCase(_sub, email1) == 0) + if (Platform.EqualsIgnoreCase(_sub, email1)) { intersect.Add(email2); } } // email2 specifies a domain - else if (email2.StartsWith(".")) + else if (Platform.StartsWith(email2, ".")) { if (WithinDomain(email1, email2)) { @@ -1197,7 +1197,7 @@ namespace Org.BouncyCastle.Pkix // email2 specifies a particular host else { - if (Platform.CompareIgnoreCase(email1, email2) == 0) + if (Platform.EqualsIgnoreCase(email1, email2)) { intersect.Add(email1); } @@ -1291,13 +1291,13 @@ namespace Org.BouncyCastle.Pkix // both are a particular mailbox if (email2.IndexOf('@') != -1) { - if (Platform.CompareIgnoreCase(email1, email2) == 0) + if (Platform.EqualsIgnoreCase(email1, email2)) { intersect.Add(email1); } } // email2 specifies a domain - else if (email2.StartsWith(".")) + else if (Platform.StartsWith(email2, ".")) { if (WithinDomain(_sub, email2)) { @@ -1307,14 +1307,14 @@ namespace Org.BouncyCastle.Pkix // email2 specifies a particular host else { - if (Platform.CompareIgnoreCase(_sub, email2) == 0) + if (Platform.EqualsIgnoreCase(_sub, email2)) { intersect.Add(email1); } } } // email specifies a domain - else if (email1.StartsWith(".")) + else if (Platform.StartsWith(email1, ".")) { if (email2.IndexOf('@') != -1) { @@ -1325,9 +1325,9 @@ namespace Org.BouncyCastle.Pkix } } // email2 specifies a domain - else if (email2.StartsWith(".")) + else if (Platform.StartsWith(email2, ".")) { - if (WithinDomain(email1, email2) || (Platform.CompareIgnoreCase(email1, email2) == 0)) + if (WithinDomain(email1, email2) || Platform.EqualsIgnoreCase(email1, email2)) { intersect.Add(email1); } @@ -1350,13 +1350,13 @@ namespace Org.BouncyCastle.Pkix if (email2.IndexOf('@') != -1) { String _sub = email2.Substring(email2.IndexOf('@') + 1); - if (Platform.CompareIgnoreCase(_sub, email1) == 0) + if (Platform.EqualsIgnoreCase(_sub, email1)) { intersect.Add(email2); } } // email2 specifies a domain - else if (email2.StartsWith(".")) + else if (Platform.StartsWith(email2, ".")) { if (WithinDomain(email1, email2)) { @@ -1366,7 +1366,7 @@ namespace Org.BouncyCastle.Pkix // email2 specifies a particular host else { - if (Platform.CompareIgnoreCase(email1, email2) == 0) + if (Platform.EqualsIgnoreCase(email1, email2)) { intersect.Add(email1); } @@ -1405,9 +1405,9 @@ namespace Org.BouncyCastle.Pkix { String host = ExtractHostFromURL(uri); // a host - if (!constraint.StartsWith(".")) + if (!Platform.StartsWith(constraint, ".")) { - if (Platform.CompareIgnoreCase(host, constraint) == 0) + if (Platform.EqualsIgnoreCase(host, constraint)) { return true; } @@ -1428,9 +1428,10 @@ namespace Org.BouncyCastle.Pkix // remove ':' after protocol, e.g. http: String sub = url.Substring(url.IndexOf(':') + 1); // extract host from Common Internet Scheme Syntax, e.g. http:// - if (sub.IndexOf("//") != -1) + int idxOfSlashes = Platform.IndexOf(sub, "//"); + if (idxOfSlashes != -1) { - sub = sub.Substring(sub.IndexOf("//") + 2); + sub = sub.Substring(idxOfSlashes + 2); } // first remove port, e.g. http://test.com:21 if (sub.LastIndexOf(':') != -1) diff --git a/crypto/src/security/CipherUtilities.cs b/crypto/src/security/CipherUtilities.cs index cdb711f69..9ad4228ac 100644 --- a/crypto/src/security/CipherUtilities.cs +++ b/crypto/src/security/CipherUtilities.cs @@ -278,9 +278,9 @@ namespace Org.BouncyCastle.Security - if (algorithm.StartsWith("PBE")) + if (Platform.StartsWith(algorithm, "PBE")) { - if (algorithm.EndsWith("-CBC")) + if (Platform.EndsWith(algorithm, "-CBC")) { if (algorithm == "PBEWITHSHA1ANDDES-CBC") { @@ -305,7 +305,7 @@ namespace Org.BouncyCastle.Security new CbcBlockCipher(new RC2Engine())); } } - else if (algorithm.EndsWith("-BC") || algorithm.EndsWith("-OPENSSL")) + else if (Platform.EndsWith(algorithm, "-BC") || Platform.EndsWith(algorithm, "-OPENSSL")) { if (Strings.IsOneOf(algorithm, "PBEWITHSHAAND128BITAES-CBC-BC", diff --git a/crypto/src/security/GeneratorUtilities.cs b/crypto/src/security/GeneratorUtilities.cs index 45fbc9425..7562a76be 100644 --- a/crypto/src/security/GeneratorUtilities.cs +++ b/crypto/src/security/GeneratorUtilities.cs @@ -299,7 +299,7 @@ namespace Org.BouncyCastle.Security return new DsaKeyPairGenerator(); // "EC", "ECDH", "ECDHC", "ECDSA", "ECGOST3410", "ECMQV" - if (canonicalName.StartsWith("EC")) + if (Platform.StartsWith(canonicalName, "EC")) return new ECKeyPairGenerator(canonicalName); if (canonicalName == "ELGAMAL") diff --git a/crypto/src/security/MacUtilities.cs b/crypto/src/security/MacUtilities.cs index 41cf5e9e2..fab9b1d41 100644 --- a/crypto/src/security/MacUtilities.cs +++ b/crypto/src/security/MacUtilities.cs @@ -114,15 +114,15 @@ namespace Org.BouncyCastle.Security mechanism = upper; } - if (mechanism.StartsWith("PBEWITH")) + if (Platform.StartsWith(mechanism, "PBEWITH")) { mechanism = mechanism.Substring("PBEWITH".Length); } - if (CultureInfo.InvariantCulture.CompareInfo.IsPrefix(mechanism, "HMAC", CompareOptions.Ordinal)) + if (Platform.StartsWith(mechanism, "HMAC")) { string digestName; - if (mechanism.StartsWith("HMAC-") || mechanism.StartsWith("HMAC/")) + if (Platform.StartsWith(mechanism, "HMAC-") || Platform.StartsWith(mechanism, "HMAC/")) { digestName = mechanism.Substring(5); } diff --git a/crypto/src/security/PbeUtilities.cs b/crypto/src/security/PbeUtilities.cs index 0cb235ae6..33f31e5b4 100644 --- a/crypto/src/security/PbeUtilities.cs +++ b/crypto/src/security/PbeUtilities.cs @@ -444,7 +444,7 @@ namespace Org.BouncyCastle.Security } } } - else if (mechanism.StartsWith("PBEwithSHA-1")) + else if (Platform.StartsWith(mechanism, "PBEwithSHA-1")) { PbeParametersGenerator generator = MakePbeGenerator( (string) algorithmType[mechanism], new Sha1Digest(), keyBytes, salt, iterationCount); @@ -494,7 +494,7 @@ namespace Org.BouncyCastle.Security parameters = generator.GenerateDerivedParameters("RC2", 64, 64); } } - else if (mechanism.StartsWith("PBEwithSHA-256")) + else if (Platform.StartsWith(mechanism, "PBEwithSHA-256")) { PbeParametersGenerator generator = MakePbeGenerator( (string) algorithmType[mechanism], new Sha256Digest(), keyBytes, salt, iterationCount); @@ -512,7 +512,7 @@ namespace Org.BouncyCastle.Security parameters = generator.GenerateDerivedParameters("AES", 256, 128); } } - else if (mechanism.StartsWith("PBEwithMD5")) + else if (Platform.StartsWith(mechanism, "PBEwithMD5")) { PbeParametersGenerator generator = MakePbeGenerator( (string)algorithmType[mechanism], new MD5Digest(), keyBytes, salt, iterationCount); @@ -538,7 +538,7 @@ namespace Org.BouncyCastle.Security parameters = generator.GenerateDerivedParameters("AES", 256, 128); } } - else if (mechanism.StartsWith("PBEwithMD2")) + else if (Platform.StartsWith(mechanism, "PBEwithMD2")) { PbeParametersGenerator generator = MakePbeGenerator( (string)algorithmType[mechanism], new MD2Digest(), keyBytes, salt, iterationCount); @@ -551,7 +551,7 @@ namespace Org.BouncyCastle.Security parameters = generator.GenerateDerivedParameters("RC2", 64, 64); } } - else if (mechanism.StartsWith("PBEwithHmac")) + else if (Platform.StartsWith(mechanism, "PBEwithHmac")) { string digestName = mechanism.Substring("PBEwithHmac".Length); IDigest digest = DigestUtilities.GetDigest(digestName); @@ -594,39 +594,39 @@ namespace Org.BouncyCastle.Security { string mechanism = (string)algorithms[Platform.ToUpperInvariant(algorithm)]; - if (mechanism.StartsWith("PBEwithHmac")) + if (Platform.StartsWith(mechanism, "PBEwithHmac")) { string digestName = mechanism.Substring("PBEwithHmac".Length); return MacUtilities.GetMac("HMAC/" + digestName); } - if (mechanism.StartsWith("PBEwithMD2") - || mechanism.StartsWith("PBEwithMD5") - || mechanism.StartsWith("PBEwithSHA-1") - || mechanism.StartsWith("PBEwithSHA-256")) + if (Platform.StartsWith(mechanism, "PBEwithMD2") + || Platform.StartsWith(mechanism, "PBEwithMD5") + || Platform.StartsWith(mechanism, "PBEwithSHA-1") + || Platform.StartsWith(mechanism, "PBEwithSHA-256")) { - if (mechanism.EndsWith("AES-CBC-BC") || mechanism.EndsWith("AES-CBC-OPENSSL")) + if (Platform.EndsWith(mechanism, "AES-CBC-BC") || Platform.EndsWith(mechanism, "AES-CBC-OPENSSL")) { return CipherUtilities.GetCipher("AES/CBC"); } - if (mechanism.EndsWith("DES-CBC")) + if (Platform.EndsWith(mechanism, "DES-CBC")) { return CipherUtilities.GetCipher("DES/CBC"); } - if (mechanism.EndsWith("DESEDE-CBC")) + if (Platform.EndsWith(mechanism, "DESEDE-CBC")) { return CipherUtilities.GetCipher("DESEDE/CBC"); } - if (mechanism.EndsWith("RC2-CBC")) + if (Platform.EndsWith(mechanism, "RC2-CBC")) { return CipherUtilities.GetCipher("RC2/CBC"); } - if (mechanism.EndsWith("RC4")) + if (Platform.EndsWith(mechanism, "RC4")) { return CipherUtilities.GetCipher("RC4"); } @@ -643,7 +643,7 @@ namespace Org.BouncyCastle.Security private static ICipherParameters FixDesParity(string mechanism, ICipherParameters parameters) { - if (!mechanism.EndsWith("DES-CBC") & !mechanism.EndsWith("DESEDE-CBC")) + if (!Platform.EndsWith(mechanism, "DES-CBC") && !Platform.EndsWith(mechanism, "DESEDE-CBC")) { return parameters; } diff --git a/crypto/src/security/SecureRandom.cs b/crypto/src/security/SecureRandom.cs index 5bad57a14..4894a93e6 100644 --- a/crypto/src/security/SecureRandom.cs +++ b/crypto/src/security/SecureRandom.cs @@ -91,7 +91,7 @@ namespace Org.BouncyCastle.Security public static SecureRandom GetInstance(string algorithm, bool autoSeed) { string upper = Platform.ToUpperInvariant(algorithm); - if (upper.EndsWith("PRNG")) + if (Platform.EndsWith(upper, "PRNG")) { string digestName = upper.Substring(0, upper.Length - "PRNG".Length); DigestRandomGenerator prng = CreatePrng(digestName, autoSeed); diff --git a/crypto/src/security/SignerUtilities.cs b/crypto/src/security/SignerUtilities.cs index bd1515147..9a4915b46 100644 --- a/crypto/src/security/SignerUtilities.cs +++ b/crypto/src/security/SignerUtilities.cs @@ -312,7 +312,7 @@ namespace Org.BouncyCastle.Security return GetPssX509Parameters("SHA-1"); } - if (mechanism.EndsWith("withRSAandMGF1")) + if (Platform.EndsWith(mechanism, "withRSAandMGF1")) { string digestName = mechanism.Substring(0, mechanism.Length - "withRSAandMGF1".Length); return GetPssX509Parameters(digestName); @@ -534,10 +534,10 @@ namespace Org.BouncyCastle.Security return new Iso9796d2Signer(new RsaBlindedEngine(), new RipeMD160Digest(), true); } - if (mechanism.EndsWith("/X9.31")) + if (Platform.EndsWith(mechanism, "/X9.31")) { string x931 = mechanism.Substring(0, mechanism.Length - "/X9.31".Length); - int withPos = x931.IndexOf("WITH"); + int withPos = Platform.IndexOf(x931, "WITH"); if (withPos > 0) { int endPos = withPos + "WITH".Length; diff --git a/crypto/src/util/Platform.cs b/crypto/src/util/Platform.cs index d4b18f182..361fe7536 100644 --- a/crypto/src/util/Platform.cs +++ b/crypto/src/util/Platform.cs @@ -13,6 +13,8 @@ namespace Org.BouncyCastle.Utilities { internal abstract class Platform { + private static readonly CompareInfo InvariantCompareInfo = CultureInfo.InvariantCulture.CompareInfo; + #if NETCF_1_0 || NETCF_2_0 private static string GetNewLine() { @@ -30,16 +32,12 @@ namespace Org.BouncyCastle.Utilities } #endif - internal static int CompareIgnoreCase(string a, string b) + internal static bool EqualsIgnoreCase(string a, string b) { -#if SILVERLIGHT - return String.Compare(a, b, StringComparison.InvariantCultureIgnoreCase); -#elif SYS_RUNTIME - return String.Compare(a, b, StringComparison.OrdinalIgnoreCase); -#elif PORTABLE - return String.Compare(a, b, CultureInfo.InvariantCulture, CompareOptions.IgnoreCase); +#if PORTABLE + return String.Equals(a, b, StringComparison.OrdinalIgnoreCase); #else - return String.Compare(a, b, true); + return ToUpperInvariant(a) == ToUpperInvariant(b); #endif } @@ -202,5 +200,25 @@ namespace Org.BouncyCastle.Utilities t.Close(); } #endif + + internal static int IndexOf(string source, string value) + { + return InvariantCompareInfo.IndexOf(source, value, CompareOptions.Ordinal); + } + + internal static int LastIndexOf(string source, string value) + { + return InvariantCompareInfo.LastIndexOf(source, value, CompareOptions.Ordinal); + } + + internal static bool StartsWith(string source, string prefix) + { + return InvariantCompareInfo.IsPrefix(source, prefix, CompareOptions.Ordinal); + } + + internal static bool EndsWith(string source, string suffix) + { + return InvariantCompareInfo.IsSuffix(source, suffix, CompareOptions.Ordinal); + } } } diff --git a/crypto/src/util/io/pem/PemReader.cs b/crypto/src/util/io/pem/PemReader.cs index b3284705d..bf712b6de 100644 --- a/crypto/src/util/io/pem/PemReader.cs +++ b/crypto/src/util/io/pem/PemReader.cs @@ -35,7 +35,7 @@ namespace Org.BouncyCastle.Utilities.IO.Pem { string line = reader.ReadLine(); - if (line != null && line.StartsWith(BeginString)) + if (line != null && Platform.StartsWith(line, BeginString)) { line = line.Substring(BeginString.Length); int index = line.IndexOf('-'); @@ -56,7 +56,7 @@ namespace Org.BouncyCastle.Utilities.IO.Pem string line; while ((line = reader.ReadLine()) != null - && line.IndexOf(endMarker) == -1) + && Platform.IndexOf(line, endMarker) == -1) { int colonPos = line.IndexOf(':'); @@ -69,8 +69,10 @@ namespace Org.BouncyCastle.Utilities.IO.Pem // Process field string fieldName = line.Substring(0, colonPos).Trim(); - if (fieldName.StartsWith("X-")) - fieldName = fieldName.Substring(2); + if (Platform.StartsWith(fieldName, "X-")) + { + fieldName = fieldName.Substring(2); + } string fieldValue = line.Substring(colonPos + 1).Trim(); diff --git a/crypto/src/util/net/IPAddress.cs b/crypto/src/util/net/IPAddress.cs index 2a30a15f0..38c124590 100644 --- a/crypto/src/util/net/IPAddress.cs +++ b/crypto/src/util/net/IPAddress.cs @@ -85,7 +85,7 @@ namespace Org.BouncyCastle.Utilities.Net public static bool IsValidIPv4WithNetmask( string address) { - int index = address.IndexOf("/"); + int index = address.IndexOf('/'); string mask = address.Substring(index + 1); return (index > 0) && IsValidIPv4(address.Substring(0, index)) @@ -95,7 +95,7 @@ namespace Org.BouncyCastle.Utilities.Net public static bool IsValidIPv6WithNetmask( string address) { - int index = address.IndexOf("/"); + int index = address.IndexOf('/'); string mask = address.Substring(index + 1); return (index > 0) && (IsValidIPv6(address.Substring(0, index)) diff --git a/crypto/src/x509/PEMParser.cs b/crypto/src/x509/PEMParser.cs index 8c117f323..28f28ee0a 100644 --- a/crypto/src/x509/PEMParser.cs +++ b/crypto/src/x509/PEMParser.cs @@ -3,6 +3,7 @@ using System.IO; using System.Text; using Org.BouncyCastle.Asn1; +using Org.BouncyCastle.Utilities; using Org.BouncyCastle.Utilities.Encoders; namespace Org.BouncyCastle.X509 @@ -59,7 +60,7 @@ namespace Org.BouncyCastle.X509 while ((line = ReadLine(inStream)) != null) { - if (line.StartsWith(_header1) || line.StartsWith(_header2)) + if (Platform.StartsWith(line, _header1) || Platform.StartsWith(line, _header2)) { break; } @@ -67,7 +68,7 @@ namespace Org.BouncyCastle.X509 while ((line = ReadLine(inStream)) != null) { - if (line.StartsWith(_footer1) || line.StartsWith(_footer2)) + if (Platform.StartsWith(line, _footer1) || Platform.StartsWith(line, _footer2)) { break; } diff --git a/crypto/src/x509/X509SignatureUtil.cs b/crypto/src/x509/X509SignatureUtil.cs index 858b8f446..83863aee1 100644 --- a/crypto/src/x509/X509SignatureUtil.cs +++ b/crypto/src/x509/X509SignatureUtil.cs @@ -34,7 +34,7 @@ namespace Org.BouncyCastle.X509 // throw new SignatureException("IOException decoding parameters: " + e.Message); // } // -// if (signature.getAlgorithm().EndsWith("MGF1")) +// if (Platform.EndsWith(signature.getAlgorithm(), "MGF1")) // { // try // { -- cgit 1.5.1 From d14979f6a8404eea69abfaa5fae8a8f4f783b8f2 Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Mon, 16 Nov 2015 19:47:31 +0700 Subject: Remove redundant semicolons --- crypto/src/asn1/DerApplicationSpecific.cs | 2 +- crypto/src/crypto/engines/RSACoreEngine.cs | 2 +- crypto/src/openpgp/PgpEncryptedData.cs | 2 +- crypto/src/openpgp/PgpPublicKeyRing.cs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'crypto/src/openpgp') diff --git a/crypto/src/asn1/DerApplicationSpecific.cs b/crypto/src/asn1/DerApplicationSpecific.cs index 394c7431e..9149930e0 100644 --- a/crypto/src/asn1/DerApplicationSpecific.cs +++ b/crypto/src/asn1/DerApplicationSpecific.cs @@ -160,7 +160,7 @@ namespace Org.BouncyCastle.Asn1 tmp[0] |= Asn1Tags.Constructed; } - return FromByteArray(tmp);; + return FromByteArray(tmp); } internal override void Encode( diff --git a/crypto/src/crypto/engines/RSACoreEngine.cs b/crypto/src/crypto/engines/RSACoreEngine.cs index 38326371f..fd44e3cc1 100644 --- a/crypto/src/crypto/engines/RSACoreEngine.cs +++ b/crypto/src/crypto/engines/RSACoreEngine.cs @@ -124,7 +124,7 @@ namespace Org.BouncyCastle.Crypto.Engines // RsaPrivateCrtKeyParameters crtKey = (RsaPrivateCrtKeyParameters)key; - BigInteger p = crtKey.P;; + BigInteger p = crtKey.P; BigInteger q = crtKey.Q; BigInteger dP = crtKey.DP; BigInteger dQ = crtKey.DQ; diff --git a/crypto/src/openpgp/PgpEncryptedData.cs b/crypto/src/openpgp/PgpEncryptedData.cs index 0d237b56c..558e0b8a2 100644 --- a/crypto/src/openpgp/PgpEncryptedData.cs +++ b/crypto/src/openpgp/PgpEncryptedData.cs @@ -81,7 +81,7 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp Array.Copy(lookAhead, bufStart, buf, pos, len); bufStart += len; - return pos + len - off;; + return pos + len - off; } internal byte[] GetLookAhead() diff --git a/crypto/src/openpgp/PgpPublicKeyRing.cs b/crypto/src/openpgp/PgpPublicKeyRing.cs index 7b1ac93bf..92464d64f 100644 --- a/crypto/src/openpgp/PgpPublicKeyRing.cs +++ b/crypto/src/openpgp/PgpPublicKeyRing.cs @@ -45,7 +45,7 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp + "tag 0x" + ((int)initialTag).ToString("X")); } - PublicKeyPacket pubPk = (PublicKeyPacket) bcpgInput.ReadPacket();; + PublicKeyPacket pubPk = (PublicKeyPacket) bcpgInput.ReadPacket(); TrustPacket trustPk = ReadOptionalTrustPacket(bcpgInput); // direct signatures and revocations -- cgit 1.5.1 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/Asn1OctetString.cs | 2 +- crypto/src/asn1/Asn1Sequence.cs | 4 ++-- crypto/src/asn1/Asn1Set.cs | 4 ++-- crypto/src/asn1/Asn1TaggedObject.cs | 2 +- crypto/src/asn1/BerTaggedObject.cs | 2 +- crypto/src/asn1/DerBMPString.cs | 4 +++- crypto/src/asn1/DerBitString.cs | 2 +- crypto/src/asn1/DerBoolean.cs | 4 +++- crypto/src/asn1/DerEnumerated.cs | 2 +- crypto/src/asn1/DerGeneralString.cs | 2 +- crypto/src/asn1/DerGeneralizedTime.cs | 2 +- crypto/src/asn1/DerIA5String.cs | 2 +- crypto/src/asn1/DerInteger.cs | 2 +- crypto/src/asn1/DerNumericString.cs | 2 +- crypto/src/asn1/DerObjectIdentifier.cs | 2 +- crypto/src/asn1/DerPrintableString.cs | 2 +- crypto/src/asn1/DerT61String.cs | 2 +- crypto/src/asn1/DerUTCTime.cs | 2 +- crypto/src/asn1/DerUTF8String.cs | 4 +++- crypto/src/asn1/DerUniversalString.cs | 2 +- crypto/src/asn1/DerVisibleString.cs | 2 +- crypto/src/asn1/cmp/CAKeyUpdAnnContent.cs | 4 +++- crypto/src/asn1/cmp/CertConfirmContent.cs | 4 +++- crypto/src/asn1/cmp/CertOrEncCert.cs | 3 ++- crypto/src/asn1/cmp/CertRepMessage.cs | 4 +++- crypto/src/asn1/cmp/CertResponse.cs | 4 +++- crypto/src/asn1/cmp/CertStatus.cs | 3 ++- crypto/src/asn1/cmp/CertifiedKeyPair.cs | 3 ++- crypto/src/asn1/cmp/Challenge.cs | 3 ++- crypto/src/asn1/cmp/CmpCertificate.cs | 3 ++- crypto/src/asn1/cmp/CrlAnnContent.cs | 3 ++- crypto/src/asn1/cmp/ErrorMsgContent.cs | 4 +++- crypto/src/asn1/cmp/GenMsgContent.cs | 4 +++- crypto/src/asn1/cmp/GenRepContent.cs | 4 +++- crypto/src/asn1/cmp/InfoTypeAndValue.cs | 4 +++- crypto/src/asn1/cmp/KeyRecRepContent.cs | 4 +++- crypto/src/asn1/cmp/OobCertHash.cs | 3 ++- crypto/src/asn1/cmp/PKIBody.cs | 3 ++- crypto/src/asn1/cmp/PKIConfirmContent.cs | 4 +++- crypto/src/asn1/cmp/PKIFreeText.cs | 4 +++- crypto/src/asn1/cmp/PKIHeader.cs | 3 ++- crypto/src/asn1/cmp/PKIMessages.cs | 4 +++- crypto/src/asn1/cmp/PKIStatus.cs | 3 ++- crypto/src/asn1/cmp/PKIStatusInfo.cs | 3 ++- crypto/src/asn1/cmp/PbmParameter.cs | 3 ++- crypto/src/asn1/cmp/PollRepContent.cs | 4 +++- crypto/src/asn1/cmp/PollReqContent.cs | 4 +++- crypto/src/asn1/cmp/PopoDecKeyChallContent.cs | 4 +++- crypto/src/asn1/cmp/PopoDecKeyRespContent.cs | 4 +++- crypto/src/asn1/cmp/ProtectedPart.cs | 4 +++- crypto/src/asn1/cmp/RevAnnContent.cs | 3 ++- crypto/src/asn1/cmp/RevDetails.cs | 3 ++- crypto/src/asn1/cmp/RevRepContent.cs | 3 ++- crypto/src/asn1/cmp/RevReqContent.cs | 4 +++- crypto/src/asn1/cms/Attribute.cs | 4 ++-- crypto/src/asn1/cms/AuthEnvelopedData.cs | 4 +++- crypto/src/asn1/cms/AuthenticatedData.cs | 3 ++- crypto/src/asn1/cms/CompressedData.cs | 4 ++-- crypto/src/asn1/cms/ContentInfo.cs | 4 ++-- crypto/src/asn1/cms/EncryptedContentInfo.cs | 4 ++-- crypto/src/asn1/cms/EncryptedData.cs | 4 +++- crypto/src/asn1/cms/Evidence.cs | 4 +++- crypto/src/asn1/cms/KEKIdentifier.cs | 4 ++-- crypto/src/asn1/cms/KEKRecipientInfo.cs | 4 ++-- crypto/src/asn1/cms/KeyAgreeRecipientIdentifier.cs | 4 +++- crypto/src/asn1/cms/KeyAgreeRecipientInfo.cs | 4 ++-- crypto/src/asn1/cms/KeyTransRecipientInfo.cs | 4 ++-- crypto/src/asn1/cms/OriginatorIdentifierOrKey.cs | 4 ++-- crypto/src/asn1/cms/OriginatorInfo.cs | 4 ++-- crypto/src/asn1/cms/OriginatorPublicKey.cs | 4 ++-- crypto/src/asn1/cms/OtherKeyAttribute.cs | 4 ++-- crypto/src/asn1/cms/PasswordRecipientInfo.cs | 4 ++-- crypto/src/asn1/cms/RecipientEncryptedKey.cs | 4 +++- crypto/src/asn1/cms/RecipientIdentifier.cs | 4 ++-- crypto/src/asn1/cms/RecipientInfo.cs | 4 ++-- crypto/src/asn1/cms/RecipientKeyIdentifier.cs | 4 ++-- crypto/src/asn1/cms/SignedData.cs | 4 ++-- crypto/src/asn1/cms/SignedDataParser.cs | 4 +++- crypto/src/asn1/cms/SignerIdentifier.cs | 4 ++-- crypto/src/asn1/cms/SignerInfo.cs | 4 ++-- crypto/src/asn1/cms/Time.cs | 4 +++- crypto/src/asn1/cms/ecc/MQVuserKeyingMaterial.cs | 4 +++- 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 ++- crypto/src/asn1/cryptopro/ECGOST3410ParamSetParameters.cs | 3 ++- crypto/src/asn1/cryptopro/GOST28147Parameters.cs | 4 ++-- crypto/src/asn1/cryptopro/GOST3410ParamSetParameters.cs | 4 ++-- crypto/src/asn1/cryptopro/GOST3410PublicKeyAlgParameters.cs | 4 ++-- crypto/src/asn1/esf/CertificateValues.cs | 3 ++- crypto/src/asn1/esf/CommitmentTypeIndication.cs | 4 ++-- crypto/src/asn1/esf/CommitmentTypeQualifier.cs | 4 ++-- crypto/src/asn1/esf/CompleteCertificateRefs.cs | 3 ++- crypto/src/asn1/esf/CompleteRevocationRefs.cs | 3 ++- crypto/src/asn1/esf/CrlIdentifier.cs | 3 ++- crypto/src/asn1/esf/CrlListID.cs | 3 ++- crypto/src/asn1/esf/CrlOcspRef.cs | 4 +++- crypto/src/asn1/esf/CrlValidatedID.cs | 4 +++- crypto/src/asn1/esf/OcspIdentifier.cs | 3 ++- crypto/src/asn1/esf/OcspListID.cs | 3 ++- crypto/src/asn1/esf/OcspResponsesID.cs | 4 +++- crypto/src/asn1/esf/OtherCertID.cs | 3 ++- crypto/src/asn1/esf/OtherHashAlgAndValue.cs | 3 ++- crypto/src/asn1/esf/OtherRevRefs.cs | 4 +++- crypto/src/asn1/esf/OtherRevVals.cs | 4 +++- crypto/src/asn1/esf/OtherSigningCertificate.cs | 3 ++- crypto/src/asn1/esf/SigPolicyQualifierInfo.cs | 4 +++- crypto/src/asn1/esf/SignaturePolicyId.cs | 3 ++- crypto/src/asn1/esf/SignaturePolicyIdentifier.cs | 4 +++- crypto/src/asn1/esf/SignerAttribute.cs | 3 ++- crypto/src/asn1/ess/ContentHints.cs | 4 +++- crypto/src/asn1/ess/ContentIdentifier.cs | 4 +++- crypto/src/asn1/ess/ESSCertID.cs | 3 ++- crypto/src/asn1/ess/OtherCertID.cs | 3 ++- crypto/src/asn1/ess/OtherSigningCertificate.cs | 3 ++- crypto/src/asn1/ess/SigningCertificate.cs | 3 ++- crypto/src/asn1/ess/SigningCertificateV2.cs | 3 ++- crypto/src/asn1/isismtt/ocsp/CertHash.cs | 3 ++- crypto/src/asn1/isismtt/ocsp/RequestedCertificate.cs | 4 +++- crypto/src/asn1/isismtt/x509/AdditionalInformationSyntax.cs | 3 ++- crypto/src/asn1/isismtt/x509/AdmissionSyntax.cs | 3 ++- crypto/src/asn1/isismtt/x509/Admissions.cs | 5 +++-- crypto/src/asn1/isismtt/x509/DeclarationOfMajority.cs | 4 +++- crypto/src/asn1/isismtt/x509/MonetaryLimit.cs | 3 ++- crypto/src/asn1/isismtt/x509/NamingAuthority.cs | 9 +++++---- crypto/src/asn1/isismtt/x509/ProcurationSyntax.cs | 3 ++- crypto/src/asn1/isismtt/x509/ProfessionInfo.cs | 9 +++++---- crypto/src/asn1/isismtt/x509/Restriction.cs | 3 ++- crypto/src/asn1/mozilla/PublicKeyAndChallenge.cs | 3 ++- crypto/src/asn1/ocsp/BasicOCSPResponse.cs | 3 ++- crypto/src/asn1/ocsp/CertID.cs | 3 ++- crypto/src/asn1/ocsp/CertStatus.cs | 4 ++-- crypto/src/asn1/ocsp/OCSPRequest.cs | 4 ++-- crypto/src/asn1/ocsp/OCSPResponse.cs | 4 ++-- crypto/src/asn1/ocsp/Request.cs | 3 ++- crypto/src/asn1/ocsp/ResponseBytes.cs | 4 ++-- crypto/src/asn1/ocsp/ResponseData.cs | 4 ++-- crypto/src/asn1/ocsp/RevokedInfo.cs | 4 ++-- crypto/src/asn1/ocsp/ServiceLocator.cs | 4 ++-- crypto/src/asn1/ocsp/Signature.cs | 4 ++-- crypto/src/asn1/ocsp/SingleResponse.cs | 8 ++++---- crypto/src/asn1/ocsp/TBSRequest.cs | 8 ++++---- crypto/src/asn1/pkcs/Attribute.cs | 4 ++-- crypto/src/asn1/pkcs/CertificationRequestInfo.cs | 3 ++- crypto/src/asn1/pkcs/EncryptedData.cs | 3 ++- crypto/src/asn1/pkcs/EncryptedPrivateKeyInfo.cs | 3 ++- crypto/src/asn1/pkcs/EncryptionScheme.cs | 4 ++-- crypto/src/asn1/pkcs/IssuerAndSerialNumber.cs | 3 ++- crypto/src/asn1/pkcs/MacData.cs | 4 ++-- crypto/src/asn1/pkcs/PBEParameter.cs | 4 ++-- crypto/src/asn1/pkcs/PBKDF2Params.cs | 4 +++- crypto/src/asn1/pkcs/PKCS12PBEParams.cs | 4 ++-- crypto/src/asn1/pkcs/RC2CBCParameter.cs | 3 +-- crypto/src/asn1/pkcs/RSAESOAEPparams.cs | 3 ++- crypto/src/asn1/pkcs/RSASSAPSSparams.cs | 3 ++- crypto/src/asn1/pkcs/SignerInfo.cs | 4 ++-- crypto/src/asn1/smime/SMIMECapabilities.cs | 2 +- crypto/src/asn1/tsp/Accuracy.cs | 4 +++- crypto/src/asn1/tsp/MessageImprint.cs | 3 ++- crypto/src/asn1/tsp/TSTInfo.cs | 3 ++- crypto/src/asn1/tsp/TimeStampReq.cs | 3 ++- crypto/src/asn1/tsp/TimeStampResp.cs | 4 ++-- crypto/src/asn1/x500/DirectoryString.cs | 4 +++- crypto/src/asn1/x509/AccessDescription.cs | 4 +++- crypto/src/asn1/x509/AttCertIssuer.cs | 4 ++-- crypto/src/asn1/x509/AttCertValidityPeriod.cs | 4 ++-- crypto/src/asn1/x509/Attribute.cs | 4 ++-- crypto/src/asn1/x509/AttributeCertificateInfo.cs | 4 ++-- crypto/src/asn1/x509/AuthorityKeyIdentifier.cs | 4 ++-- crypto/src/asn1/x509/BasicConstraints.cs | 4 ++-- crypto/src/asn1/x509/CRLDistPoint.cs | 2 +- crypto/src/asn1/x509/CertificatePair.cs | 4 +++- crypto/src/asn1/x509/DSAParameter.cs | 3 ++- crypto/src/asn1/x509/DigestInfo.cs | 4 +++- crypto/src/asn1/x509/DisplayText.cs | 4 +++- crypto/src/asn1/x509/DistributionPoint.cs | 2 +- crypto/src/asn1/x509/DistributionPointName.cs | 2 +- crypto/src/asn1/x509/ExtendedKeyUsage.cs | 2 +- crypto/src/asn1/x509/GeneralName.cs | 2 +- crypto/src/asn1/x509/GeneralNames.cs | 2 +- crypto/src/asn1/x509/Holder.cs | 4 +++- crypto/src/asn1/x509/IssuerSerial.cs | 4 +++- crypto/src/asn1/x509/IssuingDistributionPoint.cs | 2 +- crypto/src/asn1/x509/NameConstraints.cs | 4 +++- crypto/src/asn1/x509/ObjectDigestInfo.cs | 4 +++- crypto/src/asn1/x509/PrivateKeyUsagePeriod.cs | 4 +++- crypto/src/asn1/x509/RSAPublicKeyStructure.cs | 9 +++++---- crypto/src/asn1/x509/SubjectDirectoryAttributes.cs | 2 +- crypto/src/asn1/x509/SubjectKeyIdentifier.cs | 3 ++- crypto/src/asn1/x509/TBSCertList.cs | 3 ++- crypto/src/asn1/x509/Target.cs | 4 +++- crypto/src/asn1/x509/TargetInformation.cs | 4 +++- crypto/src/asn1/x509/Targets.cs | 4 +++- crypto/src/asn1/x509/Time.cs | 4 +++- crypto/src/asn1/x509/X509Extensions.cs | 2 +- crypto/src/asn1/x509/qualified/BiometricData.cs | 6 ++---- crypto/src/asn1/x509/qualified/Iso4217CurrencyCode.cs | 6 +++--- crypto/src/asn1/x509/qualified/MonetaryValue.cs | 4 ++-- crypto/src/asn1/x509/qualified/QCStatement.cs | 5 ++--- crypto/src/asn1/x509/qualified/SemanticsInformation.cs | 4 ++-- crypto/src/asn1/x509/qualified/TypeOfBiometricData.cs | 4 ++-- crypto/src/asn1/x509/sigi/NameOrPseudonym.cs | 5 +++-- crypto/src/asn1/x509/sigi/PersonalData.cs | 3 ++- crypto/src/asn1/x9/DHDomainParameters.cs | 4 +++- crypto/src/asn1/x9/DHPublicKey.cs | 4 +++- crypto/src/asn1/x9/DHValidationParms.cs | 4 +++- crypto/src/crypto/engines/AesEngine.cs | 4 +++- crypto/src/crypto/engines/AesFastEngine.cs | 4 +++- crypto/src/crypto/engines/AesLightEngine.cs | 4 +++- crypto/src/crypto/engines/BlowfishEngine.cs | 3 ++- crypto/src/crypto/engines/Cast5Engine.cs | 3 ++- crypto/src/crypto/engines/DesEdeEngine.cs | 3 ++- crypto/src/crypto/engines/DesEngine.cs | 3 ++- crypto/src/crypto/engines/GOST28147Engine.cs | 3 ++- crypto/src/crypto/engines/HC128Engine.cs | 3 ++- crypto/src/crypto/engines/HC256Engine.cs | 3 ++- crypto/src/crypto/engines/ISAACEngine.cs | 3 ++- crypto/src/crypto/engines/IdeaEngine.cs | 3 ++- crypto/src/crypto/engines/NoekeonEngine.cs | 4 +++- crypto/src/crypto/engines/RC2Engine.cs | 3 ++- crypto/src/crypto/engines/RC4Engine.cs | 3 ++- crypto/src/crypto/engines/RC532Engine.cs | 3 ++- crypto/src/crypto/engines/RC564Engine.cs | 3 ++- crypto/src/crypto/engines/RC6Engine.cs | 3 ++- crypto/src/crypto/engines/RijndaelEngine.cs | 3 ++- crypto/src/crypto/engines/SerpentEngineBase.cs | 3 ++- crypto/src/crypto/engines/SkipjackEngine.cs | 3 ++- crypto/src/crypto/engines/TEAEngine.cs | 3 ++- crypto/src/crypto/engines/ThreefishEngine.cs | 3 ++- crypto/src/crypto/engines/TwofishEngine.cs | 3 ++- crypto/src/crypto/engines/XTEAEngine.cs | 3 ++- crypto/src/crypto/macs/GOST28147Mac.cs | 3 ++- crypto/src/crypto/macs/SkeinMac.cs | 3 ++- crypto/src/crypto/tls/DefaultTlsAgreementCredentials.cs | 2 +- crypto/src/crypto/tls/DefaultTlsEncryptionCredentials.cs | 3 ++- crypto/src/crypto/tls/DefaultTlsSignerCredentials.cs | 3 ++- crypto/src/openpgp/PgpPublicKeyRingBundle.cs | 2 +- crypto/src/openpgp/PgpSecretKeyRingBundle.cs | 3 +-- crypto/src/openssl/MiscPemGenerator.cs | 7 +++---- crypto/src/pkcs/PrivateKeyInfoFactory.cs | 2 +- crypto/src/pkix/PkixCertPathBuilder.cs | 2 +- crypto/src/pkix/PkixParameters.cs | 2 +- crypto/src/util/Platform.cs | 5 +++++ crypto/src/x509/SubjectPublicKeyInfoFactory.cs | 5 +---- 252 files changed, 559 insertions(+), 333 deletions(-) (limited to 'crypto/src/openpgp') diff --git a/crypto/src/asn1/Asn1OctetString.cs b/crypto/src/asn1/Asn1OctetString.cs index 9c738a8f2..73b6e51bf 100644 --- a/crypto/src/asn1/Asn1OctetString.cs +++ b/crypto/src/asn1/Asn1OctetString.cs @@ -52,7 +52,7 @@ namespace Org.BouncyCastle.Asn1 if (obj is Asn1TaggedObject) return GetInstance(((Asn1TaggedObject)obj).GetObject()); - throw new ArgumentException("illegal object in GetInstance: " + obj.GetType().Name); + throw new ArgumentException("illegal object in GetInstance: " + Platform.GetTypeName(obj)); } /** diff --git a/crypto/src/asn1/Asn1Sequence.cs b/crypto/src/asn1/Asn1Sequence.cs index 5f9ea4460..849f5e308 100644 --- a/crypto/src/asn1/Asn1Sequence.cs +++ b/crypto/src/asn1/Asn1Sequence.cs @@ -50,7 +50,7 @@ namespace Org.BouncyCastle.Asn1 } } - throw new ArgumentException("Unknown object in GetInstance: " + obj.GetType().FullName, "obj"); + throw new ArgumentException("Unknown object in GetInstance: " + Platform.GetTypeName(obj), "obj"); } /** @@ -103,7 +103,7 @@ namespace Org.BouncyCastle.Asn1 return (Asn1Sequence) inner; } - throw new ArgumentException("Unknown object in GetInstance: " + obj.GetType().FullName, "obj"); + throw new ArgumentException("Unknown object in GetInstance: " + Platform.GetTypeName(obj), "obj"); } protected internal Asn1Sequence( diff --git a/crypto/src/asn1/Asn1Set.cs b/crypto/src/asn1/Asn1Set.cs index 18f8020f2..bf83dbdc1 100644 --- a/crypto/src/asn1/Asn1Set.cs +++ b/crypto/src/asn1/Asn1Set.cs @@ -55,7 +55,7 @@ namespace Org.BouncyCastle.Asn1 } } - throw new ArgumentException("Unknown object in GetInstance: " + obj.GetType().FullName, "obj"); + throw new ArgumentException("Unknown object in GetInstance: " + Platform.GetTypeName(obj), "obj"); } /** @@ -121,7 +121,7 @@ namespace Org.BouncyCastle.Asn1 return new DerSet(v, false); } - throw new ArgumentException("Unknown object in GetInstance: " + obj.GetType().FullName, "obj"); + throw new ArgumentException("Unknown object in GetInstance: " + Platform.GetTypeName(obj), "obj"); } protected internal Asn1Set( diff --git a/crypto/src/asn1/Asn1TaggedObject.cs b/crypto/src/asn1/Asn1TaggedObject.cs index 2e480738a..fdf5b651a 100644 --- a/crypto/src/asn1/Asn1TaggedObject.cs +++ b/crypto/src/asn1/Asn1TaggedObject.cs @@ -37,7 +37,7 @@ namespace Org.BouncyCastle.Asn1 return (Asn1TaggedObject) obj; } - throw new ArgumentException("Unknown object in GetInstance: " + obj.GetType().FullName, "obj"); + throw new ArgumentException("Unknown object in GetInstance: " + Platform.GetTypeName(obj), "obj"); } /** diff --git a/crypto/src/asn1/BerTaggedObject.cs b/crypto/src/asn1/BerTaggedObject.cs index 228b136cb..fd0bdc285 100644 --- a/crypto/src/asn1/BerTaggedObject.cs +++ b/crypto/src/asn1/BerTaggedObject.cs @@ -82,7 +82,7 @@ namespace Org.BouncyCastle.Asn1 } else { - throw Platform.CreateNotImplementedException(obj.GetType().Name); + throw Platform.CreateNotImplementedException(Platform.GetTypeName(obj)); } foreach (Asn1Encodable o in eObj) diff --git a/crypto/src/asn1/DerBMPString.cs b/crypto/src/asn1/DerBMPString.cs index 4f7e0a635..33d950ff8 100644 --- a/crypto/src/asn1/DerBMPString.cs +++ b/crypto/src/asn1/DerBMPString.cs @@ -1,5 +1,7 @@ using System; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1 { /** @@ -24,7 +26,7 @@ namespace Org.BouncyCastle.Asn1 return (DerBmpString)obj; } - throw new ArgumentException("illegal object in GetInstance: " + obj.GetType().Name); + throw new ArgumentException("illegal object in GetInstance: " + Platform.GetTypeName(obj)); } /** diff --git a/crypto/src/asn1/DerBitString.cs b/crypto/src/asn1/DerBitString.cs index fa37e6c0c..a3c2cee01 100644 --- a/crypto/src/asn1/DerBitString.cs +++ b/crypto/src/asn1/DerBitString.cs @@ -29,7 +29,7 @@ namespace Org.BouncyCastle.Asn1 return (DerBitString) obj; } - throw new ArgumentException("illegal object in GetInstance: " + obj.GetType().Name); + throw new ArgumentException("illegal object in GetInstance: " + Platform.GetTypeName(obj)); } /** diff --git a/crypto/src/asn1/DerBoolean.cs b/crypto/src/asn1/DerBoolean.cs index 66791d16c..709f4ddce 100644 --- a/crypto/src/asn1/DerBoolean.cs +++ b/crypto/src/asn1/DerBoolean.cs @@ -1,5 +1,7 @@ using System; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1 { public class DerBoolean @@ -23,7 +25,7 @@ namespace Org.BouncyCastle.Asn1 return (DerBoolean) obj; } - throw new ArgumentException("illegal object in GetInstance: " + obj.GetType().Name); + throw new ArgumentException("illegal object in GetInstance: " + Platform.GetTypeName(obj)); } /** diff --git a/crypto/src/asn1/DerEnumerated.cs b/crypto/src/asn1/DerEnumerated.cs index 2638b0205..476b7fa9a 100644 --- a/crypto/src/asn1/DerEnumerated.cs +++ b/crypto/src/asn1/DerEnumerated.cs @@ -23,7 +23,7 @@ namespace Org.BouncyCastle.Asn1 return (DerEnumerated)obj; } - throw new ArgumentException("illegal object in GetInstance: " + obj.GetType().Name); + throw new ArgumentException("illegal object in GetInstance: " + Platform.GetTypeName(obj)); } /** diff --git a/crypto/src/asn1/DerGeneralString.cs b/crypto/src/asn1/DerGeneralString.cs index 0e20b53bd..553b0e09c 100644 --- a/crypto/src/asn1/DerGeneralString.cs +++ b/crypto/src/asn1/DerGeneralString.cs @@ -19,7 +19,7 @@ namespace Org.BouncyCastle.Asn1 } throw new ArgumentException("illegal object in GetInstance: " - + obj.GetType().Name); + + Platform.GetTypeName(obj)); } public static DerGeneralString GetInstance( diff --git a/crypto/src/asn1/DerGeneralizedTime.cs b/crypto/src/asn1/DerGeneralizedTime.cs index 79b008768..b224ebe42 100644 --- a/crypto/src/asn1/DerGeneralizedTime.cs +++ b/crypto/src/asn1/DerGeneralizedTime.cs @@ -27,7 +27,7 @@ namespace Org.BouncyCastle.Asn1 return (DerGeneralizedTime)obj; } - throw new ArgumentException("illegal object in GetInstance: " + obj.GetType().Name, "obj"); + throw new ArgumentException("illegal object in GetInstance: " + Platform.GetTypeName(obj), "obj"); } /** diff --git a/crypto/src/asn1/DerIA5String.cs b/crypto/src/asn1/DerIA5String.cs index 9fa2cba3c..63e91582e 100644 --- a/crypto/src/asn1/DerIA5String.cs +++ b/crypto/src/asn1/DerIA5String.cs @@ -26,7 +26,7 @@ namespace Org.BouncyCastle.Asn1 return (DerIA5String)obj; } - throw new ArgumentException("illegal object in GetInstance: " + obj.GetType().Name); + throw new ArgumentException("illegal object in GetInstance: " + Platform.GetTypeName(obj)); } /** diff --git a/crypto/src/asn1/DerInteger.cs b/crypto/src/asn1/DerInteger.cs index eb0614515..3610de588 100644 --- a/crypto/src/asn1/DerInteger.cs +++ b/crypto/src/asn1/DerInteger.cs @@ -23,7 +23,7 @@ namespace Org.BouncyCastle.Asn1 return (DerInteger)obj; } - throw new ArgumentException("illegal object in GetInstance: " + obj.GetType().Name); + throw new ArgumentException("illegal object in GetInstance: " + Platform.GetTypeName(obj)); } /** diff --git a/crypto/src/asn1/DerNumericString.cs b/crypto/src/asn1/DerNumericString.cs index 6e2715a4d..a729f9e8e 100644 --- a/crypto/src/asn1/DerNumericString.cs +++ b/crypto/src/asn1/DerNumericString.cs @@ -26,7 +26,7 @@ namespace Org.BouncyCastle.Asn1 return (DerNumericString)obj; } - throw new ArgumentException("illegal object in GetInstance: " + obj.GetType().Name); + throw new ArgumentException("illegal object in GetInstance: " + Platform.GetTypeName(obj)); } /** diff --git a/crypto/src/asn1/DerObjectIdentifier.cs b/crypto/src/asn1/DerObjectIdentifier.cs index 563c637e5..6ac2b7e9e 100644 --- a/crypto/src/asn1/DerObjectIdentifier.cs +++ b/crypto/src/asn1/DerObjectIdentifier.cs @@ -26,7 +26,7 @@ namespace Org.BouncyCastle.Asn1 return (DerObjectIdentifier) obj; if (obj is byte[]) return FromOctetString((byte[])obj); - throw new ArgumentException("illegal object in GetInstance: " + obj.GetType().Name, "obj"); + throw new ArgumentException("illegal object in GetInstance: " + Platform.GetTypeName(obj), "obj"); } /** diff --git a/crypto/src/asn1/DerPrintableString.cs b/crypto/src/asn1/DerPrintableString.cs index cd2f46b48..e1797346d 100644 --- a/crypto/src/asn1/DerPrintableString.cs +++ b/crypto/src/asn1/DerPrintableString.cs @@ -26,7 +26,7 @@ namespace Org.BouncyCastle.Asn1 return (DerPrintableString)obj; } - throw new ArgumentException("illegal object in GetInstance: " + obj.GetType().Name); + throw new ArgumentException("illegal object in GetInstance: " + Platform.GetTypeName(obj)); } /** diff --git a/crypto/src/asn1/DerT61String.cs b/crypto/src/asn1/DerT61String.cs index 4dee6f30c..746ccfe70 100644 --- a/crypto/src/asn1/DerT61String.cs +++ b/crypto/src/asn1/DerT61String.cs @@ -25,7 +25,7 @@ namespace Org.BouncyCastle.Asn1 return (DerT61String)obj; } - throw new ArgumentException("illegal object in GetInstance: " + obj.GetType().Name); + throw new ArgumentException("illegal object in GetInstance: " + Platform.GetTypeName(obj)); } /** diff --git a/crypto/src/asn1/DerUTCTime.cs b/crypto/src/asn1/DerUTCTime.cs index 639a2d4f4..99af8bf6b 100644 --- a/crypto/src/asn1/DerUTCTime.cs +++ b/crypto/src/asn1/DerUTCTime.cs @@ -27,7 +27,7 @@ namespace Org.BouncyCastle.Asn1 return (DerUtcTime)obj; } - throw new ArgumentException("illegal object in GetInstance: " + obj.GetType().Name); + throw new ArgumentException("illegal object in GetInstance: " + Platform.GetTypeName(obj)); } /** diff --git a/crypto/src/asn1/DerUTF8String.cs b/crypto/src/asn1/DerUTF8String.cs index 92a50e824..758a5068d 100644 --- a/crypto/src/asn1/DerUTF8String.cs +++ b/crypto/src/asn1/DerUTF8String.cs @@ -1,6 +1,8 @@ using System; using System.Text; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1 { /** @@ -24,7 +26,7 @@ namespace Org.BouncyCastle.Asn1 return (DerUtf8String)obj; } - throw new ArgumentException("illegal object in GetInstance: " + obj.GetType().Name); + throw new ArgumentException("illegal object in GetInstance: " + Platform.GetTypeName(obj)); } /** diff --git a/crypto/src/asn1/DerUniversalString.cs b/crypto/src/asn1/DerUniversalString.cs index 305102f2f..284d0f8c5 100644 --- a/crypto/src/asn1/DerUniversalString.cs +++ b/crypto/src/asn1/DerUniversalString.cs @@ -28,7 +28,7 @@ namespace Org.BouncyCastle.Asn1 return (DerUniversalString)obj; } - throw new ArgumentException("illegal object in GetInstance: " + obj.GetType().Name); + throw new ArgumentException("illegal object in GetInstance: " + Platform.GetTypeName(obj)); } /** diff --git a/crypto/src/asn1/DerVisibleString.cs b/crypto/src/asn1/DerVisibleString.cs index 84c9caade..e1112201a 100644 --- a/crypto/src/asn1/DerVisibleString.cs +++ b/crypto/src/asn1/DerVisibleString.cs @@ -36,7 +36,7 @@ namespace Org.BouncyCastle.Asn1 return GetInstance(((Asn1TaggedObject)obj).GetObject()); } - throw new ArgumentException("illegal object in GetInstance: " + obj.GetType().Name); + throw new ArgumentException("illegal object in GetInstance: " + Platform.GetTypeName(obj)); } /** diff --git a/crypto/src/asn1/cmp/CAKeyUpdAnnContent.cs b/crypto/src/asn1/cmp/CAKeyUpdAnnContent.cs index 3cdb128a6..b74bac87a 100644 --- a/crypto/src/asn1/cmp/CAKeyUpdAnnContent.cs +++ b/crypto/src/asn1/cmp/CAKeyUpdAnnContent.cs @@ -1,5 +1,7 @@ using System; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1.Cmp { public class CAKeyUpdAnnContent @@ -24,7 +26,7 @@ namespace Org.BouncyCastle.Asn1.Cmp if (obj is Asn1Sequence) return new CAKeyUpdAnnContent((Asn1Sequence)obj); - throw new ArgumentException("Invalid object: " + obj.GetType().Name, "obj"); + throw new ArgumentException("Invalid object: " + Platform.GetTypeName(obj), "obj"); } public virtual CmpCertificate OldWithNew diff --git a/crypto/src/asn1/cmp/CertConfirmContent.cs b/crypto/src/asn1/cmp/CertConfirmContent.cs index f4016d8d8..370a9e7d6 100644 --- a/crypto/src/asn1/cmp/CertConfirmContent.cs +++ b/crypto/src/asn1/cmp/CertConfirmContent.cs @@ -1,5 +1,7 @@ using System; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1.Cmp { public class CertConfirmContent @@ -20,7 +22,7 @@ namespace Org.BouncyCastle.Asn1.Cmp if (obj is Asn1Sequence) return new CertConfirmContent((Asn1Sequence)obj); - throw new ArgumentException("Invalid object: " + obj.GetType().Name, "obj"); + throw new ArgumentException("Invalid object: " + Platform.GetTypeName(obj), "obj"); } public virtual CertStatus[] ToCertStatusArray() diff --git a/crypto/src/asn1/cmp/CertOrEncCert.cs b/crypto/src/asn1/cmp/CertOrEncCert.cs index 4c049c180..eb200e1e8 100644 --- a/crypto/src/asn1/cmp/CertOrEncCert.cs +++ b/crypto/src/asn1/cmp/CertOrEncCert.cs @@ -1,6 +1,7 @@ using System; using Org.BouncyCastle.Asn1.Crmf; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Cmp { @@ -34,7 +35,7 @@ namespace Org.BouncyCastle.Asn1.Cmp if (obj is Asn1TaggedObject) return new CertOrEncCert((Asn1TaggedObject)obj); - throw new ArgumentException("Invalid object: " + obj.GetType().Name, "obj"); + throw new ArgumentException("Invalid object: " + Platform.GetTypeName(obj), "obj"); } public CertOrEncCert(CmpCertificate certificate) diff --git a/crypto/src/asn1/cmp/CertRepMessage.cs b/crypto/src/asn1/cmp/CertRepMessage.cs index c22b079c8..82869784d 100644 --- a/crypto/src/asn1/cmp/CertRepMessage.cs +++ b/crypto/src/asn1/cmp/CertRepMessage.cs @@ -1,5 +1,7 @@ using System; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1.Cmp { public class CertRepMessage @@ -28,7 +30,7 @@ namespace Org.BouncyCastle.Asn1.Cmp if (obj is Asn1Sequence) return new CertRepMessage((Asn1Sequence)obj); - throw new ArgumentException("Invalid object: " + obj.GetType().Name, "obj"); + throw new ArgumentException("Invalid object: " + Platform.GetTypeName(obj), "obj"); } public CertRepMessage(CmpCertificate[] caPubs, CertResponse[] response) diff --git a/crypto/src/asn1/cmp/CertResponse.cs b/crypto/src/asn1/cmp/CertResponse.cs index 80813b8b7..843fd9299 100644 --- a/crypto/src/asn1/cmp/CertResponse.cs +++ b/crypto/src/asn1/cmp/CertResponse.cs @@ -1,5 +1,7 @@ using System; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1.Cmp { public class CertResponse @@ -45,7 +47,7 @@ namespace Org.BouncyCastle.Asn1.Cmp if (obj is Asn1Sequence) return new CertResponse((Asn1Sequence)obj); - throw new ArgumentException("Invalid object: " + obj.GetType().Name, "obj"); + throw new ArgumentException("Invalid object: " + Platform.GetTypeName(obj), "obj"); } public CertResponse( diff --git a/crypto/src/asn1/cmp/CertStatus.cs b/crypto/src/asn1/cmp/CertStatus.cs index 52d5ac504..d437b57b2 100644 --- a/crypto/src/asn1/cmp/CertStatus.cs +++ b/crypto/src/asn1/cmp/CertStatus.cs @@ -1,6 +1,7 @@ using System; using Org.BouncyCastle.Math; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Cmp { @@ -43,7 +44,7 @@ namespace Org.BouncyCastle.Asn1.Cmp if (obj is Asn1Sequence) return new CertStatus((Asn1Sequence)obj); - throw new ArgumentException("Invalid object: " + obj.GetType().Name, "obj"); + throw new ArgumentException("Invalid object: " + Platform.GetTypeName(obj), "obj"); } public virtual Asn1OctetString CertHash diff --git a/crypto/src/asn1/cmp/CertifiedKeyPair.cs b/crypto/src/asn1/cmp/CertifiedKeyPair.cs index 655dde0c5..c06f00019 100644 --- a/crypto/src/asn1/cmp/CertifiedKeyPair.cs +++ b/crypto/src/asn1/cmp/CertifiedKeyPair.cs @@ -1,6 +1,7 @@ using System; using Org.BouncyCastle.Asn1.Crmf; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Cmp { @@ -45,7 +46,7 @@ namespace Org.BouncyCastle.Asn1.Cmp if (obj is Asn1Sequence) return new CertifiedKeyPair((Asn1Sequence)obj); - throw new ArgumentException("Invalid object: " + obj.GetType().Name, "obj"); + throw new ArgumentException("Invalid object: " + Platform.GetTypeName(obj), "obj"); } public CertifiedKeyPair( diff --git a/crypto/src/asn1/cmp/Challenge.cs b/crypto/src/asn1/cmp/Challenge.cs index bee5f96f5..5c78c2a2b 100644 --- a/crypto/src/asn1/cmp/Challenge.cs +++ b/crypto/src/asn1/cmp/Challenge.cs @@ -1,6 +1,7 @@ using System; using Org.BouncyCastle.Asn1.X509; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Cmp { @@ -32,7 +33,7 @@ namespace Org.BouncyCastle.Asn1.Cmp if (obj is Asn1Sequence) return new Challenge((Asn1Sequence)obj); - throw new ArgumentException("Invalid object: " + obj.GetType().Name, "obj"); + throw new ArgumentException("Invalid object: " + Platform.GetTypeName(obj), "obj"); } public virtual AlgorithmIdentifier Owf diff --git a/crypto/src/asn1/cmp/CmpCertificate.cs b/crypto/src/asn1/cmp/CmpCertificate.cs index 16ee30059..33356b486 100644 --- a/crypto/src/asn1/cmp/CmpCertificate.cs +++ b/crypto/src/asn1/cmp/CmpCertificate.cs @@ -1,6 +1,7 @@ using System; using Org.BouncyCastle.Asn1.X509; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Cmp { @@ -37,7 +38,7 @@ namespace Org.BouncyCastle.Asn1.Cmp if (obj is Asn1TaggedObject) return new CmpCertificate(AttributeCertificate.GetInstance(((Asn1TaggedObject)obj).GetObject())); - throw new ArgumentException("Invalid object: " + obj.GetType().Name, "obj"); + throw new ArgumentException("Invalid object: " + Platform.GetTypeName(obj), "obj"); } public virtual bool IsX509v3PKCert diff --git a/crypto/src/asn1/cmp/CrlAnnContent.cs b/crypto/src/asn1/cmp/CrlAnnContent.cs index 3dc11d32c..db8ecfa40 100644 --- a/crypto/src/asn1/cmp/CrlAnnContent.cs +++ b/crypto/src/asn1/cmp/CrlAnnContent.cs @@ -1,6 +1,7 @@ using System; using Org.BouncyCastle.Asn1.X509; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Cmp { @@ -22,7 +23,7 @@ namespace Org.BouncyCastle.Asn1.Cmp if (obj is Asn1Sequence) return new CrlAnnContent((Asn1Sequence)obj); - throw new ArgumentException("Invalid object: " + obj.GetType().Name, "obj"); + throw new ArgumentException("Invalid object: " + Platform.GetTypeName(obj), "obj"); } public virtual CertificateList[] ToCertificateListArray() diff --git a/crypto/src/asn1/cmp/ErrorMsgContent.cs b/crypto/src/asn1/cmp/ErrorMsgContent.cs index 2d6353b65..5d2132bb8 100644 --- a/crypto/src/asn1/cmp/ErrorMsgContent.cs +++ b/crypto/src/asn1/cmp/ErrorMsgContent.cs @@ -1,5 +1,7 @@ using System; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1.Cmp { public class ErrorMsgContent @@ -35,7 +37,7 @@ namespace Org.BouncyCastle.Asn1.Cmp if (obj is Asn1Sequence) return new ErrorMsgContent((Asn1Sequence)obj); - throw new ArgumentException("Invalid object: " + obj.GetType().Name, "obj"); + throw new ArgumentException("Invalid object: " + Platform.GetTypeName(obj), "obj"); } public ErrorMsgContent(PkiStatusInfo pkiStatusInfo) diff --git a/crypto/src/asn1/cmp/GenMsgContent.cs b/crypto/src/asn1/cmp/GenMsgContent.cs index 9f042491c..f3142b5c6 100644 --- a/crypto/src/asn1/cmp/GenMsgContent.cs +++ b/crypto/src/asn1/cmp/GenMsgContent.cs @@ -1,5 +1,7 @@ using System; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1.Cmp { public class GenMsgContent @@ -20,7 +22,7 @@ namespace Org.BouncyCastle.Asn1.Cmp if (obj is Asn1Sequence) return new GenMsgContent((Asn1Sequence)obj); - throw new ArgumentException("Invalid object: " + obj.GetType().Name, "obj"); + throw new ArgumentException("Invalid object: " + Platform.GetTypeName(obj), "obj"); } public GenMsgContent(params InfoTypeAndValue[] itv) diff --git a/crypto/src/asn1/cmp/GenRepContent.cs b/crypto/src/asn1/cmp/GenRepContent.cs index 5bdc5550a..3c3573e37 100644 --- a/crypto/src/asn1/cmp/GenRepContent.cs +++ b/crypto/src/asn1/cmp/GenRepContent.cs @@ -1,5 +1,7 @@ using System; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1.Cmp { public class GenRepContent @@ -20,7 +22,7 @@ namespace Org.BouncyCastle.Asn1.Cmp if (obj is Asn1Sequence) return new GenRepContent((Asn1Sequence)obj); - throw new ArgumentException("Invalid object: " + obj.GetType().Name, "obj"); + throw new ArgumentException("Invalid object: " + Platform.GetTypeName(obj), "obj"); } public GenRepContent(params InfoTypeAndValue[] itv) diff --git a/crypto/src/asn1/cmp/InfoTypeAndValue.cs b/crypto/src/asn1/cmp/InfoTypeAndValue.cs index 9b51dba02..0ce6f73ba 100644 --- a/crypto/src/asn1/cmp/InfoTypeAndValue.cs +++ b/crypto/src/asn1/cmp/InfoTypeAndValue.cs @@ -1,5 +1,7 @@ using System; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1.Cmp { /** @@ -69,7 +71,7 @@ namespace Org.BouncyCastle.Asn1.Cmp if (obj is Asn1Sequence) return new InfoTypeAndValue((Asn1Sequence)obj); - throw new ArgumentException("Invalid object: " + obj.GetType().Name, "obj"); + throw new ArgumentException("Invalid object: " + Platform.GetTypeName(obj), "obj"); } public InfoTypeAndValue( diff --git a/crypto/src/asn1/cmp/KeyRecRepContent.cs b/crypto/src/asn1/cmp/KeyRecRepContent.cs index b0352f048..00c4612b9 100644 --- a/crypto/src/asn1/cmp/KeyRecRepContent.cs +++ b/crypto/src/asn1/cmp/KeyRecRepContent.cs @@ -1,5 +1,7 @@ using System; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1.Cmp { public class KeyRecRepContent @@ -43,7 +45,7 @@ namespace Org.BouncyCastle.Asn1.Cmp if (obj is Asn1Sequence) return new KeyRecRepContent((Asn1Sequence)obj); - throw new ArgumentException("Invalid object: " + obj.GetType().Name, "obj"); + throw new ArgumentException("Invalid object: " + Platform.GetTypeName(obj), "obj"); } public virtual PkiStatusInfo Status diff --git a/crypto/src/asn1/cmp/OobCertHash.cs b/crypto/src/asn1/cmp/OobCertHash.cs index 63ddff7c4..cd8192b40 100644 --- a/crypto/src/asn1/cmp/OobCertHash.cs +++ b/crypto/src/asn1/cmp/OobCertHash.cs @@ -2,6 +2,7 @@ using System; using Org.BouncyCastle.Asn1.Crmf; using Org.BouncyCastle.Asn1.X509; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Cmp { @@ -41,7 +42,7 @@ namespace Org.BouncyCastle.Asn1.Cmp if (obj is Asn1Sequence) return new OobCertHash((Asn1Sequence)obj); - throw new ArgumentException("Invalid object: " + obj.GetType().Name, "obj"); + throw new ArgumentException("Invalid object: " + Platform.GetTypeName(obj), "obj"); } public virtual AlgorithmIdentifier HashAlg diff --git a/crypto/src/asn1/cmp/PKIBody.cs b/crypto/src/asn1/cmp/PKIBody.cs index 3205a907e..f17eed64d 100644 --- a/crypto/src/asn1/cmp/PKIBody.cs +++ b/crypto/src/asn1/cmp/PKIBody.cs @@ -2,6 +2,7 @@ using System; using Org.BouncyCastle.Asn1.Crmf; using Org.BouncyCastle.Asn1.Pkcs; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Cmp { @@ -47,7 +48,7 @@ namespace Org.BouncyCastle.Asn1.Cmp if (obj is Asn1TaggedObject) return new PkiBody((Asn1TaggedObject)obj); - throw new ArgumentException("Invalid object: " + obj.GetType().Name, "obj"); + throw new ArgumentException("Invalid object: " + Platform.GetTypeName(obj), "obj"); } private PkiBody(Asn1TaggedObject tagged) diff --git a/crypto/src/asn1/cmp/PKIConfirmContent.cs b/crypto/src/asn1/cmp/PKIConfirmContent.cs index 98645766a..d154427a4 100644 --- a/crypto/src/asn1/cmp/PKIConfirmContent.cs +++ b/crypto/src/asn1/cmp/PKIConfirmContent.cs @@ -1,5 +1,7 @@ using System; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1.Cmp { public class PkiConfirmContent @@ -13,7 +15,7 @@ namespace Org.BouncyCastle.Asn1.Cmp if (obj is Asn1Null) return new PkiConfirmContent(); - throw new ArgumentException("Invalid object: " + obj.GetType().Name, "obj"); + throw new ArgumentException("Invalid object: " + Platform.GetTypeName(obj), "obj"); } public PkiConfirmContent() diff --git a/crypto/src/asn1/cmp/PKIFreeText.cs b/crypto/src/asn1/cmp/PKIFreeText.cs index 571c8d93a..fef525465 100644 --- a/crypto/src/asn1/cmp/PKIFreeText.cs +++ b/crypto/src/asn1/cmp/PKIFreeText.cs @@ -1,6 +1,8 @@ using System; using System.Collections; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1.Cmp { public class PkiFreeText @@ -27,7 +29,7 @@ namespace Org.BouncyCastle.Asn1.Cmp return new PkiFreeText((Asn1Sequence)obj); } - throw new ArgumentException("Unknown object in factory: " + obj.GetType().Name, "obj"); + throw new ArgumentException("Unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } public PkiFreeText( diff --git a/crypto/src/asn1/cmp/PKIHeader.cs b/crypto/src/asn1/cmp/PKIHeader.cs index e758e9f16..577cb45df 100644 --- a/crypto/src/asn1/cmp/PKIHeader.cs +++ b/crypto/src/asn1/cmp/PKIHeader.cs @@ -1,6 +1,7 @@ using System; using Org.BouncyCastle.Asn1.X509; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Cmp { @@ -81,7 +82,7 @@ namespace Org.BouncyCastle.Asn1.Cmp if (obj is Asn1Sequence) return new PkiHeader((Asn1Sequence)obj); - throw new ArgumentException("Invalid object: " + obj.GetType().Name, "obj"); + throw new ArgumentException("Invalid object: " + Platform.GetTypeName(obj), "obj"); } public PkiHeader( diff --git a/crypto/src/asn1/cmp/PKIMessages.cs b/crypto/src/asn1/cmp/PKIMessages.cs index ddabdf4ae..eb01e544a 100644 --- a/crypto/src/asn1/cmp/PKIMessages.cs +++ b/crypto/src/asn1/cmp/PKIMessages.cs @@ -1,5 +1,7 @@ using System; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1.Cmp { public class PkiMessages @@ -20,7 +22,7 @@ namespace Org.BouncyCastle.Asn1.Cmp if (obj is Asn1Sequence) return new PkiMessages((Asn1Sequence)obj); - throw new ArgumentException("Invalid object: " + obj.GetType().Name, "obj"); + throw new ArgumentException("Invalid object: " + Platform.GetTypeName(obj), "obj"); } public PkiMessages(params PkiMessage[] msgs) diff --git a/crypto/src/asn1/cmp/PKIStatus.cs b/crypto/src/asn1/cmp/PKIStatus.cs index b03dd3d62..ba757dfcf 100644 --- a/crypto/src/asn1/cmp/PKIStatus.cs +++ b/crypto/src/asn1/cmp/PKIStatus.cs @@ -1,6 +1,7 @@ using System; using Org.BouncyCastle.Math; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Cmp { @@ -46,7 +47,7 @@ namespace Org.BouncyCastle.Asn1.Cmp if (obj is DerInteger) return new PkiStatusEncodable((DerInteger)obj); - throw new ArgumentException("Invalid object: " + obj.GetType().Name, "obj"); + throw new ArgumentException("Invalid object: " + Platform.GetTypeName(obj), "obj"); } public virtual BigInteger Value diff --git a/crypto/src/asn1/cmp/PKIStatusInfo.cs b/crypto/src/asn1/cmp/PKIStatusInfo.cs index 2463e0081..b19bf7459 100644 --- a/crypto/src/asn1/cmp/PKIStatusInfo.cs +++ b/crypto/src/asn1/cmp/PKIStatusInfo.cs @@ -1,6 +1,7 @@ using System; using Org.BouncyCastle.Math; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Cmp { @@ -30,7 +31,7 @@ namespace Org.BouncyCastle.Asn1.Cmp return new PkiStatusInfo((Asn1Sequence)obj); } - throw new ArgumentException("Unknown object in factory: " + obj.GetType().Name, "obj"); + throw new ArgumentException("Unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } public PkiStatusInfo( diff --git a/crypto/src/asn1/cmp/PbmParameter.cs b/crypto/src/asn1/cmp/PbmParameter.cs index 59b1bd7bb..206b89ba1 100644 --- a/crypto/src/asn1/cmp/PbmParameter.cs +++ b/crypto/src/asn1/cmp/PbmParameter.cs @@ -1,6 +1,7 @@ using System; using Org.BouncyCastle.Asn1.X509; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Cmp { @@ -28,7 +29,7 @@ namespace Org.BouncyCastle.Asn1.Cmp if (obj is Asn1Sequence) return new PbmParameter((Asn1Sequence)obj); - throw new ArgumentException("Invalid object: " + obj.GetType().Name, "obj"); + throw new ArgumentException("Invalid object: " + Platform.GetTypeName(obj), "obj"); } public PbmParameter( diff --git a/crypto/src/asn1/cmp/PollRepContent.cs b/crypto/src/asn1/cmp/PollRepContent.cs index 4045ac7ed..f8bb098a2 100644 --- a/crypto/src/asn1/cmp/PollRepContent.cs +++ b/crypto/src/asn1/cmp/PollRepContent.cs @@ -1,5 +1,7 @@ using System; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1.Cmp { public class PollRepContent @@ -28,7 +30,7 @@ namespace Org.BouncyCastle.Asn1.Cmp if (obj is Asn1Sequence) return new PollRepContent((Asn1Sequence)obj); - throw new ArgumentException("Invalid object: " + obj.GetType().Name, "obj"); + throw new ArgumentException("Invalid object: " + Platform.GetTypeName(obj), "obj"); } public virtual DerInteger CertReqID diff --git a/crypto/src/asn1/cmp/PollReqContent.cs b/crypto/src/asn1/cmp/PollReqContent.cs index ca2164151..dd9b0c352 100644 --- a/crypto/src/asn1/cmp/PollReqContent.cs +++ b/crypto/src/asn1/cmp/PollReqContent.cs @@ -1,5 +1,7 @@ using System; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1.Cmp { public class PollReqContent @@ -20,7 +22,7 @@ namespace Org.BouncyCastle.Asn1.Cmp if (obj is Asn1Sequence) return new PollReqContent((Asn1Sequence)obj); - throw new ArgumentException("Invalid object: " + obj.GetType().Name, "obj"); + throw new ArgumentException("Invalid object: " + Platform.GetTypeName(obj), "obj"); } public virtual DerInteger[][] GetCertReqIDs() diff --git a/crypto/src/asn1/cmp/PopoDecKeyChallContent.cs b/crypto/src/asn1/cmp/PopoDecKeyChallContent.cs index 20b173b85..03a13a5d5 100644 --- a/crypto/src/asn1/cmp/PopoDecKeyChallContent.cs +++ b/crypto/src/asn1/cmp/PopoDecKeyChallContent.cs @@ -1,5 +1,7 @@ using System; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1.Cmp { public class PopoDecKeyChallContent @@ -20,7 +22,7 @@ namespace Org.BouncyCastle.Asn1.Cmp if (obj is Asn1Sequence) return new PopoDecKeyChallContent((Asn1Sequence)obj); - throw new ArgumentException("Invalid object: " + obj.GetType().Name, "obj"); + throw new ArgumentException("Invalid object: " + Platform.GetTypeName(obj), "obj"); } public virtual Challenge[] ToChallengeArray() diff --git a/crypto/src/asn1/cmp/PopoDecKeyRespContent.cs b/crypto/src/asn1/cmp/PopoDecKeyRespContent.cs index 8c322e4ec..73f59b7c1 100644 --- a/crypto/src/asn1/cmp/PopoDecKeyRespContent.cs +++ b/crypto/src/asn1/cmp/PopoDecKeyRespContent.cs @@ -1,5 +1,7 @@ using System; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1.Cmp { public class PopoDecKeyRespContent @@ -20,7 +22,7 @@ namespace Org.BouncyCastle.Asn1.Cmp if (obj is Asn1Sequence) return new PopoDecKeyRespContent((Asn1Sequence)obj); - throw new ArgumentException("Invalid object: " + obj.GetType().Name, "obj"); + throw new ArgumentException("Invalid object: " + Platform.GetTypeName(obj), "obj"); } public virtual DerInteger[] ToDerIntegerArray() diff --git a/crypto/src/asn1/cmp/ProtectedPart.cs b/crypto/src/asn1/cmp/ProtectedPart.cs index db6798fee..ed90708f9 100644 --- a/crypto/src/asn1/cmp/ProtectedPart.cs +++ b/crypto/src/asn1/cmp/ProtectedPart.cs @@ -1,5 +1,7 @@ using System; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1.Cmp { public class ProtectedPart @@ -22,7 +24,7 @@ namespace Org.BouncyCastle.Asn1.Cmp if (obj is Asn1Sequence) return new ProtectedPart((Asn1Sequence)obj); - throw new ArgumentException("Invalid object: " + obj.GetType().Name, "obj"); + throw new ArgumentException("Invalid object: " + Platform.GetTypeName(obj), "obj"); } public ProtectedPart(PkiHeader header, PkiBody body) diff --git a/crypto/src/asn1/cmp/RevAnnContent.cs b/crypto/src/asn1/cmp/RevAnnContent.cs index 2c3bd5f77..d5d42625c 100644 --- a/crypto/src/asn1/cmp/RevAnnContent.cs +++ b/crypto/src/asn1/cmp/RevAnnContent.cs @@ -2,6 +2,7 @@ using System; using Org.BouncyCastle.Asn1.Crmf; using Org.BouncyCastle.Asn1.X509; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Cmp { @@ -35,7 +36,7 @@ namespace Org.BouncyCastle.Asn1.Cmp if (obj is Asn1Sequence) return new RevAnnContent((Asn1Sequence)obj); - throw new ArgumentException("Invalid object: " + obj.GetType().Name, "obj"); + throw new ArgumentException("Invalid object: " + Platform.GetTypeName(obj), "obj"); } public virtual PkiStatusEncodable Status diff --git a/crypto/src/asn1/cmp/RevDetails.cs b/crypto/src/asn1/cmp/RevDetails.cs index 6bdf5b2e9..7d2a65ab9 100644 --- a/crypto/src/asn1/cmp/RevDetails.cs +++ b/crypto/src/asn1/cmp/RevDetails.cs @@ -2,6 +2,7 @@ using System; using Org.BouncyCastle.Asn1.Crmf; using Org.BouncyCastle.Asn1.X509; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Cmp { @@ -27,7 +28,7 @@ namespace Org.BouncyCastle.Asn1.Cmp if (obj is Asn1Sequence) return new RevDetails((Asn1Sequence)obj); - throw new ArgumentException("Invalid object: " + obj.GetType().Name, "obj"); + throw new ArgumentException("Invalid object: " + Platform.GetTypeName(obj), "obj"); } public RevDetails(CertTemplate certDetails) diff --git a/crypto/src/asn1/cmp/RevRepContent.cs b/crypto/src/asn1/cmp/RevRepContent.cs index 47987265a..8e382a60d 100644 --- a/crypto/src/asn1/cmp/RevRepContent.cs +++ b/crypto/src/asn1/cmp/RevRepContent.cs @@ -2,6 +2,7 @@ using System; using Org.BouncyCastle.Asn1.Crmf; using Org.BouncyCastle.Asn1.X509; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Cmp { @@ -39,7 +40,7 @@ namespace Org.BouncyCastle.Asn1.Cmp if (obj is Asn1Sequence) return new RevRepContent((Asn1Sequence)obj); - throw new ArgumentException("Invalid object: " + obj.GetType().Name, "obj"); + throw new ArgumentException("Invalid object: " + Platform.GetTypeName(obj), "obj"); } public virtual PkiStatusInfo[] GetStatus() diff --git a/crypto/src/asn1/cmp/RevReqContent.cs b/crypto/src/asn1/cmp/RevReqContent.cs index fbf869203..1522d3789 100644 --- a/crypto/src/asn1/cmp/RevReqContent.cs +++ b/crypto/src/asn1/cmp/RevReqContent.cs @@ -1,5 +1,7 @@ using System; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1.Cmp { public class RevReqContent @@ -20,7 +22,7 @@ namespace Org.BouncyCastle.Asn1.Cmp if (obj is Asn1Sequence) return new RevReqContent((Asn1Sequence)obj); - throw new ArgumentException("Invalid object: " + obj.GetType().Name, "obj"); + throw new ArgumentException("Invalid object: " + Platform.GetTypeName(obj), "obj"); } public RevReqContent(params RevDetails[] revDetails) diff --git a/crypto/src/asn1/cms/Attribute.cs b/crypto/src/asn1/cms/Attribute.cs index c4a104a3f..69ac44148 100644 --- a/crypto/src/asn1/cms/Attribute.cs +++ b/crypto/src/asn1/cms/Attribute.cs @@ -1,6 +1,6 @@ using System; -using Org.BouncyCastle.Asn1; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Cms { @@ -25,7 +25,7 @@ namespace Org.BouncyCastle.Asn1.Cms if (obj is Asn1Sequence) return new Attribute((Asn1Sequence) obj); - throw new ArgumentException("unknown object in factory: " + obj.GetType().Name, "obj"); + throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } public Attribute( diff --git a/crypto/src/asn1/cms/AuthEnvelopedData.cs b/crypto/src/asn1/cms/AuthEnvelopedData.cs index 4260d80f9..c30ec6bbd 100644 --- a/crypto/src/asn1/cms/AuthEnvelopedData.cs +++ b/crypto/src/asn1/cms/AuthEnvelopedData.cs @@ -1,5 +1,7 @@ using System; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1.Cms { public class AuthEnvelopedData @@ -119,7 +121,7 @@ namespace Org.BouncyCastle.Asn1.Cms if (obj is Asn1Sequence) return new AuthEnvelopedData((Asn1Sequence)obj); - throw new ArgumentException("Invalid AuthEnvelopedData: " + obj.GetType().Name); + throw new ArgumentException("Invalid AuthEnvelopedData: " + Platform.GetTypeName(obj)); } public DerInteger Version diff --git a/crypto/src/asn1/cms/AuthenticatedData.cs b/crypto/src/asn1/cms/AuthenticatedData.cs index 15286d1aa..6f13a6f30 100644 --- a/crypto/src/asn1/cms/AuthenticatedData.cs +++ b/crypto/src/asn1/cms/AuthenticatedData.cs @@ -1,6 +1,7 @@ using System; using Org.BouncyCastle.Asn1.X509; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Cms { @@ -123,7 +124,7 @@ namespace Org.BouncyCastle.Asn1.Cms return new AuthenticatedData((Asn1Sequence)obj); } - throw new ArgumentException("Invalid AuthenticatedData: " + obj.GetType().Name); + throw new ArgumentException("Invalid AuthenticatedData: " + Platform.GetTypeName(obj)); } public DerInteger Version diff --git a/crypto/src/asn1/cms/CompressedData.cs b/crypto/src/asn1/cms/CompressedData.cs index 5a2869b8c..154ed35c0 100644 --- a/crypto/src/asn1/cms/CompressedData.cs +++ b/crypto/src/asn1/cms/CompressedData.cs @@ -1,7 +1,7 @@ using System; -using Org.BouncyCastle.Asn1; using Org.BouncyCastle.Asn1.X509; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Cms { @@ -70,7 +70,7 @@ namespace Org.BouncyCastle.Asn1.Cms if (obj is Asn1Sequence) return new CompressedData((Asn1Sequence) obj); - throw new ArgumentException("Invalid CompressedData: " + obj.GetType().Name); + throw new ArgumentException("Invalid CompressedData: " + Platform.GetTypeName(obj)); } public DerInteger Version diff --git a/crypto/src/asn1/cms/ContentInfo.cs b/crypto/src/asn1/cms/ContentInfo.cs index 278ceca46..f130a4bc7 100644 --- a/crypto/src/asn1/cms/ContentInfo.cs +++ b/crypto/src/asn1/cms/ContentInfo.cs @@ -1,7 +1,7 @@ using System; using System.Collections; -using Org.BouncyCastle.Asn1; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Cms { @@ -20,7 +20,7 @@ namespace Org.BouncyCastle.Asn1.Cms if (obj is Asn1Sequence) return new ContentInfo((Asn1Sequence) obj); - throw new ArgumentException("unknown object in factory: " + obj.GetType().Name); + throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj)); } public static ContentInfo GetInstance(Asn1TaggedObject obj, bool isExplicit) diff --git a/crypto/src/asn1/cms/EncryptedContentInfo.cs b/crypto/src/asn1/cms/EncryptedContentInfo.cs index 4fdc47138..999f2a01e 100644 --- a/crypto/src/asn1/cms/EncryptedContentInfo.cs +++ b/crypto/src/asn1/cms/EncryptedContentInfo.cs @@ -1,7 +1,7 @@ using System; -using Org.BouncyCastle.Asn1; using Org.BouncyCastle.Asn1.X509; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Cms { @@ -50,7 +50,7 @@ namespace Org.BouncyCastle.Asn1.Cms if (obj is Asn1Sequence) return new EncryptedContentInfo((Asn1Sequence)obj); - throw new ArgumentException("Invalid EncryptedContentInfo: " + obj.GetType().Name); + throw new ArgumentException("Invalid EncryptedContentInfo: " + Platform.GetTypeName(obj)); } public DerObjectIdentifier ContentType diff --git a/crypto/src/asn1/cms/EncryptedData.cs b/crypto/src/asn1/cms/EncryptedData.cs index cb109a640..b8492d14b 100644 --- a/crypto/src/asn1/cms/EncryptedData.cs +++ b/crypto/src/asn1/cms/EncryptedData.cs @@ -1,5 +1,7 @@ using System; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1.Cms { public class EncryptedData @@ -18,7 +20,7 @@ namespace Org.BouncyCastle.Asn1.Cms if (obj is Asn1Sequence) return new EncryptedData((Asn1Sequence) obj); - throw new ArgumentException("Invalid EncryptedData: " + obj.GetType().Name); + throw new ArgumentException("Invalid EncryptedData: " + Platform.GetTypeName(obj)); } public EncryptedData( diff --git a/crypto/src/asn1/cms/Evidence.cs b/crypto/src/asn1/cms/Evidence.cs index 4745e565b..8374aed55 100644 --- a/crypto/src/asn1/cms/Evidence.cs +++ b/crypto/src/asn1/cms/Evidence.cs @@ -1,5 +1,7 @@ using System; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1.Cms { public class Evidence @@ -28,7 +30,7 @@ namespace Org.BouncyCastle.Asn1.Cms if (obj is Asn1TaggedObject) return new Evidence(Asn1TaggedObject.GetInstance(obj)); - throw new ArgumentException("Unknown object in GetInstance: " + obj.GetType().FullName, "obj"); + throw new ArgumentException("Unknown object in GetInstance: " + Platform.GetTypeName(obj), "obj"); } public virtual TimeStampTokenEvidence TstEvidence diff --git a/crypto/src/asn1/cms/KEKIdentifier.cs b/crypto/src/asn1/cms/KEKIdentifier.cs index e5d1d9090..a42217440 100644 --- a/crypto/src/asn1/cms/KEKIdentifier.cs +++ b/crypto/src/asn1/cms/KEKIdentifier.cs @@ -1,6 +1,6 @@ using System; -using Org.BouncyCastle.Asn1; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Cms { @@ -80,7 +80,7 @@ namespace Org.BouncyCastle.Asn1.Cms if (obj is Asn1Sequence) return new KekIdentifier((Asn1Sequence)obj); - throw new ArgumentException("Invalid KekIdentifier: " + obj.GetType().Name); + throw new ArgumentException("Invalid KekIdentifier: " + Platform.GetTypeName(obj)); } public Asn1OctetString KeyIdentifier diff --git a/crypto/src/asn1/cms/KEKRecipientInfo.cs b/crypto/src/asn1/cms/KEKRecipientInfo.cs index d847b50cc..810e7fc97 100644 --- a/crypto/src/asn1/cms/KEKRecipientInfo.cs +++ b/crypto/src/asn1/cms/KEKRecipientInfo.cs @@ -1,7 +1,7 @@ using System; -using Org.BouncyCastle.Asn1; using Org.BouncyCastle.Asn1.X509; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Cms { @@ -64,7 +64,7 @@ namespace Org.BouncyCastle.Asn1.Cms if(obj is Asn1Sequence) return new KekRecipientInfo((Asn1Sequence)obj); - throw new ArgumentException("Invalid KekRecipientInfo: " + obj.GetType().Name); + throw new ArgumentException("Invalid KekRecipientInfo: " + Platform.GetTypeName(obj)); } public DerInteger Version diff --git a/crypto/src/asn1/cms/KeyAgreeRecipientIdentifier.cs b/crypto/src/asn1/cms/KeyAgreeRecipientIdentifier.cs index fa6fdb0f3..0256c2dc2 100644 --- a/crypto/src/asn1/cms/KeyAgreeRecipientIdentifier.cs +++ b/crypto/src/asn1/cms/KeyAgreeRecipientIdentifier.cs @@ -1,5 +1,7 @@ using System; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1.Cms { public class KeyAgreeRecipientIdentifier @@ -42,7 +44,7 @@ namespace Org.BouncyCastle.Asn1.Cms (Asn1TaggedObject)obj, false)); } - throw new ArgumentException("Invalid KeyAgreeRecipientIdentifier: " + obj.GetType().FullName, "obj"); + throw new ArgumentException("Invalid KeyAgreeRecipientIdentifier: " + Platform.GetTypeName(obj), "obj"); } private readonly IssuerAndSerialNumber issuerSerial; diff --git a/crypto/src/asn1/cms/KeyAgreeRecipientInfo.cs b/crypto/src/asn1/cms/KeyAgreeRecipientInfo.cs index aafb008d4..62a38925b 100644 --- a/crypto/src/asn1/cms/KeyAgreeRecipientInfo.cs +++ b/crypto/src/asn1/cms/KeyAgreeRecipientInfo.cs @@ -1,7 +1,7 @@ using System; -using Org.BouncyCastle.Asn1; using Org.BouncyCastle.Asn1.X509; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Cms { @@ -80,7 +80,7 @@ namespace Org.BouncyCastle.Asn1.Cms return new KeyAgreeRecipientInfo((Asn1Sequence)obj); throw new ArgumentException( - "Illegal object in KeyAgreeRecipientInfo: " + obj.GetType().Name); + "Illegal object in KeyAgreeRecipientInfo: " + Platform.GetTypeName(obj)); } diff --git a/crypto/src/asn1/cms/KeyTransRecipientInfo.cs b/crypto/src/asn1/cms/KeyTransRecipientInfo.cs index aae18c59d..5e4fd22b4 100644 --- a/crypto/src/asn1/cms/KeyTransRecipientInfo.cs +++ b/crypto/src/asn1/cms/KeyTransRecipientInfo.cs @@ -1,7 +1,7 @@ using System; -using Org.BouncyCastle.Asn1; using Org.BouncyCastle.Asn1.X509; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Cms { @@ -57,7 +57,7 @@ namespace Org.BouncyCastle.Asn1.Cms return new KeyTransRecipientInfo((Asn1Sequence) obj); throw new ArgumentException( - "Illegal object in KeyTransRecipientInfo: " + obj.GetType().Name); + "Illegal object in KeyTransRecipientInfo: " + Platform.GetTypeName(obj)); } public DerInteger Version diff --git a/crypto/src/asn1/cms/OriginatorIdentifierOrKey.cs b/crypto/src/asn1/cms/OriginatorIdentifierOrKey.cs index d33a11725..f197fe965 100644 --- a/crypto/src/asn1/cms/OriginatorIdentifierOrKey.cs +++ b/crypto/src/asn1/cms/OriginatorIdentifierOrKey.cs @@ -1,7 +1,7 @@ using System; -using Org.BouncyCastle.Asn1; using Org.BouncyCastle.Asn1.X509; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Cms { @@ -95,7 +95,7 @@ namespace Org.BouncyCastle.Asn1.Cms if (o is Asn1TaggedObject) return new OriginatorIdentifierOrKey((Asn1TaggedObject)o); - throw new ArgumentException("Invalid OriginatorIdentifierOrKey: " + o.GetType().Name); + throw new ArgumentException("Invalid OriginatorIdentifierOrKey: " + Platform.GetTypeName(o)); } public Asn1Encodable ID diff --git a/crypto/src/asn1/cms/OriginatorInfo.cs b/crypto/src/asn1/cms/OriginatorInfo.cs index b4549bc36..33b049efa 100644 --- a/crypto/src/asn1/cms/OriginatorInfo.cs +++ b/crypto/src/asn1/cms/OriginatorInfo.cs @@ -1,6 +1,6 @@ using System; -using Org.BouncyCastle.Asn1; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Cms { @@ -79,7 +79,7 @@ namespace Org.BouncyCastle.Asn1.Cms if (obj is Asn1Sequence) return new OriginatorInfo((Asn1Sequence)obj); - throw new ArgumentException("Invalid OriginatorInfo: " + obj.GetType().Name); + throw new ArgumentException("Invalid OriginatorInfo: " + Platform.GetTypeName(obj)); } public Asn1Set Certificates diff --git a/crypto/src/asn1/cms/OriginatorPublicKey.cs b/crypto/src/asn1/cms/OriginatorPublicKey.cs index 988841aa5..9f29c6242 100644 --- a/crypto/src/asn1/cms/OriginatorPublicKey.cs +++ b/crypto/src/asn1/cms/OriginatorPublicKey.cs @@ -1,7 +1,7 @@ using System; -using Org.BouncyCastle.Asn1; using Org.BouncyCastle.Asn1.X509; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Cms { @@ -58,7 +58,7 @@ namespace Org.BouncyCastle.Asn1.Cms if (obj is Asn1Sequence) return new OriginatorPublicKey(Asn1Sequence.GetInstance(obj)); - throw new ArgumentException("Invalid OriginatorPublicKey: " + obj.GetType().Name); + throw new ArgumentException("Invalid OriginatorPublicKey: " + Platform.GetTypeName(obj)); } public AlgorithmIdentifier Algorithm diff --git a/crypto/src/asn1/cms/OtherKeyAttribute.cs b/crypto/src/asn1/cms/OtherKeyAttribute.cs index 271059175..285c88154 100644 --- a/crypto/src/asn1/cms/OtherKeyAttribute.cs +++ b/crypto/src/asn1/cms/OtherKeyAttribute.cs @@ -1,6 +1,6 @@ using System; -using Org.BouncyCastle.Asn1; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Cms { @@ -25,7 +25,7 @@ namespace Org.BouncyCastle.Asn1.Cms if (obj is Asn1Sequence) return new OtherKeyAttribute((Asn1Sequence) obj); - throw new ArgumentException("unknown object in factory: " + obj.GetType().Name, "obj"); + throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } public OtherKeyAttribute( diff --git a/crypto/src/asn1/cms/PasswordRecipientInfo.cs b/crypto/src/asn1/cms/PasswordRecipientInfo.cs index 800b57951..7f275fde7 100644 --- a/crypto/src/asn1/cms/PasswordRecipientInfo.cs +++ b/crypto/src/asn1/cms/PasswordRecipientInfo.cs @@ -1,7 +1,7 @@ using System; -using Org.BouncyCastle.Asn1; using Org.BouncyCastle.Asn1.X509; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Cms { @@ -82,7 +82,7 @@ namespace Org.BouncyCastle.Asn1.Cms if (obj is Asn1Sequence) return new PasswordRecipientInfo((Asn1Sequence) obj); - throw new ArgumentException("Invalid PasswordRecipientInfo: " + obj.GetType().Name); + throw new ArgumentException("Invalid PasswordRecipientInfo: " + Platform.GetTypeName(obj)); } public DerInteger Version diff --git a/crypto/src/asn1/cms/RecipientEncryptedKey.cs b/crypto/src/asn1/cms/RecipientEncryptedKey.cs index 5ba25a742..1afba4ab1 100644 --- a/crypto/src/asn1/cms/RecipientEncryptedKey.cs +++ b/crypto/src/asn1/cms/RecipientEncryptedKey.cs @@ -1,5 +1,7 @@ using System; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1.Cms { public class RecipientEncryptedKey @@ -50,7 +52,7 @@ namespace Org.BouncyCastle.Asn1.Cms return new RecipientEncryptedKey((Asn1Sequence) obj); } - throw new ArgumentException("Invalid RecipientEncryptedKey: " + obj.GetType().FullName, "obj"); + throw new ArgumentException("Invalid RecipientEncryptedKey: " + Platform.GetTypeName(obj), "obj"); } public RecipientEncryptedKey( diff --git a/crypto/src/asn1/cms/RecipientIdentifier.cs b/crypto/src/asn1/cms/RecipientIdentifier.cs index 4982bc16a..f29fa8d7c 100644 --- a/crypto/src/asn1/cms/RecipientIdentifier.cs +++ b/crypto/src/asn1/cms/RecipientIdentifier.cs @@ -1,6 +1,6 @@ using System; -using Org.BouncyCastle.Asn1; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Cms { @@ -49,7 +49,7 @@ namespace Org.BouncyCastle.Asn1.Cms return new RecipientIdentifier((Asn1Object) o); throw new ArgumentException( - "Illegal object in RecipientIdentifier: " + o.GetType().Name); + "Illegal object in RecipientIdentifier: " + Platform.GetTypeName(o)); } public bool IsTagged diff --git a/crypto/src/asn1/cms/RecipientInfo.cs b/crypto/src/asn1/cms/RecipientInfo.cs index daaf5a5e4..c03ad907f 100644 --- a/crypto/src/asn1/cms/RecipientInfo.cs +++ b/crypto/src/asn1/cms/RecipientInfo.cs @@ -1,6 +1,6 @@ using System; -using Org.BouncyCastle.Asn1; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Cms { @@ -57,7 +57,7 @@ namespace Org.BouncyCastle.Asn1.Cms if (o is Asn1TaggedObject) return new RecipientInfo((Asn1TaggedObject) o); - throw new ArgumentException("unknown object in factory: " + o.GetType().Name); + throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(o)); } public DerInteger Version diff --git a/crypto/src/asn1/cms/RecipientKeyIdentifier.cs b/crypto/src/asn1/cms/RecipientKeyIdentifier.cs index f3e45644b..995ddab51 100644 --- a/crypto/src/asn1/cms/RecipientKeyIdentifier.cs +++ b/crypto/src/asn1/cms/RecipientKeyIdentifier.cs @@ -1,6 +1,6 @@ using System; -using Org.BouncyCastle.Asn1; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Cms { @@ -97,7 +97,7 @@ namespace Org.BouncyCastle.Asn1.Cms if (obj is Asn1Sequence) return new RecipientKeyIdentifier((Asn1Sequence) obj); - throw new ArgumentException("Invalid RecipientKeyIdentifier: " + obj.GetType().Name); + throw new ArgumentException("Invalid RecipientKeyIdentifier: " + Platform.GetTypeName(obj)); } public Asn1OctetString SubjectKeyIdentifier diff --git a/crypto/src/asn1/cms/SignedData.cs b/crypto/src/asn1/cms/SignedData.cs index 6cea79a49..957b81cd8 100644 --- a/crypto/src/asn1/cms/SignedData.cs +++ b/crypto/src/asn1/cms/SignedData.cs @@ -1,7 +1,7 @@ using System; using System.Collections; -using Org.BouncyCastle.Asn1; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Cms { @@ -34,7 +34,7 @@ namespace Org.BouncyCastle.Asn1.Cms if (obj is Asn1Sequence) return new SignedData((Asn1Sequence) obj); - throw new ArgumentException("Unknown object in factory: " + obj.GetType().FullName, "obj"); + throw new ArgumentException("Unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } public SignedData( diff --git a/crypto/src/asn1/cms/SignedDataParser.cs b/crypto/src/asn1/cms/SignedDataParser.cs index 341309263..cd07f4057 100644 --- a/crypto/src/asn1/cms/SignedDataParser.cs +++ b/crypto/src/asn1/cms/SignedDataParser.cs @@ -1,6 +1,8 @@ using System; using System.IO; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1.Cms { /** @@ -32,7 +34,7 @@ namespace Org.BouncyCastle.Asn1.Cms if (o is Asn1SequenceParser) return new SignedDataParser((Asn1SequenceParser)o); - throw new IOException("unknown object encountered: " + o.GetType().Name); + throw new IOException("unknown object encountered: " + Platform.GetTypeName(o)); } public SignedDataParser( diff --git a/crypto/src/asn1/cms/SignerIdentifier.cs b/crypto/src/asn1/cms/SignerIdentifier.cs index 5742cee75..195ab741f 100644 --- a/crypto/src/asn1/cms/SignerIdentifier.cs +++ b/crypto/src/asn1/cms/SignerIdentifier.cs @@ -1,6 +1,6 @@ using System; -using Org.BouncyCastle.Asn1; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Cms { @@ -49,7 +49,7 @@ namespace Org.BouncyCastle.Asn1.Cms return new SignerIdentifier((Asn1Object) o); throw new ArgumentException( - "Illegal object in SignerIdentifier: " + o.GetType().Name); + "Illegal object in SignerIdentifier: " + Platform.GetTypeName(o)); } public bool IsTagged diff --git a/crypto/src/asn1/cms/SignerInfo.cs b/crypto/src/asn1/cms/SignerInfo.cs index a4e893d96..b6bd319b0 100644 --- a/crypto/src/asn1/cms/SignerInfo.cs +++ b/crypto/src/asn1/cms/SignerInfo.cs @@ -1,8 +1,8 @@ using System; using System.Collections; -using Org.BouncyCastle.Asn1; using Org.BouncyCastle.Asn1.X509; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Cms { @@ -26,7 +26,7 @@ namespace Org.BouncyCastle.Asn1.Cms if (obj is Asn1Sequence) return new SignerInfo((Asn1Sequence) obj); - throw new ArgumentException("Unknown object in factory: " + obj.GetType().FullName, "obj"); + throw new ArgumentException("Unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } public SignerInfo( diff --git a/crypto/src/asn1/cms/Time.cs b/crypto/src/asn1/cms/Time.cs index e5730245e..52fb4f937 100644 --- a/crypto/src/asn1/cms/Time.cs +++ b/crypto/src/asn1/cms/Time.cs @@ -1,6 +1,8 @@ using System; using System.Globalization; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1.Cms { public class Time @@ -58,7 +60,7 @@ namespace Org.BouncyCastle.Asn1.Cms if (obj is DerGeneralizedTime) return new Time((DerGeneralizedTime)obj); - throw new ArgumentException("unknown object in factory: " + obj.GetType().Name, "obj"); + throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } public string TimeString diff --git a/crypto/src/asn1/cms/ecc/MQVuserKeyingMaterial.cs b/crypto/src/asn1/cms/ecc/MQVuserKeyingMaterial.cs index 53c5c706b..dc4ac1a4a 100644 --- a/crypto/src/asn1/cms/ecc/MQVuserKeyingMaterial.cs +++ b/crypto/src/asn1/cms/ecc/MQVuserKeyingMaterial.cs @@ -1,5 +1,7 @@ using System; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1.Cms.Ecc { public class MQVuserKeyingMaterial @@ -67,7 +69,7 @@ namespace Org.BouncyCastle.Asn1.Cms.Ecc return new MQVuserKeyingMaterial((Asn1Sequence)obj); } - throw new ArgumentException("Invalid MQVuserKeyingMaterial: " + obj.GetType().Name); + throw new ArgumentException("Invalid MQVuserKeyingMaterial: " + Platform.GetTypeName(obj)); } public OriginatorPublicKey EphemeralPublicKey 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 diff --git a/crypto/src/asn1/cryptopro/ECGOST3410ParamSetParameters.cs b/crypto/src/asn1/cryptopro/ECGOST3410ParamSetParameters.cs index 6f4435d7b..8e568a229 100644 --- a/crypto/src/asn1/cryptopro/ECGOST3410ParamSetParameters.cs +++ b/crypto/src/asn1/cryptopro/ECGOST3410ParamSetParameters.cs @@ -2,6 +2,7 @@ using System; using System.Collections; using Org.BouncyCastle.Math; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.CryptoPro { @@ -30,7 +31,7 @@ namespace Org.BouncyCastle.Asn1.CryptoPro return new ECGost3410ParamSetParameters((Asn1Sequence) obj); } - throw new ArgumentException("Invalid GOST3410Parameter: " + obj.GetType().Name); + throw new ArgumentException("Invalid GOST3410Parameter: " + Platform.GetTypeName(obj)); } public ECGost3410ParamSetParameters( diff --git a/crypto/src/asn1/cryptopro/GOST28147Parameters.cs b/crypto/src/asn1/cryptopro/GOST28147Parameters.cs index eb7e0e3f6..fc0d792d1 100644 --- a/crypto/src/asn1/cryptopro/GOST28147Parameters.cs +++ b/crypto/src/asn1/cryptopro/GOST28147Parameters.cs @@ -1,7 +1,7 @@ using System; using System.Collections; -using Org.BouncyCastle.Asn1; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.CryptoPro { @@ -31,7 +31,7 @@ namespace Org.BouncyCastle.Asn1.CryptoPro return new Gost28147Parameters((Asn1Sequence) obj); } - throw new ArgumentException("Invalid GOST3410Parameter: " + obj.GetType().Name); + throw new ArgumentException("Invalid GOST3410Parameter: " + Platform.GetTypeName(obj)); } private Gost28147Parameters( diff --git a/crypto/src/asn1/cryptopro/GOST3410ParamSetParameters.cs b/crypto/src/asn1/cryptopro/GOST3410ParamSetParameters.cs index f133cdf1b..b347f8dbd 100644 --- a/crypto/src/asn1/cryptopro/GOST3410ParamSetParameters.cs +++ b/crypto/src/asn1/cryptopro/GOST3410ParamSetParameters.cs @@ -1,8 +1,8 @@ using System; using System.Collections; -using Org.BouncyCastle.Asn1; using Org.BouncyCastle.Math; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.CryptoPro { @@ -32,7 +32,7 @@ namespace Org.BouncyCastle.Asn1.CryptoPro return new Gost3410ParamSetParameters((Asn1Sequence) obj); } - throw new ArgumentException("Invalid GOST3410Parameter: " + obj.GetType().Name); + throw new ArgumentException("Invalid GOST3410Parameter: " + Platform.GetTypeName(obj)); } public Gost3410ParamSetParameters( diff --git a/crypto/src/asn1/cryptopro/GOST3410PublicKeyAlgParameters.cs b/crypto/src/asn1/cryptopro/GOST3410PublicKeyAlgParameters.cs index 8bc1460af..10c45ba4d 100644 --- a/crypto/src/asn1/cryptopro/GOST3410PublicKeyAlgParameters.cs +++ b/crypto/src/asn1/cryptopro/GOST3410PublicKeyAlgParameters.cs @@ -1,6 +1,6 @@ using System; -using Org.BouncyCastle.Asn1; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.CryptoPro { @@ -31,7 +31,7 @@ namespace Org.BouncyCastle.Asn1.CryptoPro return new Gost3410PublicKeyAlgParameters((Asn1Sequence) obj); } - throw new ArgumentException("Invalid GOST3410Parameter: " + obj.GetType().Name); + throw new ArgumentException("Invalid GOST3410Parameter: " + Platform.GetTypeName(obj)); } public Gost3410PublicKeyAlgParameters( diff --git a/crypto/src/asn1/esf/CertificateValues.cs b/crypto/src/asn1/esf/CertificateValues.cs index e0fb39b83..30a719177 100644 --- a/crypto/src/asn1/esf/CertificateValues.cs +++ b/crypto/src/asn1/esf/CertificateValues.cs @@ -2,6 +2,7 @@ using System; using System.Collections; using Org.BouncyCastle.Asn1.X509; +using Org.BouncyCastle.Utilities; using Org.BouncyCastle.Utilities.Collections; namespace Org.BouncyCastle.Asn1.Esf @@ -28,7 +29,7 @@ namespace Org.BouncyCastle.Asn1.Esf throw new ArgumentException( "Unknown object in 'CertificateValues' factory: " - + obj.GetType().Name, + + Platform.GetTypeName(obj), "obj"); } diff --git a/crypto/src/asn1/esf/CommitmentTypeIndication.cs b/crypto/src/asn1/esf/CommitmentTypeIndication.cs index 8342cbf8d..196a613a6 100644 --- a/crypto/src/asn1/esf/CommitmentTypeIndication.cs +++ b/crypto/src/asn1/esf/CommitmentTypeIndication.cs @@ -1,6 +1,6 @@ using System; -using Org.BouncyCastle.Asn1; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Esf { @@ -21,7 +21,7 @@ namespace Org.BouncyCastle.Asn1.Esf throw new ArgumentException( "Unknown object in 'CommitmentTypeIndication' factory: " - + obj.GetType().Name, + + Platform.GetTypeName(obj), "obj"); } diff --git a/crypto/src/asn1/esf/CommitmentTypeQualifier.cs b/crypto/src/asn1/esf/CommitmentTypeQualifier.cs index 09ff70714..30bf0edfc 100644 --- a/crypto/src/asn1/esf/CommitmentTypeQualifier.cs +++ b/crypto/src/asn1/esf/CommitmentTypeQualifier.cs @@ -1,6 +1,6 @@ using System; -using Org.BouncyCastle.Asn1; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Esf { @@ -84,7 +84,7 @@ namespace Org.BouncyCastle.Asn1.Esf throw new ArgumentException( "Unknown object in 'CommitmentTypeQualifier' factory: " - + obj.GetType().Name, + + Platform.GetTypeName(obj), "obj"); } diff --git a/crypto/src/asn1/esf/CompleteCertificateRefs.cs b/crypto/src/asn1/esf/CompleteCertificateRefs.cs index 7f1c835c9..af93700be 100644 --- a/crypto/src/asn1/esf/CompleteCertificateRefs.cs +++ b/crypto/src/asn1/esf/CompleteCertificateRefs.cs @@ -1,6 +1,7 @@ using System; using System.Collections; +using Org.BouncyCastle.Utilities; using Org.BouncyCastle.Utilities.Collections; namespace Org.BouncyCastle.Asn1.Esf @@ -27,7 +28,7 @@ namespace Org.BouncyCastle.Asn1.Esf throw new ArgumentException( "Unknown object in 'CompleteCertificateRefs' factory: " - + obj.GetType().Name, + + Platform.GetTypeName(obj), "obj"); } diff --git a/crypto/src/asn1/esf/CompleteRevocationRefs.cs b/crypto/src/asn1/esf/CompleteRevocationRefs.cs index 4e1fb403d..348e63fdb 100644 --- a/crypto/src/asn1/esf/CompleteRevocationRefs.cs +++ b/crypto/src/asn1/esf/CompleteRevocationRefs.cs @@ -1,6 +1,7 @@ using System; using System.Collections; +using Org.BouncyCastle.Utilities; using Org.BouncyCastle.Utilities.Collections; namespace Org.BouncyCastle.Asn1.Esf @@ -27,7 +28,7 @@ namespace Org.BouncyCastle.Asn1.Esf throw new ArgumentException( "Unknown object in 'CompleteRevocationRefs' factory: " - + obj.GetType().Name, + + Platform.GetTypeName(obj), "obj"); } diff --git a/crypto/src/asn1/esf/CrlIdentifier.cs b/crypto/src/asn1/esf/CrlIdentifier.cs index dfff7d838..96b50e211 100644 --- a/crypto/src/asn1/esf/CrlIdentifier.cs +++ b/crypto/src/asn1/esf/CrlIdentifier.cs @@ -2,6 +2,7 @@ using System; using Org.BouncyCastle.Asn1.X509; using Org.BouncyCastle.Math; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Esf { @@ -34,7 +35,7 @@ namespace Org.BouncyCastle.Asn1.Esf throw new ArgumentException( "Unknown object in 'CrlIdentifier' factory: " - + obj.GetType().Name, + + Platform.GetTypeName(obj), "obj"); } diff --git a/crypto/src/asn1/esf/CrlListID.cs b/crypto/src/asn1/esf/CrlListID.cs index 2aae9b965..fbd4fb27c 100644 --- a/crypto/src/asn1/esf/CrlListID.cs +++ b/crypto/src/asn1/esf/CrlListID.cs @@ -1,6 +1,7 @@ using System; using System.Collections; +using Org.BouncyCastle.Utilities; using Org.BouncyCastle.Utilities.Collections; namespace Org.BouncyCastle.Asn1.Esf @@ -30,7 +31,7 @@ namespace Org.BouncyCastle.Asn1.Esf throw new ArgumentException( "Unknown object in 'CrlListID' factory: " - + obj.GetType().Name, + + Platform.GetTypeName(obj), "obj"); } diff --git a/crypto/src/asn1/esf/CrlOcspRef.cs b/crypto/src/asn1/esf/CrlOcspRef.cs index c8e10d504..6153e0c53 100644 --- a/crypto/src/asn1/esf/CrlOcspRef.cs +++ b/crypto/src/asn1/esf/CrlOcspRef.cs @@ -1,5 +1,7 @@ using System; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1.Esf { /// @@ -30,7 +32,7 @@ namespace Org.BouncyCastle.Asn1.Esf throw new ArgumentException( "Unknown object in 'CrlOcspRef' factory: " - + obj.GetType().Name, + + Platform.GetTypeName(obj), "obj"); } diff --git a/crypto/src/asn1/esf/CrlValidatedID.cs b/crypto/src/asn1/esf/CrlValidatedID.cs index 165f547a8..e8cd17a19 100644 --- a/crypto/src/asn1/esf/CrlValidatedID.cs +++ b/crypto/src/asn1/esf/CrlValidatedID.cs @@ -1,5 +1,7 @@ using System; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1.Esf { /// @@ -27,7 +29,7 @@ namespace Org.BouncyCastle.Asn1.Esf throw new ArgumentException( "Unknown object in 'CrlValidatedID' factory: " - + obj.GetType().Name, + + Platform.GetTypeName(obj), "obj"); } diff --git a/crypto/src/asn1/esf/OcspIdentifier.cs b/crypto/src/asn1/esf/OcspIdentifier.cs index 949b68243..e65f1cfe7 100644 --- a/crypto/src/asn1/esf/OcspIdentifier.cs +++ b/crypto/src/asn1/esf/OcspIdentifier.cs @@ -1,6 +1,7 @@ using System; using Org.BouncyCastle.Asn1.Ocsp; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Esf { @@ -32,7 +33,7 @@ namespace Org.BouncyCastle.Asn1.Esf throw new ArgumentException( "Unknown object in 'OcspIdentifier' factory: " - + obj.GetType().Name, + + Platform.GetTypeName(obj), "obj"); } diff --git a/crypto/src/asn1/esf/OcspListID.cs b/crypto/src/asn1/esf/OcspListID.cs index 1f3f3a337..1c8edb16b 100644 --- a/crypto/src/asn1/esf/OcspListID.cs +++ b/crypto/src/asn1/esf/OcspListID.cs @@ -1,6 +1,7 @@ using System; using System.Collections; +using Org.BouncyCastle.Utilities; using Org.BouncyCastle.Utilities.Collections; namespace Org.BouncyCastle.Asn1.Esf @@ -29,7 +30,7 @@ namespace Org.BouncyCastle.Asn1.Esf throw new ArgumentException( "Unknown object in 'OcspListID' factory: " - + obj.GetType().Name, + + Platform.GetTypeName(obj), "obj"); } diff --git a/crypto/src/asn1/esf/OcspResponsesID.cs b/crypto/src/asn1/esf/OcspResponsesID.cs index e09508a01..8718188fc 100644 --- a/crypto/src/asn1/esf/OcspResponsesID.cs +++ b/crypto/src/asn1/esf/OcspResponsesID.cs @@ -1,5 +1,7 @@ using System; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1.Esf { /// @@ -28,7 +30,7 @@ namespace Org.BouncyCastle.Asn1.Esf throw new ArgumentException( "Unknown object in 'OcspResponsesID' factory: " - + obj.GetType().Name, + + Platform.GetTypeName(obj), "obj"); } diff --git a/crypto/src/asn1/esf/OtherCertID.cs b/crypto/src/asn1/esf/OtherCertID.cs index 6d1255535..19d173aa2 100644 --- a/crypto/src/asn1/esf/OtherCertID.cs +++ b/crypto/src/asn1/esf/OtherCertID.cs @@ -1,6 +1,7 @@ using System; using Org.BouncyCastle.Asn1.X509; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Esf { @@ -29,7 +30,7 @@ namespace Org.BouncyCastle.Asn1.Esf throw new ArgumentException( "Unknown object in 'OtherCertID' factory: " - + obj.GetType().Name, + + Platform.GetTypeName(obj), "obj"); } diff --git a/crypto/src/asn1/esf/OtherHashAlgAndValue.cs b/crypto/src/asn1/esf/OtherHashAlgAndValue.cs index b6bd4f498..00eb24c54 100644 --- a/crypto/src/asn1/esf/OtherHashAlgAndValue.cs +++ b/crypto/src/asn1/esf/OtherHashAlgAndValue.cs @@ -1,6 +1,7 @@ using System; using Org.BouncyCastle.Asn1.X509; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Esf { @@ -34,7 +35,7 @@ namespace Org.BouncyCastle.Asn1.Esf throw new ArgumentException( "Unknown object in 'OtherHashAlgAndValue' factory: " - + obj.GetType().Name, + + Platform.GetTypeName(obj), "obj"); } diff --git a/crypto/src/asn1/esf/OtherRevRefs.cs b/crypto/src/asn1/esf/OtherRevRefs.cs index 56713e3f2..446031e5a 100644 --- a/crypto/src/asn1/esf/OtherRevRefs.cs +++ b/crypto/src/asn1/esf/OtherRevRefs.cs @@ -1,5 +1,7 @@ using System; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1.Esf { /// @@ -31,7 +33,7 @@ namespace Org.BouncyCastle.Asn1.Esf throw new ArgumentException( "Unknown object in 'OtherRevRefs' factory: " - + obj.GetType().Name, + + Platform.GetTypeName(obj), "obj"); } diff --git a/crypto/src/asn1/esf/OtherRevVals.cs b/crypto/src/asn1/esf/OtherRevVals.cs index b88a1a72a..7b904565a 100644 --- a/crypto/src/asn1/esf/OtherRevVals.cs +++ b/crypto/src/asn1/esf/OtherRevVals.cs @@ -1,5 +1,7 @@ using System; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1.Esf { /// @@ -31,7 +33,7 @@ namespace Org.BouncyCastle.Asn1.Esf throw new ArgumentException( "Unknown object in 'OtherRevVals' factory: " - + obj.GetType().Name, + + Platform.GetTypeName(obj), "obj"); } diff --git a/crypto/src/asn1/esf/OtherSigningCertificate.cs b/crypto/src/asn1/esf/OtherSigningCertificate.cs index 90e385a33..f7b9f5e66 100644 --- a/crypto/src/asn1/esf/OtherSigningCertificate.cs +++ b/crypto/src/asn1/esf/OtherSigningCertificate.cs @@ -2,6 +2,7 @@ using System; using System.Collections; using Org.BouncyCastle.Asn1.X509; +using Org.BouncyCastle.Utilities; using Org.BouncyCastle.Utilities.Collections; namespace Org.BouncyCastle.Asn1.Esf @@ -31,7 +32,7 @@ namespace Org.BouncyCastle.Asn1.Esf throw new ArgumentException( "Unknown object in 'OtherSigningCertificate' factory: " - + obj.GetType().Name, + + Platform.GetTypeName(obj), "obj"); } diff --git a/crypto/src/asn1/esf/SigPolicyQualifierInfo.cs b/crypto/src/asn1/esf/SigPolicyQualifierInfo.cs index 2d36bc751..470c5c873 100644 --- a/crypto/src/asn1/esf/SigPolicyQualifierInfo.cs +++ b/crypto/src/asn1/esf/SigPolicyQualifierInfo.cs @@ -1,5 +1,7 @@ using System; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1.Esf { /// @@ -29,7 +31,7 @@ namespace Org.BouncyCastle.Asn1.Esf throw new ArgumentException( "Unknown object in 'SigPolicyQualifierInfo' factory: " - + obj.GetType().Name, + + Platform.GetTypeName(obj), "obj"); } diff --git a/crypto/src/asn1/esf/SignaturePolicyId.cs b/crypto/src/asn1/esf/SignaturePolicyId.cs index 545be2cf4..7146bb4c1 100644 --- a/crypto/src/asn1/esf/SignaturePolicyId.cs +++ b/crypto/src/asn1/esf/SignaturePolicyId.cs @@ -1,6 +1,7 @@ using System; using System.Collections; +using Org.BouncyCastle.Utilities; using Org.BouncyCastle.Utilities.Collections; namespace Org.BouncyCastle.Asn1.Esf @@ -36,7 +37,7 @@ namespace Org.BouncyCastle.Asn1.Esf throw new ArgumentException( "Unknown object in 'SignaturePolicyId' factory: " - + obj.GetType().Name, + + Platform.GetTypeName(obj), "obj"); } diff --git a/crypto/src/asn1/esf/SignaturePolicyIdentifier.cs b/crypto/src/asn1/esf/SignaturePolicyIdentifier.cs index 3a639f444..12257f2f0 100644 --- a/crypto/src/asn1/esf/SignaturePolicyIdentifier.cs +++ b/crypto/src/asn1/esf/SignaturePolicyIdentifier.cs @@ -1,5 +1,7 @@ using System; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1.Esf { /// @@ -31,7 +33,7 @@ namespace Org.BouncyCastle.Asn1.Esf throw new ArgumentException( "Unknown object in 'SignaturePolicyIdentifier' factory: " - + obj.GetType().Name, + + Platform.GetTypeName(obj), "obj"); } diff --git a/crypto/src/asn1/esf/SignerAttribute.cs b/crypto/src/asn1/esf/SignerAttribute.cs index ddee53c69..39bd910b2 100644 --- a/crypto/src/asn1/esf/SignerAttribute.cs +++ b/crypto/src/asn1/esf/SignerAttribute.cs @@ -1,6 +1,7 @@ using System; using Org.BouncyCastle.Asn1.X509; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Esf { @@ -21,7 +22,7 @@ namespace Org.BouncyCastle.Asn1.Esf throw new ArgumentException( "Unknown object in 'SignerAttribute' factory: " - + obj.GetType().Name, + + Platform.GetTypeName(obj), "obj"); } diff --git a/crypto/src/asn1/ess/ContentHints.cs b/crypto/src/asn1/ess/ContentHints.cs index a430fea8d..cfd174b3a 100644 --- a/crypto/src/asn1/ess/ContentHints.cs +++ b/crypto/src/asn1/ess/ContentHints.cs @@ -1,5 +1,7 @@ using System; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1.Ess { public class ContentHints @@ -22,7 +24,7 @@ namespace Org.BouncyCastle.Asn1.Ess } throw new ArgumentException("unknown object in 'ContentHints' factory : " - + o.GetType().Name + "."); + + Platform.GetTypeName(o) + "."); } /** diff --git a/crypto/src/asn1/ess/ContentIdentifier.cs b/crypto/src/asn1/ess/ContentIdentifier.cs index 8058dcc53..430185e11 100644 --- a/crypto/src/asn1/ess/ContentIdentifier.cs +++ b/crypto/src/asn1/ess/ContentIdentifier.cs @@ -1,5 +1,7 @@ using System; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1.Ess { public class ContentIdentifier @@ -22,7 +24,7 @@ namespace Org.BouncyCastle.Asn1.Ess throw new ArgumentException( "unknown object in 'ContentIdentifier' factory : " - + o.GetType().Name + "."); + + Platform.GetTypeName(o) + "."); } /** diff --git a/crypto/src/asn1/ess/ESSCertID.cs b/crypto/src/asn1/ess/ESSCertID.cs index 4d449a746..b4465ea4f 100644 --- a/crypto/src/asn1/ess/ESSCertID.cs +++ b/crypto/src/asn1/ess/ESSCertID.cs @@ -1,6 +1,7 @@ using System; using Org.BouncyCastle.Asn1.X509; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Ess { @@ -25,7 +26,7 @@ namespace Org.BouncyCastle.Asn1.Ess throw new ArgumentException( "unknown object in 'EssCertID' factory : " - + o.GetType().Name + "."); + + Platform.GetTypeName(o) + "."); } /** diff --git a/crypto/src/asn1/ess/OtherCertID.cs b/crypto/src/asn1/ess/OtherCertID.cs index 3d221b0ec..7794c81fa 100644 --- a/crypto/src/asn1/ess/OtherCertID.cs +++ b/crypto/src/asn1/ess/OtherCertID.cs @@ -2,6 +2,7 @@ using System; using Org.BouncyCastle.Asn1.Oiw; using Org.BouncyCastle.Asn1.X509; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Ess { @@ -27,7 +28,7 @@ namespace Org.BouncyCastle.Asn1.Ess throw new ArgumentException( "unknown object in 'OtherCertID' factory : " - + o.GetType().Name + "."); + + Platform.GetTypeName(o) + "."); } /** diff --git a/crypto/src/asn1/ess/OtherSigningCertificate.cs b/crypto/src/asn1/ess/OtherSigningCertificate.cs index c165fecea..6cef92b62 100644 --- a/crypto/src/asn1/ess/OtherSigningCertificate.cs +++ b/crypto/src/asn1/ess/OtherSigningCertificate.cs @@ -1,6 +1,7 @@ using System; using Org.BouncyCastle.Asn1.X509; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Ess { @@ -25,7 +26,7 @@ namespace Org.BouncyCastle.Asn1.Ess throw new ArgumentException( "unknown object in 'OtherSigningCertificate' factory : " - + o.GetType().Name + "."); + + Platform.GetTypeName(o) + "."); } /** diff --git a/crypto/src/asn1/ess/SigningCertificate.cs b/crypto/src/asn1/ess/SigningCertificate.cs index 366749bc3..51f67c1ff 100644 --- a/crypto/src/asn1/ess/SigningCertificate.cs +++ b/crypto/src/asn1/ess/SigningCertificate.cs @@ -1,6 +1,7 @@ using System; using Org.BouncyCastle.Asn1.X509; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Ess { @@ -24,7 +25,7 @@ namespace Org.BouncyCastle.Asn1.Ess throw new ArgumentException( "unknown object in 'SigningCertificate' factory : " - + o.GetType().Name + "."); + + Platform.GetTypeName(o) + "."); } /** diff --git a/crypto/src/asn1/ess/SigningCertificateV2.cs b/crypto/src/asn1/ess/SigningCertificateV2.cs index cabecc1ba..91eda9e33 100644 --- a/crypto/src/asn1/ess/SigningCertificateV2.cs +++ b/crypto/src/asn1/ess/SigningCertificateV2.cs @@ -1,6 +1,7 @@ using System; using Org.BouncyCastle.Asn1.X509; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Ess { @@ -21,7 +22,7 @@ namespace Org.BouncyCastle.Asn1.Ess throw new ArgumentException( "unknown object in 'SigningCertificateV2' factory : " - + o.GetType().Name + "."); + + Platform.GetTypeName(o) + "."); } private SigningCertificateV2( diff --git a/crypto/src/asn1/isismtt/ocsp/CertHash.cs b/crypto/src/asn1/isismtt/ocsp/CertHash.cs index da5b530e4..5773e1c56 100644 --- a/crypto/src/asn1/isismtt/ocsp/CertHash.cs +++ b/crypto/src/asn1/isismtt/ocsp/CertHash.cs @@ -1,6 +1,7 @@ using System; using Org.BouncyCastle.Asn1.X509; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.IsisMtt.Ocsp { @@ -43,7 +44,7 @@ namespace Org.BouncyCastle.Asn1.IsisMtt.Ocsp return new CertHash((Asn1Sequence) obj); } - throw new ArgumentException("unknown object in factory: " + obj.GetType().Name, "obj"); + throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } /** diff --git a/crypto/src/asn1/isismtt/ocsp/RequestedCertificate.cs b/crypto/src/asn1/isismtt/ocsp/RequestedCertificate.cs index 7724bfed6..413b3bd7f 100644 --- a/crypto/src/asn1/isismtt/ocsp/RequestedCertificate.cs +++ b/crypto/src/asn1/isismtt/ocsp/RequestedCertificate.cs @@ -1,6 +1,8 @@ using System; using System.IO; + using Org.BouncyCastle.Asn1.X509; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.IsisMtt.Ocsp { @@ -69,7 +71,7 @@ namespace Org.BouncyCastle.Asn1.IsisMtt.Ocsp return new RequestedCertificate((Asn1TaggedObject) obj); } - throw new ArgumentException("unknown object in factory: " + obj.GetType().Name, "obj"); + throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } public static RequestedCertificate GetInstance( diff --git a/crypto/src/asn1/isismtt/x509/AdditionalInformationSyntax.cs b/crypto/src/asn1/isismtt/x509/AdditionalInformationSyntax.cs index f81d459c6..53a8e98a7 100644 --- a/crypto/src/asn1/isismtt/x509/AdditionalInformationSyntax.cs +++ b/crypto/src/asn1/isismtt/x509/AdditionalInformationSyntax.cs @@ -1,6 +1,7 @@ using System; using Org.BouncyCastle.Asn1.X500; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.IsisMtt.X509 { @@ -26,7 +27,7 @@ namespace Org.BouncyCastle.Asn1.IsisMtt.X509 if (obj is IAsn1String) return new AdditionalInformationSyntax(DirectoryString.GetInstance(obj)); - throw new ArgumentException("Unknown object in GetInstance: " + obj.GetType().Name, "obj"); + throw new ArgumentException("Unknown object in GetInstance: " + Platform.GetTypeName(obj), "obj"); } private AdditionalInformationSyntax( diff --git a/crypto/src/asn1/isismtt/x509/AdmissionSyntax.cs b/crypto/src/asn1/isismtt/x509/AdmissionSyntax.cs index 64b5dbec8..4b6264ae0 100644 --- a/crypto/src/asn1/isismtt/x509/AdmissionSyntax.cs +++ b/crypto/src/asn1/isismtt/x509/AdmissionSyntax.cs @@ -1,6 +1,7 @@ using System; using Org.BouncyCastle.Asn1.X509; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.IsisMtt.X509 { @@ -130,7 +131,7 @@ namespace Org.BouncyCastle.Asn1.IsisMtt.X509 return new AdmissionSyntax((Asn1Sequence)obj); } - throw new ArgumentException("unknown object in factory: " + obj.GetType().Name, "obj"); + throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } /** diff --git a/crypto/src/asn1/isismtt/x509/Admissions.cs b/crypto/src/asn1/isismtt/x509/Admissions.cs index 40290c608..e914db0b5 100644 --- a/crypto/src/asn1/isismtt/x509/Admissions.cs +++ b/crypto/src/asn1/isismtt/x509/Admissions.cs @@ -2,6 +2,7 @@ using System; using System.Collections; using Org.BouncyCastle.Asn1.X509; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.IsisMtt.X509 { @@ -42,7 +43,7 @@ namespace Org.BouncyCastle.Asn1.IsisMtt.X509 return new Admissions((Asn1Sequence) obj); } - throw new ArgumentException("unknown object in factory: " + obj.GetType().Name, "obj"); + throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } /** @@ -103,7 +104,7 @@ namespace Org.BouncyCastle.Asn1.IsisMtt.X509 professionInfos = Asn1Sequence.GetInstance(o); if (e.MoveNext()) { - throw new ArgumentException("Bad object encountered: " + e.Current.GetType().Name); + throw new ArgumentException("Bad object encountered: " + Platform.GetTypeName(e.Current)); } } diff --git a/crypto/src/asn1/isismtt/x509/DeclarationOfMajority.cs b/crypto/src/asn1/isismtt/x509/DeclarationOfMajority.cs index dfac65040..c4ebb2b72 100644 --- a/crypto/src/asn1/isismtt/x509/DeclarationOfMajority.cs +++ b/crypto/src/asn1/isismtt/x509/DeclarationOfMajority.cs @@ -1,5 +1,7 @@ using System; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1.IsisMtt.X509 { /** @@ -80,7 +82,7 @@ namespace Org.BouncyCastle.Asn1.IsisMtt.X509 return new DeclarationOfMajority((Asn1TaggedObject) obj); } - throw new ArgumentException("unknown object in factory: " + obj.GetType().Name, "obj"); + throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } private DeclarationOfMajority( diff --git a/crypto/src/asn1/isismtt/x509/MonetaryLimit.cs b/crypto/src/asn1/isismtt/x509/MonetaryLimit.cs index 80b6b684b..b792fffda 100644 --- a/crypto/src/asn1/isismtt/x509/MonetaryLimit.cs +++ b/crypto/src/asn1/isismtt/x509/MonetaryLimit.cs @@ -1,6 +1,7 @@ using System; using Org.BouncyCastle.Math; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.IsisMtt.X509 { @@ -48,7 +49,7 @@ namespace Org.BouncyCastle.Asn1.IsisMtt.X509 return new MonetaryLimit(Asn1Sequence.GetInstance(obj)); } - throw new ArgumentException("unknown object in factory: " + obj.GetType().Name, "obj"); + throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } private MonetaryLimit( diff --git a/crypto/src/asn1/isismtt/x509/NamingAuthority.cs b/crypto/src/asn1/isismtt/x509/NamingAuthority.cs index 4262fd0f4..35539f488 100644 --- a/crypto/src/asn1/isismtt/x509/NamingAuthority.cs +++ b/crypto/src/asn1/isismtt/x509/NamingAuthority.cs @@ -2,6 +2,7 @@ using System; using System.Collections; using Org.BouncyCastle.Asn1.X500; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.IsisMtt.X509 { @@ -49,7 +50,7 @@ namespace Org.BouncyCastle.Asn1.IsisMtt.X509 return new NamingAuthority((Asn1Sequence) obj); } - throw new ArgumentException("unknown object in factory: " + obj.GetType().Name, "obj"); + throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } public static NamingAuthority GetInstance( @@ -99,7 +100,7 @@ namespace Org.BouncyCastle.Asn1.IsisMtt.X509 } else { - throw new ArgumentException("Bad object encountered: " + o.GetType().Name); + throw new ArgumentException("Bad object encountered: " + Platform.GetTypeName(o)); } } @@ -116,7 +117,7 @@ namespace Org.BouncyCastle.Asn1.IsisMtt.X509 } else { - throw new ArgumentException("Bad object encountered: " + o.GetType().Name); + throw new ArgumentException("Bad object encountered: " + Platform.GetTypeName(o)); } } @@ -129,7 +130,7 @@ namespace Org.BouncyCastle.Asn1.IsisMtt.X509 } else { - throw new ArgumentException("Bad object encountered: " + o.GetType().Name); + throw new ArgumentException("Bad object encountered: " + Platform.GetTypeName(o)); } } } diff --git a/crypto/src/asn1/isismtt/x509/ProcurationSyntax.cs b/crypto/src/asn1/isismtt/x509/ProcurationSyntax.cs index a25df225e..f42364699 100644 --- a/crypto/src/asn1/isismtt/x509/ProcurationSyntax.cs +++ b/crypto/src/asn1/isismtt/x509/ProcurationSyntax.cs @@ -3,6 +3,7 @@ using System.Collections; using Org.BouncyCastle.Asn1.X500; using Org.BouncyCastle.Asn1.X509; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.IsisMtt.X509 { @@ -61,7 +62,7 @@ namespace Org.BouncyCastle.Asn1.IsisMtt.X509 return new ProcurationSyntax((Asn1Sequence) obj); } - throw new ArgumentException("unknown object in factory: " + obj.GetType().Name, "obj"); + throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } /** diff --git a/crypto/src/asn1/isismtt/x509/ProfessionInfo.cs b/crypto/src/asn1/isismtt/x509/ProfessionInfo.cs index 3bad2cbc4..671a465af 100644 --- a/crypto/src/asn1/isismtt/x509/ProfessionInfo.cs +++ b/crypto/src/asn1/isismtt/x509/ProfessionInfo.cs @@ -2,6 +2,7 @@ using System; using System.Collections; using Org.BouncyCastle.Asn1.X500; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.IsisMtt.X509 { @@ -157,7 +158,7 @@ namespace Org.BouncyCastle.Asn1.IsisMtt.X509 return new ProfessionInfo((Asn1Sequence) obj); } - throw new ArgumentException("unknown object in factory: " + obj.GetType().Name, "obj"); + throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } /** @@ -218,7 +219,7 @@ namespace Org.BouncyCastle.Asn1.IsisMtt.X509 } else { - throw new ArgumentException("Bad object encountered: " + o.GetType().Name); + throw new ArgumentException("Bad object encountered: " + Platform.GetTypeName(o)); } } @@ -235,7 +236,7 @@ namespace Org.BouncyCastle.Asn1.IsisMtt.X509 } else { - throw new ArgumentException("Bad object encountered: " + o.GetType().Name); + throw new ArgumentException("Bad object encountered: " + Platform.GetTypeName(o)); } } @@ -248,7 +249,7 @@ namespace Org.BouncyCastle.Asn1.IsisMtt.X509 } else { - throw new ArgumentException("Bad object encountered: " + o.GetType().Name); + throw new ArgumentException("Bad object encountered: " + Platform.GetTypeName(o)); } } } diff --git a/crypto/src/asn1/isismtt/x509/Restriction.cs b/crypto/src/asn1/isismtt/x509/Restriction.cs index c97766999..75df25201 100644 --- a/crypto/src/asn1/isismtt/x509/Restriction.cs +++ b/crypto/src/asn1/isismtt/x509/Restriction.cs @@ -1,6 +1,7 @@ using System; using Org.BouncyCastle.Asn1.X500; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.IsisMtt.X509 { @@ -25,7 +26,7 @@ namespace Org.BouncyCastle.Asn1.IsisMtt.X509 if (obj is IAsn1String) return new Restriction(DirectoryString.GetInstance(obj)); - throw new ArgumentException("Unknown object in GetInstance: " + obj.GetType().Name, "obj"); + throw new ArgumentException("Unknown object in GetInstance: " + Platform.GetTypeName(obj), "obj"); } /** diff --git a/crypto/src/asn1/mozilla/PublicKeyAndChallenge.cs b/crypto/src/asn1/mozilla/PublicKeyAndChallenge.cs index 1e08b809d..ff2a1199f 100644 --- a/crypto/src/asn1/mozilla/PublicKeyAndChallenge.cs +++ b/crypto/src/asn1/mozilla/PublicKeyAndChallenge.cs @@ -1,6 +1,7 @@ using System; using Org.BouncyCastle.Asn1.X509; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Mozilla { @@ -38,7 +39,7 @@ namespace Org.BouncyCastle.Asn1.Mozilla throw new ArgumentException( "unknown object in 'PublicKeyAndChallenge' factory : " - + obj.GetType().Name + "."); + + Platform.GetTypeName(obj) + "."); } public PublicKeyAndChallenge( diff --git a/crypto/src/asn1/ocsp/BasicOCSPResponse.cs b/crypto/src/asn1/ocsp/BasicOCSPResponse.cs index 064335ae8..e6aa1f86b 100644 --- a/crypto/src/asn1/ocsp/BasicOCSPResponse.cs +++ b/crypto/src/asn1/ocsp/BasicOCSPResponse.cs @@ -2,6 +2,7 @@ using System; using Org.BouncyCastle.Asn1; using Org.BouncyCastle.Asn1.X509; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Ocsp { @@ -33,7 +34,7 @@ namespace Org.BouncyCastle.Asn1.Ocsp return new BasicOcspResponse((Asn1Sequence)obj); } - throw new ArgumentException("unknown object in factory: " + obj.GetType().Name, "obj"); + throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } public BasicOcspResponse( diff --git a/crypto/src/asn1/ocsp/CertID.cs b/crypto/src/asn1/ocsp/CertID.cs index 4b251095b..523f6b87c 100644 --- a/crypto/src/asn1/ocsp/CertID.cs +++ b/crypto/src/asn1/ocsp/CertID.cs @@ -2,6 +2,7 @@ using System; using Org.BouncyCastle.Asn1; using Org.BouncyCastle.Asn1.X509; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Ocsp { @@ -33,7 +34,7 @@ namespace Org.BouncyCastle.Asn1.Ocsp return new CertID((Asn1Sequence)obj); } - throw new ArgumentException("unknown object in factory: " + obj.GetType().Name, "obj"); + throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } public CertID( diff --git a/crypto/src/asn1/ocsp/CertStatus.cs b/crypto/src/asn1/ocsp/CertStatus.cs index d5b1a94a2..b524364c9 100644 --- a/crypto/src/asn1/ocsp/CertStatus.cs +++ b/crypto/src/asn1/ocsp/CertStatus.cs @@ -1,6 +1,6 @@ using System; -using Org.BouncyCastle.Asn1; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Ocsp { @@ -64,7 +64,7 @@ namespace Org.BouncyCastle.Asn1.Ocsp return new CertStatus((Asn1TaggedObject)obj); } - throw new ArgumentException("unknown object in factory: " + obj.GetType().Name, "obj"); + throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } public int TagNo diff --git a/crypto/src/asn1/ocsp/OCSPRequest.cs b/crypto/src/asn1/ocsp/OCSPRequest.cs index 1e804d78e..2407678b4 100644 --- a/crypto/src/asn1/ocsp/OCSPRequest.cs +++ b/crypto/src/asn1/ocsp/OCSPRequest.cs @@ -1,6 +1,6 @@ using System; -using Org.BouncyCastle.Asn1; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Ocsp { @@ -30,7 +30,7 @@ namespace Org.BouncyCastle.Asn1.Ocsp return new OcspRequest((Asn1Sequence)obj); } - throw new ArgumentException("unknown object in factory: " + obj.GetType().Name, "obj"); + throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } public OcspRequest( diff --git a/crypto/src/asn1/ocsp/OCSPResponse.cs b/crypto/src/asn1/ocsp/OCSPResponse.cs index e9aad8100..9477b61c0 100644 --- a/crypto/src/asn1/ocsp/OCSPResponse.cs +++ b/crypto/src/asn1/ocsp/OCSPResponse.cs @@ -1,6 +1,6 @@ using System; -using Org.BouncyCastle.Asn1; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Ocsp { @@ -30,7 +30,7 @@ namespace Org.BouncyCastle.Asn1.Ocsp return new OcspResponse((Asn1Sequence)obj); } - throw new ArgumentException("unknown object in factory: " + obj.GetType().Name, "obj"); + throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } public OcspResponse( diff --git a/crypto/src/asn1/ocsp/Request.cs b/crypto/src/asn1/ocsp/Request.cs index 116c15e73..26e81ba70 100644 --- a/crypto/src/asn1/ocsp/Request.cs +++ b/crypto/src/asn1/ocsp/Request.cs @@ -2,6 +2,7 @@ using System; using Org.BouncyCastle.Asn1; using Org.BouncyCastle.Asn1.X509; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Ocsp { @@ -31,7 +32,7 @@ namespace Org.BouncyCastle.Asn1.Ocsp return new Request((Asn1Sequence)obj); } - throw new ArgumentException("unknown object in factory: " + obj.GetType().Name, "obj"); + throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } public Request( diff --git a/crypto/src/asn1/ocsp/ResponseBytes.cs b/crypto/src/asn1/ocsp/ResponseBytes.cs index 2ce59faea..d3ea044bf 100644 --- a/crypto/src/asn1/ocsp/ResponseBytes.cs +++ b/crypto/src/asn1/ocsp/ResponseBytes.cs @@ -1,6 +1,6 @@ using System; -using Org.BouncyCastle.Asn1; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Ocsp { @@ -30,7 +30,7 @@ namespace Org.BouncyCastle.Asn1.Ocsp return new ResponseBytes((Asn1Sequence)obj); } - throw new ArgumentException("unknown object in factory: " + obj.GetType().Name, "obj"); + throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } public ResponseBytes( diff --git a/crypto/src/asn1/ocsp/ResponseData.cs b/crypto/src/asn1/ocsp/ResponseData.cs index 173829db8..70620cbc3 100644 --- a/crypto/src/asn1/ocsp/ResponseData.cs +++ b/crypto/src/asn1/ocsp/ResponseData.cs @@ -1,7 +1,7 @@ using System; -using Org.BouncyCastle.Asn1; using Org.BouncyCastle.Asn1.X509; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Ocsp { @@ -37,7 +37,7 @@ namespace Org.BouncyCastle.Asn1.Ocsp return new ResponseData((Asn1Sequence)obj); } - throw new ArgumentException("unknown object in factory: " + obj.GetType().Name, "obj"); + throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } public ResponseData( diff --git a/crypto/src/asn1/ocsp/RevokedInfo.cs b/crypto/src/asn1/ocsp/RevokedInfo.cs index 7d9d590e3..ee9e55429 100644 --- a/crypto/src/asn1/ocsp/RevokedInfo.cs +++ b/crypto/src/asn1/ocsp/RevokedInfo.cs @@ -1,7 +1,7 @@ using System; -using Org.BouncyCastle.Asn1; using Org.BouncyCastle.Asn1.X509; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Ocsp { @@ -31,7 +31,7 @@ namespace Org.BouncyCastle.Asn1.Ocsp return new RevokedInfo((Asn1Sequence) obj); } - throw new ArgumentException("unknown object in factory: " + obj.GetType().Name, "obj"); + throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } public RevokedInfo( diff --git a/crypto/src/asn1/ocsp/ServiceLocator.cs b/crypto/src/asn1/ocsp/ServiceLocator.cs index 56bc49ded..4ba252be3 100644 --- a/crypto/src/asn1/ocsp/ServiceLocator.cs +++ b/crypto/src/asn1/ocsp/ServiceLocator.cs @@ -1,7 +1,7 @@ using System; -using Org.BouncyCastle.Asn1; using Org.BouncyCastle.Asn1.X509; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Ocsp { @@ -31,7 +31,7 @@ namespace Org.BouncyCastle.Asn1.Ocsp return new ServiceLocator((Asn1Sequence) obj); } - throw new ArgumentException("unknown object in factory: " + obj.GetType().Name, "obj"); + throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } public ServiceLocator( diff --git a/crypto/src/asn1/ocsp/Signature.cs b/crypto/src/asn1/ocsp/Signature.cs index df6f43332..d6b4ccfbf 100644 --- a/crypto/src/asn1/ocsp/Signature.cs +++ b/crypto/src/asn1/ocsp/Signature.cs @@ -1,7 +1,7 @@ using System; -using Org.BouncyCastle.Asn1; using Org.BouncyCastle.Asn1.X509; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Ocsp { @@ -32,7 +32,7 @@ namespace Org.BouncyCastle.Asn1.Ocsp return new Signature((Asn1Sequence)obj); } - throw new ArgumentException("unknown object in factory: " + obj.GetType().Name, "obj"); + throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } public Signature( diff --git a/crypto/src/asn1/ocsp/SingleResponse.cs b/crypto/src/asn1/ocsp/SingleResponse.cs index 93d4c21d6..544232abe 100644 --- a/crypto/src/asn1/ocsp/SingleResponse.cs +++ b/crypto/src/asn1/ocsp/SingleResponse.cs @@ -1,8 +1,8 @@ -using Org.BouncyCastle.Asn1; -using Org.BouncyCastle.Asn1.X509; - using System; +using Org.BouncyCastle.Asn1.X509; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1.Ocsp { public class SingleResponse @@ -77,7 +77,7 @@ namespace Org.BouncyCastle.Asn1.Ocsp return new SingleResponse((Asn1Sequence)obj); } - throw new ArgumentException("unknown object in factory: " + obj.GetType().Name, "obj"); + throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } public CertID CertId diff --git a/crypto/src/asn1/ocsp/TBSRequest.cs b/crypto/src/asn1/ocsp/TBSRequest.cs index 6bf75eb96..1ad8649f8 100644 --- a/crypto/src/asn1/ocsp/TBSRequest.cs +++ b/crypto/src/asn1/ocsp/TBSRequest.cs @@ -1,8 +1,8 @@ -using Org.BouncyCastle.Asn1; -using Org.BouncyCastle.Asn1.X509; - using System; +using Org.BouncyCastle.Asn1.X509; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1.Ocsp { public class TbsRequest @@ -37,7 +37,7 @@ namespace Org.BouncyCastle.Asn1.Ocsp return new TbsRequest((Asn1Sequence)obj); } - throw new ArgumentException("unknown object in factory: " + obj.GetType().Name, "obj"); + throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } public TbsRequest( diff --git a/crypto/src/asn1/pkcs/Attribute.cs b/crypto/src/asn1/pkcs/Attribute.cs index ceec115bd..185828596 100644 --- a/crypto/src/asn1/pkcs/Attribute.cs +++ b/crypto/src/asn1/pkcs/Attribute.cs @@ -1,6 +1,6 @@ using System; -using Org.BouncyCastle.Asn1; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Pkcs { @@ -31,7 +31,7 @@ namespace Org.BouncyCastle.Asn1.Pkcs return new AttributePkcs(seq); } - throw new ArgumentException("Unknown object in factory: " + obj.GetType().FullName, "obj"); + throw new ArgumentException("Unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } private AttributePkcs( diff --git a/crypto/src/asn1/pkcs/CertificationRequestInfo.cs b/crypto/src/asn1/pkcs/CertificationRequestInfo.cs index 690d06878..d57753235 100644 --- a/crypto/src/asn1/pkcs/CertificationRequestInfo.cs +++ b/crypto/src/asn1/pkcs/CertificationRequestInfo.cs @@ -1,6 +1,7 @@ using System; using Org.BouncyCastle.Asn1.X509; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Pkcs { @@ -43,7 +44,7 @@ namespace Org.BouncyCastle.Asn1.Pkcs return new CertificationRequestInfo((Asn1Sequence) obj); } - throw new ArgumentException("Unknown object in factory: " + obj.GetType().FullName, "obj"); + throw new ArgumentException("Unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } public CertificationRequestInfo( diff --git a/crypto/src/asn1/pkcs/EncryptedData.cs b/crypto/src/asn1/pkcs/EncryptedData.cs index 912064ace..7e95eb586 100644 --- a/crypto/src/asn1/pkcs/EncryptedData.cs +++ b/crypto/src/asn1/pkcs/EncryptedData.cs @@ -1,6 +1,7 @@ using System; using Org.BouncyCastle.Asn1.X509; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Pkcs { @@ -42,7 +43,7 @@ namespace Org.BouncyCastle.Asn1.Pkcs return new EncryptedData((Asn1Sequence) obj); } - throw new ArgumentException("Unknown object in factory: " + obj.GetType().FullName, "obj"); + throw new ArgumentException("Unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } private EncryptedData( diff --git a/crypto/src/asn1/pkcs/EncryptedPrivateKeyInfo.cs b/crypto/src/asn1/pkcs/EncryptedPrivateKeyInfo.cs index b97b8f5ea..987027009 100644 --- a/crypto/src/asn1/pkcs/EncryptedPrivateKeyInfo.cs +++ b/crypto/src/asn1/pkcs/EncryptedPrivateKeyInfo.cs @@ -2,6 +2,7 @@ using System; using System.Collections; using Org.BouncyCastle.Asn1.X509; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Pkcs { @@ -42,7 +43,7 @@ namespace Org.BouncyCastle.Asn1.Pkcs return new EncryptedPrivateKeyInfo((Asn1Sequence) obj); } - throw new ArgumentException("Unknown object in factory: " + obj.GetType().FullName, "obj"); + throw new ArgumentException("Unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } public AlgorithmIdentifier EncryptionAlgorithm diff --git a/crypto/src/asn1/pkcs/EncryptionScheme.cs b/crypto/src/asn1/pkcs/EncryptionScheme.cs index ff9103d12..7b90ece53 100644 --- a/crypto/src/asn1/pkcs/EncryptionScheme.cs +++ b/crypto/src/asn1/pkcs/EncryptionScheme.cs @@ -1,7 +1,7 @@ using System; -using Org.BouncyCastle.Asn1; using Org.BouncyCastle.Asn1.X509; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Pkcs { @@ -33,7 +33,7 @@ namespace Org.BouncyCastle.Asn1.Pkcs return new EncryptionScheme((Asn1Sequence)obj); } - throw new ArgumentException("Unknown object in factory: " + obj.GetType().FullName, "obj"); + throw new ArgumentException("Unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } public Asn1Object Asn1Object diff --git a/crypto/src/asn1/pkcs/IssuerAndSerialNumber.cs b/crypto/src/asn1/pkcs/IssuerAndSerialNumber.cs index ff608f15b..da863cb62 100644 --- a/crypto/src/asn1/pkcs/IssuerAndSerialNumber.cs +++ b/crypto/src/asn1/pkcs/IssuerAndSerialNumber.cs @@ -2,6 +2,7 @@ using System; using Org.BouncyCastle.Asn1.X509; using Org.BouncyCastle.Math; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Pkcs { @@ -24,7 +25,7 @@ namespace Org.BouncyCastle.Asn1.Pkcs return new IssuerAndSerialNumber((Asn1Sequence) obj); } - throw new ArgumentException("Unknown object in factory: " + obj.GetType().FullName, "obj"); + throw new ArgumentException("Unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } private IssuerAndSerialNumber( diff --git a/crypto/src/asn1/pkcs/MacData.cs b/crypto/src/asn1/pkcs/MacData.cs index 780b24153..c4b7df176 100644 --- a/crypto/src/asn1/pkcs/MacData.cs +++ b/crypto/src/asn1/pkcs/MacData.cs @@ -1,8 +1,8 @@ using System; -using Org.BouncyCastle.Asn1; using Org.BouncyCastle.Asn1.X509; using Org.BouncyCastle.Math; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Pkcs { @@ -26,7 +26,7 @@ namespace Org.BouncyCastle.Asn1.Pkcs return new MacData((Asn1Sequence) obj); } - throw new ArgumentException("Unknown object in factory: " + obj.GetType().FullName, "obj"); + throw new ArgumentException("Unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } private MacData( diff --git a/crypto/src/asn1/pkcs/PBEParameter.cs b/crypto/src/asn1/pkcs/PBEParameter.cs index 80d5ec3e1..56cea5fb7 100644 --- a/crypto/src/asn1/pkcs/PBEParameter.cs +++ b/crypto/src/asn1/pkcs/PBEParameter.cs @@ -1,8 +1,8 @@ using System; using System.Collections; -using Org.BouncyCastle.Asn1; using Org.BouncyCastle.Math; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Pkcs { @@ -24,7 +24,7 @@ namespace Org.BouncyCastle.Asn1.Pkcs return new PbeParameter((Asn1Sequence) obj); } - throw new ArgumentException("Unknown object in factory: " + obj.GetType().FullName, "obj"); + throw new ArgumentException("Unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } private PbeParameter(Asn1Sequence seq) diff --git a/crypto/src/asn1/pkcs/PBKDF2Params.cs b/crypto/src/asn1/pkcs/PBKDF2Params.cs index 5d1e9854f..279f30de8 100644 --- a/crypto/src/asn1/pkcs/PBKDF2Params.cs +++ b/crypto/src/asn1/pkcs/PBKDF2Params.cs @@ -1,6 +1,8 @@ using System; + using Org.BouncyCastle.Asn1.X509; using Org.BouncyCastle.Math; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Pkcs { @@ -22,7 +24,7 @@ namespace Org.BouncyCastle.Asn1.Pkcs if (obj is Asn1Sequence) return new Pbkdf2Params((Asn1Sequence)obj); - throw new ArgumentException("Unknown object in factory: " + obj.GetType().FullName, "obj"); + throw new ArgumentException("Unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } public Pbkdf2Params( diff --git a/crypto/src/asn1/pkcs/PKCS12PBEParams.cs b/crypto/src/asn1/pkcs/PKCS12PBEParams.cs index 7521f93ea..b41c289d8 100644 --- a/crypto/src/asn1/pkcs/PKCS12PBEParams.cs +++ b/crypto/src/asn1/pkcs/PKCS12PBEParams.cs @@ -1,7 +1,7 @@ using System; -using Org.BouncyCastle.Asn1; using Org.BouncyCastle.Math; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Pkcs { @@ -42,7 +42,7 @@ namespace Org.BouncyCastle.Asn1.Pkcs return new Pkcs12PbeParams((Asn1Sequence) obj); } - throw new ArgumentException("Unknown object in factory: " + obj.GetType().FullName, "obj"); + throw new ArgumentException("Unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } public BigInteger Iterations diff --git a/crypto/src/asn1/pkcs/RC2CBCParameter.cs b/crypto/src/asn1/pkcs/RC2CBCParameter.cs index f5355d012..880ca7443 100644 --- a/crypto/src/asn1/pkcs/RC2CBCParameter.cs +++ b/crypto/src/asn1/pkcs/RC2CBCParameter.cs @@ -1,6 +1,5 @@ using System; -using Org.BouncyCastle.Asn1; using Org.BouncyCastle.Math; using Org.BouncyCastle.Utilities; @@ -20,7 +19,7 @@ namespace Org.BouncyCastle.Asn1.Pkcs return new RC2CbcParameter((Asn1Sequence) obj); } - throw new ArgumentException("Unknown object in factory: " + obj.GetType().FullName, "obj"); + throw new ArgumentException("Unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } public RC2CbcParameter( diff --git a/crypto/src/asn1/pkcs/RSAESOAEPparams.cs b/crypto/src/asn1/pkcs/RSAESOAEPparams.cs index 5ecb394fd..0cf22f860 100644 --- a/crypto/src/asn1/pkcs/RSAESOAEPparams.cs +++ b/crypto/src/asn1/pkcs/RSAESOAEPparams.cs @@ -2,6 +2,7 @@ using System; using Org.BouncyCastle.Asn1.Oiw; using Org.BouncyCastle.Asn1.X509; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Pkcs { @@ -28,7 +29,7 @@ namespace Org.BouncyCastle.Asn1.Pkcs return new RsaesOaepParameters((Asn1Sequence)obj); } - throw new ArgumentException("Unknown object in factory: " + obj.GetType().FullName, "obj"); + throw new ArgumentException("Unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } /** diff --git a/crypto/src/asn1/pkcs/RSASSAPSSparams.cs b/crypto/src/asn1/pkcs/RSASSAPSSparams.cs index 941620761..85849c362 100644 --- a/crypto/src/asn1/pkcs/RSASSAPSSparams.cs +++ b/crypto/src/asn1/pkcs/RSASSAPSSparams.cs @@ -2,6 +2,7 @@ using System; using Org.BouncyCastle.Asn1.Oiw; using Org.BouncyCastle.Asn1.X509; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Pkcs { @@ -31,7 +32,7 @@ namespace Org.BouncyCastle.Asn1.Pkcs return new RsassaPssParameters((Asn1Sequence)obj); } - throw new ArgumentException("Unknown object in factory: " + obj.GetType().FullName, "obj"); + throw new ArgumentException("Unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } /** diff --git a/crypto/src/asn1/pkcs/SignerInfo.cs b/crypto/src/asn1/pkcs/SignerInfo.cs index 1e4694547..a3dc48b5b 100644 --- a/crypto/src/asn1/pkcs/SignerInfo.cs +++ b/crypto/src/asn1/pkcs/SignerInfo.cs @@ -1,8 +1,8 @@ using System; using System.Collections; -using Org.BouncyCastle.Asn1; using Org.BouncyCastle.Asn1.X509; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Pkcs { @@ -33,7 +33,7 @@ namespace Org.BouncyCastle.Asn1.Pkcs return new SignerInfo((Asn1Sequence) obj); } - throw new ArgumentException("Unknown object in factory: " + obj.GetType().FullName, "obj"); + throw new ArgumentException("Unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } public SignerInfo( diff --git a/crypto/src/asn1/smime/SMIMECapabilities.cs b/crypto/src/asn1/smime/SMIMECapabilities.cs index 6435caf68..5bf48f321 100644 --- a/crypto/src/asn1/smime/SMIMECapabilities.cs +++ b/crypto/src/asn1/smime/SMIMECapabilities.cs @@ -62,7 +62,7 @@ namespace Org.BouncyCastle.Asn1.Smime (Asn1Sequence)(((AttributeX509) obj).AttrValues[0])); } - throw new ArgumentException("unknown object in factory: " + obj.GetType().Name, "obj"); + throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } public SmimeCapabilities( diff --git a/crypto/src/asn1/tsp/Accuracy.cs b/crypto/src/asn1/tsp/Accuracy.cs index a193f52ff..9f2c7e8cc 100644 --- a/crypto/src/asn1/tsp/Accuracy.cs +++ b/crypto/src/asn1/tsp/Accuracy.cs @@ -1,5 +1,7 @@ using System; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1.Tsp { public class Accuracy @@ -97,7 +99,7 @@ namespace Org.BouncyCastle.Asn1.Tsp } throw new ArgumentException( - "Unknown object in 'Accuracy' factory: " + o.GetType().FullName); + "Unknown object in 'Accuracy' factory: " + Platform.GetTypeName(o)); } public DerInteger Seconds diff --git a/crypto/src/asn1/tsp/MessageImprint.cs b/crypto/src/asn1/tsp/MessageImprint.cs index 0933bae21..44ef7d177 100644 --- a/crypto/src/asn1/tsp/MessageImprint.cs +++ b/crypto/src/asn1/tsp/MessageImprint.cs @@ -1,6 +1,7 @@ using System; using Org.BouncyCastle.Asn1.X509; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Tsp { @@ -28,7 +29,7 @@ namespace Org.BouncyCastle.Asn1.Tsp } throw new ArgumentException( - "Unknown object in 'MessageImprint' factory: " + o.GetType().FullName); + "Unknown object in 'MessageImprint' factory: " + Platform.GetTypeName(o)); } private MessageImprint( diff --git a/crypto/src/asn1/tsp/TSTInfo.cs b/crypto/src/asn1/tsp/TSTInfo.cs index 61d5399c7..89f3e8b38 100644 --- a/crypto/src/asn1/tsp/TSTInfo.cs +++ b/crypto/src/asn1/tsp/TSTInfo.cs @@ -3,6 +3,7 @@ using System.Collections; using System.IO; using Org.BouncyCastle.Asn1.X509; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Tsp { @@ -48,7 +49,7 @@ namespace Org.BouncyCastle.Asn1.Tsp } throw new ArgumentException( - "Unknown object in 'TstInfo' factory: " + o.GetType().FullName); + "Unknown object in 'TstInfo' factory: " + Platform.GetTypeName(o)); } private TstInfo( diff --git a/crypto/src/asn1/tsp/TimeStampReq.cs b/crypto/src/asn1/tsp/TimeStampReq.cs index 55e973e76..5b05f3369 100644 --- a/crypto/src/asn1/tsp/TimeStampReq.cs +++ b/crypto/src/asn1/tsp/TimeStampReq.cs @@ -1,6 +1,7 @@ using System; using Org.BouncyCastle.Asn1.X509; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Tsp { @@ -28,7 +29,7 @@ namespace Org.BouncyCastle.Asn1.Tsp } throw new ArgumentException( - "Unknown object in 'TimeStampReq' factory: " + o.GetType().FullName); + "Unknown object in 'TimeStampReq' factory: " + Platform.GetTypeName(o)); } private TimeStampReq( diff --git a/crypto/src/asn1/tsp/TimeStampResp.cs b/crypto/src/asn1/tsp/TimeStampResp.cs index f26fb30bd..b91026064 100644 --- a/crypto/src/asn1/tsp/TimeStampResp.cs +++ b/crypto/src/asn1/tsp/TimeStampResp.cs @@ -1,8 +1,8 @@ using System; -using System.Collections; using Org.BouncyCastle.Asn1.Cmp; using Org.BouncyCastle.Asn1.Cms; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Tsp { @@ -26,7 +26,7 @@ namespace Org.BouncyCastle.Asn1.Tsp } throw new ArgumentException( - "Unknown object in 'TimeStampResp' factory: " + o.GetType().FullName); + "Unknown object in 'TimeStampResp' factory: " + Platform.GetTypeName(o)); } private TimeStampResp( diff --git a/crypto/src/asn1/x500/DirectoryString.cs b/crypto/src/asn1/x500/DirectoryString.cs index 78ecc2663..d907c6456 100644 --- a/crypto/src/asn1/x500/DirectoryString.cs +++ b/crypto/src/asn1/x500/DirectoryString.cs @@ -1,5 +1,7 @@ using System; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1.X500 { public class DirectoryString @@ -27,7 +29,7 @@ namespace Org.BouncyCastle.Asn1.X500 } } - throw new ArgumentException("unknown object in factory: " + obj.GetType().Name, "obj"); + throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } public static DirectoryString GetInstance( diff --git a/crypto/src/asn1/x509/AccessDescription.cs b/crypto/src/asn1/x509/AccessDescription.cs index 09b5b5920..47374be8f 100644 --- a/crypto/src/asn1/x509/AccessDescription.cs +++ b/crypto/src/asn1/x509/AccessDescription.cs @@ -1,5 +1,7 @@ using System; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1.X509 { /** @@ -28,7 +30,7 @@ namespace Org.BouncyCastle.Asn1.X509 if (obj is Asn1Sequence) return new AccessDescription((Asn1Sequence) obj); - throw new ArgumentException("unknown object in factory: " + obj.GetType().Name, "obj"); + throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } private AccessDescription( diff --git a/crypto/src/asn1/x509/AttCertIssuer.cs b/crypto/src/asn1/x509/AttCertIssuer.cs index e9314fa92..407c4ae7a 100644 --- a/crypto/src/asn1/x509/AttCertIssuer.cs +++ b/crypto/src/asn1/x509/AttCertIssuer.cs @@ -1,6 +1,6 @@ using System; -using Org.BouncyCastle.Asn1; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.X509 { @@ -34,7 +34,7 @@ namespace Org.BouncyCastle.Asn1.X509 return new AttCertIssuer(GeneralNames.GetInstance(obj)); } - throw new ArgumentException("unknown object in factory: " + obj.GetType().Name, "obj"); + throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } public static AttCertIssuer GetInstance( diff --git a/crypto/src/asn1/x509/AttCertValidityPeriod.cs b/crypto/src/asn1/x509/AttCertValidityPeriod.cs index 7f86cd0b8..d31e07402 100644 --- a/crypto/src/asn1/x509/AttCertValidityPeriod.cs +++ b/crypto/src/asn1/x509/AttCertValidityPeriod.cs @@ -1,6 +1,6 @@ using System; -using Org.BouncyCastle.Asn1; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.X509 { @@ -23,7 +23,7 @@ namespace Org.BouncyCastle.Asn1.X509 return new AttCertValidityPeriod((Asn1Sequence) obj); } - throw new ArgumentException("unknown object in factory: " + obj.GetType().Name, "obj"); + throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } public static AttCertValidityPeriod GetInstance( diff --git a/crypto/src/asn1/x509/Attribute.cs b/crypto/src/asn1/x509/Attribute.cs index d26db93e9..da59b4285 100644 --- a/crypto/src/asn1/x509/Attribute.cs +++ b/crypto/src/asn1/x509/Attribute.cs @@ -1,6 +1,6 @@ using System; -using Org.BouncyCastle.Asn1; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.X509 { @@ -29,7 +29,7 @@ namespace Org.BouncyCastle.Asn1.X509 return new AttributeX509((Asn1Sequence) obj); } - throw new ArgumentException("unknown object in factory: " + obj.GetType().Name, "obj"); + throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } private AttributeX509( diff --git a/crypto/src/asn1/x509/AttributeCertificateInfo.cs b/crypto/src/asn1/x509/AttributeCertificateInfo.cs index dcef3d472..526f8e69b 100644 --- a/crypto/src/asn1/x509/AttributeCertificateInfo.cs +++ b/crypto/src/asn1/x509/AttributeCertificateInfo.cs @@ -1,6 +1,6 @@ using System; -using Org.BouncyCastle.Asn1; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.X509 { @@ -37,7 +37,7 @@ namespace Org.BouncyCastle.Asn1.X509 return new AttributeCertificateInfo((Asn1Sequence) obj); } - throw new ArgumentException("unknown object in factory: " + obj.GetType().Name, "obj"); + throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } private AttributeCertificateInfo( diff --git a/crypto/src/asn1/x509/AuthorityKeyIdentifier.cs b/crypto/src/asn1/x509/AuthorityKeyIdentifier.cs index 12ccacfc7..d5a9048cc 100644 --- a/crypto/src/asn1/x509/AuthorityKeyIdentifier.cs +++ b/crypto/src/asn1/x509/AuthorityKeyIdentifier.cs @@ -1,10 +1,10 @@ using System; using System.Collections; -using Org.BouncyCastle.Asn1; using Org.BouncyCastle.Crypto; using Org.BouncyCastle.Crypto.Digests; using Org.BouncyCastle.Math; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.X509 { @@ -54,7 +54,7 @@ namespace Org.BouncyCastle.Asn1.X509 return GetInstance(X509Extension.ConvertValueToObject((X509Extension) obj)); } - throw new ArgumentException("unknown object in factory: " + obj.GetType().Name, "obj"); + throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } protected internal AuthorityKeyIdentifier( diff --git a/crypto/src/asn1/x509/BasicConstraints.cs b/crypto/src/asn1/x509/BasicConstraints.cs index 522cb61cc..098801f22 100644 --- a/crypto/src/asn1/x509/BasicConstraints.cs +++ b/crypto/src/asn1/x509/BasicConstraints.cs @@ -1,7 +1,7 @@ using System; -using Org.BouncyCastle.Asn1; using Org.BouncyCastle.Math; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.X509 { @@ -36,7 +36,7 @@ namespace Org.BouncyCastle.Asn1.X509 return GetInstance(X509Extension.ConvertValueToObject((X509Extension) obj)); } - throw new ArgumentException("unknown object in factory: " + obj.GetType().Name, "obj"); + throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } private BasicConstraints( diff --git a/crypto/src/asn1/x509/CRLDistPoint.cs b/crypto/src/asn1/x509/CRLDistPoint.cs index 2b5c19798..56ba79ca5 100644 --- a/crypto/src/asn1/x509/CRLDistPoint.cs +++ b/crypto/src/asn1/x509/CRLDistPoint.cs @@ -30,7 +30,7 @@ namespace Org.BouncyCastle.Asn1.X509 return new CrlDistPoint((Asn1Sequence) obj); } - throw new ArgumentException("unknown object in factory: " + obj.GetType().Name, "obj"); + throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } private CrlDistPoint( diff --git a/crypto/src/asn1/x509/CertificatePair.cs b/crypto/src/asn1/x509/CertificatePair.cs index 8baa64719..da9236010 100644 --- a/crypto/src/asn1/x509/CertificatePair.cs +++ b/crypto/src/asn1/x509/CertificatePair.cs @@ -1,5 +1,7 @@ using System; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1.X509 { /** @@ -53,7 +55,7 @@ namespace Org.BouncyCastle.Asn1.X509 return new CertificatePair((Asn1Sequence) obj); } - throw new ArgumentException("unknown object in factory: " + obj.GetType().Name, "obj"); + throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } /** diff --git a/crypto/src/asn1/x509/DSAParameter.cs b/crypto/src/asn1/x509/DSAParameter.cs index b2b325f4d..2eb65024b 100644 --- a/crypto/src/asn1/x509/DSAParameter.cs +++ b/crypto/src/asn1/x509/DSAParameter.cs @@ -2,6 +2,7 @@ using System; using System.Collections; using Org.BouncyCastle.Math; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.X509 { @@ -30,7 +31,7 @@ namespace Org.BouncyCastle.Asn1.X509 return new DsaParameter((Asn1Sequence) obj); } - throw new ArgumentException("Invalid DsaParameter: " + obj.GetType().Name); + throw new ArgumentException("Invalid DsaParameter: " + Platform.GetTypeName(obj)); } public DsaParameter( diff --git a/crypto/src/asn1/x509/DigestInfo.cs b/crypto/src/asn1/x509/DigestInfo.cs index 1dec227fa..3ac535e2e 100644 --- a/crypto/src/asn1/x509/DigestInfo.cs +++ b/crypto/src/asn1/x509/DigestInfo.cs @@ -1,6 +1,8 @@ using System; using System.Collections; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1.X509 { /** @@ -37,7 +39,7 @@ namespace Org.BouncyCastle.Asn1.X509 return new DigestInfo((Asn1Sequence) obj); } - throw new ArgumentException("unknown object in factory: " + obj.GetType().Name, "obj"); + throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } public DigestInfo( diff --git a/crypto/src/asn1/x509/DisplayText.cs b/crypto/src/asn1/x509/DisplayText.cs index 699f39031..39b3c98d7 100644 --- a/crypto/src/asn1/x509/DisplayText.cs +++ b/crypto/src/asn1/x509/DisplayText.cs @@ -1,5 +1,7 @@ using System; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1.X509 { /** @@ -151,7 +153,7 @@ namespace Org.BouncyCastle.Asn1.X509 return (DisplayText) obj; } - throw new ArgumentException("unknown object in factory: " + obj.GetType().Name, "obj"); + throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } public override Asn1Object ToAsn1Object() diff --git a/crypto/src/asn1/x509/DistributionPoint.cs b/crypto/src/asn1/x509/DistributionPoint.cs index ad1d3989e..40814c7a8 100644 --- a/crypto/src/asn1/x509/DistributionPoint.cs +++ b/crypto/src/asn1/x509/DistributionPoint.cs @@ -42,7 +42,7 @@ namespace Org.BouncyCastle.Asn1.X509 return new DistributionPoint((Asn1Sequence) obj); } - throw new ArgumentException("Invalid DistributionPoint: " + obj.GetType().Name); + throw new ArgumentException("Invalid DistributionPoint: " + Platform.GetTypeName(obj)); } private DistributionPoint( diff --git a/crypto/src/asn1/x509/DistributionPointName.cs b/crypto/src/asn1/x509/DistributionPointName.cs index 1a9d24241..43fdaf533 100644 --- a/crypto/src/asn1/x509/DistributionPointName.cs +++ b/crypto/src/asn1/x509/DistributionPointName.cs @@ -43,7 +43,7 @@ namespace Org.BouncyCastle.Asn1.X509 return new DistributionPointName((Asn1TaggedObject) obj); } - throw new ArgumentException("unknown object in factory: " + obj.GetType().Name, "obj"); + throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } public DistributionPointName( diff --git a/crypto/src/asn1/x509/ExtendedKeyUsage.cs b/crypto/src/asn1/x509/ExtendedKeyUsage.cs index 9b1400db9..8f7e6a353 100644 --- a/crypto/src/asn1/x509/ExtendedKeyUsage.cs +++ b/crypto/src/asn1/x509/ExtendedKeyUsage.cs @@ -42,7 +42,7 @@ namespace Org.BouncyCastle.Asn1.X509 return GetInstance(X509Extension.ConvertValueToObject((X509Extension) obj)); } - throw new ArgumentException("Invalid ExtendedKeyUsage: " + obj.GetType().Name); + throw new ArgumentException("Invalid ExtendedKeyUsage: " + Platform.GetTypeName(obj)); } private ExtendedKeyUsage( diff --git a/crypto/src/asn1/x509/GeneralName.cs b/crypto/src/asn1/x509/GeneralName.cs index 16096623c..b8794ea8f 100644 --- a/crypto/src/asn1/x509/GeneralName.cs +++ b/crypto/src/asn1/x509/GeneralName.cs @@ -203,7 +203,7 @@ namespace Org.BouncyCastle.Asn1.X509 } } - throw new ArgumentException("unknown object in GetInstance: " + obj.GetType().FullName, "obj"); + throw new ArgumentException("unknown object in GetInstance: " + Platform.GetTypeName(obj), "obj"); } public static GeneralName GetInstance( diff --git a/crypto/src/asn1/x509/GeneralNames.cs b/crypto/src/asn1/x509/GeneralNames.cs index 6c5c8e690..fcd2ecb24 100644 --- a/crypto/src/asn1/x509/GeneralNames.cs +++ b/crypto/src/asn1/x509/GeneralNames.cs @@ -23,7 +23,7 @@ namespace Org.BouncyCastle.Asn1.X509 return new GeneralNames((Asn1Sequence) obj); } - throw new ArgumentException("unknown object in factory: " + obj.GetType().Name, "obj"); + throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } public static GeneralNames GetInstance( diff --git a/crypto/src/asn1/x509/Holder.cs b/crypto/src/asn1/x509/Holder.cs index d04f1cb60..6e5315b80 100644 --- a/crypto/src/asn1/x509/Holder.cs +++ b/crypto/src/asn1/x509/Holder.cs @@ -1,5 +1,7 @@ using System; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1.X509 { /** @@ -58,7 +60,7 @@ namespace Org.BouncyCastle.Asn1.X509 return new Holder((Asn1TaggedObject) obj); } - throw new ArgumentException("unknown object in factory: " + obj.GetType().Name, "obj"); + throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } /** diff --git a/crypto/src/asn1/x509/IssuerSerial.cs b/crypto/src/asn1/x509/IssuerSerial.cs index 6a24e7333..1e47e022b 100644 --- a/crypto/src/asn1/x509/IssuerSerial.cs +++ b/crypto/src/asn1/x509/IssuerSerial.cs @@ -1,5 +1,7 @@ using System; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1.X509 { public class IssuerSerial @@ -22,7 +24,7 @@ namespace Org.BouncyCastle.Asn1.X509 return new IssuerSerial((Asn1Sequence) obj); } - throw new ArgumentException("unknown object in factory: " + obj.GetType().Name, "obj"); + throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } public static IssuerSerial GetInstance( diff --git a/crypto/src/asn1/x509/IssuingDistributionPoint.cs b/crypto/src/asn1/x509/IssuingDistributionPoint.cs index 3af0d565f..8e9362b90 100644 --- a/crypto/src/asn1/x509/IssuingDistributionPoint.cs +++ b/crypto/src/asn1/x509/IssuingDistributionPoint.cs @@ -48,7 +48,7 @@ namespace Org.BouncyCastle.Asn1.X509 return new IssuingDistributionPoint((Asn1Sequence) obj); } - throw new ArgumentException("unknown object in factory: " + obj.GetType().Name, "obj"); + throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } /** diff --git a/crypto/src/asn1/x509/NameConstraints.cs b/crypto/src/asn1/x509/NameConstraints.cs index c178f5b45..0c5fea8b3 100644 --- a/crypto/src/asn1/x509/NameConstraints.cs +++ b/crypto/src/asn1/x509/NameConstraints.cs @@ -1,6 +1,8 @@ using System; using System.Collections; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1.X509 { public class NameConstraints @@ -21,7 +23,7 @@ namespace Org.BouncyCastle.Asn1.X509 return new NameConstraints((Asn1Sequence) obj); } - throw new ArgumentException("unknown object in factory: " + obj.GetType().Name, "obj"); + throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } public NameConstraints( diff --git a/crypto/src/asn1/x509/ObjectDigestInfo.cs b/crypto/src/asn1/x509/ObjectDigestInfo.cs index 6d5b9c692..9cd9a5f4c 100644 --- a/crypto/src/asn1/x509/ObjectDigestInfo.cs +++ b/crypto/src/asn1/x509/ObjectDigestInfo.cs @@ -1,5 +1,7 @@ using System; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1.X509 { /** @@ -58,7 +60,7 @@ namespace Org.BouncyCastle.Asn1.X509 return new ObjectDigestInfo((Asn1Sequence) obj); } - throw new ArgumentException("unknown object in factory: " + obj.GetType().Name, "obj"); + throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } public static ObjectDigestInfo GetInstance( diff --git a/crypto/src/asn1/x509/PrivateKeyUsagePeriod.cs b/crypto/src/asn1/x509/PrivateKeyUsagePeriod.cs index ad2961eb0..a3d7a3608 100644 --- a/crypto/src/asn1/x509/PrivateKeyUsagePeriod.cs +++ b/crypto/src/asn1/x509/PrivateKeyUsagePeriod.cs @@ -1,5 +1,7 @@ using System; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1.X509 { /// @@ -31,7 +33,7 @@ namespace Org.BouncyCastle.Asn1.X509 return GetInstance(X509Extension.ConvertValueToObject((X509Extension) obj)); } - throw new ArgumentException("unknown object in GetInstance: " + obj.GetType().FullName, "obj"); + throw new ArgumentException("unknown object in GetInstance: " + Platform.GetTypeName(obj), "obj"); } private DerGeneralizedTime _notBefore, _notAfter; diff --git a/crypto/src/asn1/x509/RSAPublicKeyStructure.cs b/crypto/src/asn1/x509/RSAPublicKeyStructure.cs index bdcba783e..20fdd96ac 100644 --- a/crypto/src/asn1/x509/RSAPublicKeyStructure.cs +++ b/crypto/src/asn1/x509/RSAPublicKeyStructure.cs @@ -1,9 +1,10 @@ -using Org.BouncyCastle.Asn1; -using Org.BouncyCastle.Math; - using System; using System.Collections; +using Org.BouncyCastle.Asn1; +using Org.BouncyCastle.Math; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1.X509 { public class RsaPublicKeyStructure @@ -32,7 +33,7 @@ namespace Org.BouncyCastle.Asn1.X509 return new RsaPublicKeyStructure((Asn1Sequence) obj); } - throw new ArgumentException("Invalid RsaPublicKeyStructure: " + obj.GetType().Name); + throw new ArgumentException("Invalid RsaPublicKeyStructure: " + Platform.GetTypeName(obj)); } public RsaPublicKeyStructure( diff --git a/crypto/src/asn1/x509/SubjectDirectoryAttributes.cs b/crypto/src/asn1/x509/SubjectDirectoryAttributes.cs index c76d94d78..77923e0d2 100644 --- a/crypto/src/asn1/x509/SubjectDirectoryAttributes.cs +++ b/crypto/src/asn1/x509/SubjectDirectoryAttributes.cs @@ -43,7 +43,7 @@ namespace Org.BouncyCastle.Asn1.X509 return new SubjectDirectoryAttributes((Asn1Sequence) obj); } - throw new ArgumentException("unknown object in factory: " + obj.GetType().Name, "obj"); + throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } /** diff --git a/crypto/src/asn1/x509/SubjectKeyIdentifier.cs b/crypto/src/asn1/x509/SubjectKeyIdentifier.cs index e640760f3..f2e6cc006 100644 --- a/crypto/src/asn1/x509/SubjectKeyIdentifier.cs +++ b/crypto/src/asn1/x509/SubjectKeyIdentifier.cs @@ -2,6 +2,7 @@ using System; using Org.BouncyCastle.Crypto; using Org.BouncyCastle.Crypto.Digests; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.X509 { @@ -46,7 +47,7 @@ namespace Org.BouncyCastle.Asn1.X509 return GetInstance(X509Extension.ConvertValueToObject((X509Extension) obj)); } - throw new ArgumentException("Invalid SubjectKeyIdentifier: " + obj.GetType().Name); + throw new ArgumentException("Invalid SubjectKeyIdentifier: " + Platform.GetTypeName(obj)); } public SubjectKeyIdentifier( diff --git a/crypto/src/asn1/x509/TBSCertList.cs b/crypto/src/asn1/x509/TBSCertList.cs index b5934a230..5767a7f21 100644 --- a/crypto/src/asn1/x509/TBSCertList.cs +++ b/crypto/src/asn1/x509/TBSCertList.cs @@ -1,6 +1,7 @@ using System; using System.Collections; +using Org.BouncyCastle.Utilities; using Org.BouncyCastle.Utilities.Collections; namespace Org.BouncyCastle.Asn1.X509 @@ -155,7 +156,7 @@ namespace Org.BouncyCastle.Asn1.X509 return new TbsCertificateList((Asn1Sequence) obj); } - throw new ArgumentException("unknown object in factory: " + obj.GetType().Name, "obj"); + throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } internal TbsCertificateList( diff --git a/crypto/src/asn1/x509/Target.cs b/crypto/src/asn1/x509/Target.cs index 309b28c95..7c4f9db7e 100644 --- a/crypto/src/asn1/x509/Target.cs +++ b/crypto/src/asn1/x509/Target.cs @@ -1,5 +1,7 @@ using System; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1.X509 { /** @@ -53,7 +55,7 @@ namespace Org.BouncyCastle.Asn1.X509 return new Target((Asn1TaggedObject) obj); } - throw new ArgumentException("unknown object in factory: " + obj.GetType().Name, "obj"); + throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } /** diff --git a/crypto/src/asn1/x509/TargetInformation.cs b/crypto/src/asn1/x509/TargetInformation.cs index 75b18c0c9..2bf218977 100644 --- a/crypto/src/asn1/x509/TargetInformation.cs +++ b/crypto/src/asn1/x509/TargetInformation.cs @@ -1,5 +1,7 @@ using System; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1.X509 { /** @@ -38,7 +40,7 @@ namespace Org.BouncyCastle.Asn1.X509 return new TargetInformation((Asn1Sequence) obj); } - throw new ArgumentException("unknown object in factory: " + obj.GetType().Name, "obj"); + throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } /** diff --git a/crypto/src/asn1/x509/Targets.cs b/crypto/src/asn1/x509/Targets.cs index 3e436d8d8..0387e1f6b 100644 --- a/crypto/src/asn1/x509/Targets.cs +++ b/crypto/src/asn1/x509/Targets.cs @@ -1,5 +1,7 @@ using System; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1.X509 { /** @@ -52,7 +54,7 @@ namespace Org.BouncyCastle.Asn1.X509 return new Targets((Asn1Sequence) obj); } - throw new ArgumentException("unknown object in factory: " + obj.GetType().Name, "obj"); + throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } /** diff --git a/crypto/src/asn1/x509/Time.cs b/crypto/src/asn1/x509/Time.cs index ffe293521..fa3936d63 100644 --- a/crypto/src/asn1/x509/Time.cs +++ b/crypto/src/asn1/x509/Time.cs @@ -1,6 +1,8 @@ using System; using System.Globalization; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1.X509 { public class Time @@ -62,7 +64,7 @@ namespace Org.BouncyCastle.Asn1.X509 if (obj is DerGeneralizedTime) return new Time((DerGeneralizedTime)obj); - throw new ArgumentException("unknown object in factory: " + obj.GetType().Name, "obj"); + throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } public string GetTime() diff --git a/crypto/src/asn1/x509/X509Extensions.cs b/crypto/src/asn1/x509/X509Extensions.cs index 1896450f5..2ef73f629 100644 --- a/crypto/src/asn1/x509/X509Extensions.cs +++ b/crypto/src/asn1/x509/X509Extensions.cs @@ -192,7 +192,7 @@ namespace Org.BouncyCastle.Asn1.X509 return GetInstance(((Asn1TaggedObject) obj).GetObject()); } - throw new ArgumentException("unknown object in factory: " + obj.GetType().Name, "obj"); + throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } /** diff --git a/crypto/src/asn1/x509/qualified/BiometricData.cs b/crypto/src/asn1/x509/qualified/BiometricData.cs index 61d7c99cb..bb70c342c 100644 --- a/crypto/src/asn1/x509/qualified/BiometricData.cs +++ b/crypto/src/asn1/x509/qualified/BiometricData.cs @@ -1,8 +1,6 @@ using System; -using System.Collections; -using Org.BouncyCastle.Asn1; -using Org.BouncyCastle.Asn1.X509; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.X509.Qualified { @@ -37,7 +35,7 @@ namespace Org.BouncyCastle.Asn1.X509.Qualified return new BiometricData(Asn1Sequence.GetInstance(obj)); } - throw new ArgumentException("unknown object in GetInstance: " + obj.GetType().FullName, "obj"); + throw new ArgumentException("unknown object in GetInstance: " + Platform.GetTypeName(obj), "obj"); } private BiometricData( diff --git a/crypto/src/asn1/x509/qualified/Iso4217CurrencyCode.cs b/crypto/src/asn1/x509/qualified/Iso4217CurrencyCode.cs index 3300562c8..9ec88f5ed 100644 --- a/crypto/src/asn1/x509/qualified/Iso4217CurrencyCode.cs +++ b/crypto/src/asn1/x509/qualified/Iso4217CurrencyCode.cs @@ -1,6 +1,6 @@ using System; -using Org.BouncyCastle.Asn1; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.X509.Qualified { @@ -45,7 +45,7 @@ namespace Org.BouncyCastle.Asn1.X509.Qualified return new Iso4217CurrencyCode(alphabetic.GetString()); } - throw new ArgumentException("unknown object in GetInstance: " + obj.GetType().FullName, "obj"); + throw new ArgumentException("unknown object in GetInstance: " + Platform.GetTypeName(obj), "obj"); } public Iso4217CurrencyCode( @@ -53,7 +53,7 @@ namespace Org.BouncyCastle.Asn1.X509.Qualified { if (numeric > NumericMaxSize || numeric < NumericMinSize) { - throw new ArgumentException("wrong size in numeric code : not in (" +NumericMinSize +".."+ NumericMaxSize +")"); + throw new ArgumentException("wrong size in numeric code : not in (" + NumericMinSize + ".." + NumericMaxSize + ")"); } obj = new DerInteger(numeric); diff --git a/crypto/src/asn1/x509/qualified/MonetaryValue.cs b/crypto/src/asn1/x509/qualified/MonetaryValue.cs index 45e113671..d703de943 100644 --- a/crypto/src/asn1/x509/qualified/MonetaryValue.cs +++ b/crypto/src/asn1/x509/qualified/MonetaryValue.cs @@ -1,8 +1,8 @@ using System; using System.Collections; -using Org.BouncyCastle.Asn1; using Org.BouncyCastle.Math; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.X509.Qualified { @@ -36,7 +36,7 @@ namespace Org.BouncyCastle.Asn1.X509.Qualified return new MonetaryValue(Asn1Sequence.GetInstance(obj)); } - throw new ArgumentException("unknown object in GetInstance: " + obj.GetType().FullName, "obj"); + throw new ArgumentException("unknown object in GetInstance: " + Platform.GetTypeName(obj), "obj"); } private MonetaryValue( diff --git a/crypto/src/asn1/x509/qualified/QCStatement.cs b/crypto/src/asn1/x509/qualified/QCStatement.cs index 317f03447..a8e214cbf 100644 --- a/crypto/src/asn1/x509/qualified/QCStatement.cs +++ b/crypto/src/asn1/x509/qualified/QCStatement.cs @@ -1,7 +1,6 @@ using System; -using System.Collections; -using Org.BouncyCastle.Asn1; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.X509.Qualified { @@ -32,7 +31,7 @@ namespace Org.BouncyCastle.Asn1.X509.Qualified return new QCStatement(Asn1Sequence.GetInstance(obj)); } - throw new ArgumentException("unknown object in GetInstance: " + obj.GetType().FullName, "obj"); + throw new ArgumentException("unknown object in GetInstance: " + Platform.GetTypeName(obj), "obj"); } private QCStatement( diff --git a/crypto/src/asn1/x509/qualified/SemanticsInformation.cs b/crypto/src/asn1/x509/qualified/SemanticsInformation.cs index 72e7cd0e1..5fe5f936c 100644 --- a/crypto/src/asn1/x509/qualified/SemanticsInformation.cs +++ b/crypto/src/asn1/x509/qualified/SemanticsInformation.cs @@ -1,8 +1,8 @@ using System; using System.Collections; -using Org.BouncyCastle.Asn1; using Org.BouncyCastle.Asn1.X509; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.X509.Qualified { @@ -39,7 +39,7 @@ namespace Org.BouncyCastle.Asn1.X509.Qualified return new SemanticsInformation(Asn1Sequence.GetInstance(obj)); } - throw new ArgumentException("unknown object in GetInstance: " + obj.GetType().FullName, "obj"); + throw new ArgumentException("unknown object in GetInstance: " + Platform.GetTypeName(obj), "obj"); } public SemanticsInformation( diff --git a/crypto/src/asn1/x509/qualified/TypeOfBiometricData.cs b/crypto/src/asn1/x509/qualified/TypeOfBiometricData.cs index a77e54acb..17b7841c3 100644 --- a/crypto/src/asn1/x509/qualified/TypeOfBiometricData.cs +++ b/crypto/src/asn1/x509/qualified/TypeOfBiometricData.cs @@ -1,6 +1,6 @@ using System; -using Org.BouncyCastle.Asn1; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.X509.Qualified { @@ -46,7 +46,7 @@ namespace Org.BouncyCastle.Asn1.X509.Qualified return new TypeOfBiometricData(BiometricDataOid); } - throw new ArgumentException("unknown object in GetInstance: " + obj.GetType().FullName, "obj"); + throw new ArgumentException("unknown object in GetInstance: " + Platform.GetTypeName(obj), "obj"); } public TypeOfBiometricData( diff --git a/crypto/src/asn1/x509/sigi/NameOrPseudonym.cs b/crypto/src/asn1/x509/sigi/NameOrPseudonym.cs index 222895cf1..2402e3832 100644 --- a/crypto/src/asn1/x509/sigi/NameOrPseudonym.cs +++ b/crypto/src/asn1/x509/sigi/NameOrPseudonym.cs @@ -2,6 +2,7 @@ using System; using System.Collections; using Org.BouncyCastle.Asn1.X500; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.X509.SigI { @@ -46,7 +47,7 @@ namespace Org.BouncyCastle.Asn1.X509.SigI return new NameOrPseudonym((Asn1Sequence) obj); } - throw new ArgumentException("unknown object in factory: " + obj.GetType().Name, "obj"); + throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } /** @@ -95,7 +96,7 @@ namespace Org.BouncyCastle.Asn1.X509.SigI throw new ArgumentException("Bad sequence size: " + seq.Count); if (!(seq[0] is IAsn1String)) - throw new ArgumentException("Bad object encountered: " + seq[0].GetType().Name); + throw new ArgumentException("Bad object encountered: " + Platform.GetTypeName(seq[0])); surname = DirectoryString.GetInstance(seq[0]); givenName = Asn1Sequence.GetInstance(seq[1]); diff --git a/crypto/src/asn1/x509/sigi/PersonalData.cs b/crypto/src/asn1/x509/sigi/PersonalData.cs index 6acdc7308..dba345c42 100644 --- a/crypto/src/asn1/x509/sigi/PersonalData.cs +++ b/crypto/src/asn1/x509/sigi/PersonalData.cs @@ -3,6 +3,7 @@ using System.Collections; using Org.BouncyCastle.Asn1.X500; using Org.BouncyCastle.Math; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.X509.SigI { @@ -47,7 +48,7 @@ namespace Org.BouncyCastle.Asn1.X509.SigI return new PersonalData((Asn1Sequence) obj); } - throw new ArgumentException("unknown object in factory: " + obj.GetType().Name, "obj"); + throw new ArgumentException("unknown object in factory: " + Platform.GetTypeName(obj), "obj"); } /** diff --git a/crypto/src/asn1/x9/DHDomainParameters.cs b/crypto/src/asn1/x9/DHDomainParameters.cs index 8de869694..b8c1ac030 100644 --- a/crypto/src/asn1/x9/DHDomainParameters.cs +++ b/crypto/src/asn1/x9/DHDomainParameters.cs @@ -1,6 +1,8 @@ using System; using System.Collections; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1.X9 { public class DHDomainParameters @@ -22,7 +24,7 @@ namespace Org.BouncyCastle.Asn1.X9 if (obj is Asn1Sequence) return new DHDomainParameters((Asn1Sequence)obj); - throw new ArgumentException("Invalid DHDomainParameters: " + obj.GetType().FullName, "obj"); + throw new ArgumentException("Invalid DHDomainParameters: " + Platform.GetTypeName(obj), "obj"); } public DHDomainParameters(DerInteger p, DerInteger g, DerInteger q, DerInteger j, diff --git a/crypto/src/asn1/x9/DHPublicKey.cs b/crypto/src/asn1/x9/DHPublicKey.cs index 1a20a8a16..74a14a2ee 100644 --- a/crypto/src/asn1/x9/DHPublicKey.cs +++ b/crypto/src/asn1/x9/DHPublicKey.cs @@ -1,5 +1,7 @@ using System; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1.X9 { public class DHPublicKey @@ -20,7 +22,7 @@ namespace Org.BouncyCastle.Asn1.X9 if (obj is DerInteger) return new DHPublicKey((DerInteger)obj); - throw new ArgumentException("Invalid DHPublicKey: " + obj.GetType().FullName, "obj"); + throw new ArgumentException("Invalid DHPublicKey: " + Platform.GetTypeName(obj), "obj"); } public DHPublicKey(DerInteger y) diff --git a/crypto/src/asn1/x9/DHValidationParms.cs b/crypto/src/asn1/x9/DHValidationParms.cs index a37964cfb..c63c50205 100644 --- a/crypto/src/asn1/x9/DHValidationParms.cs +++ b/crypto/src/asn1/x9/DHValidationParms.cs @@ -1,5 +1,7 @@ using System; +using Org.BouncyCastle.Utilities; + namespace Org.BouncyCastle.Asn1.X9 { public class DHValidationParms @@ -21,7 +23,7 @@ namespace Org.BouncyCastle.Asn1.X9 if (obj is Asn1Sequence) return new DHValidationParms((Asn1Sequence)obj); - throw new ArgumentException("Invalid DHValidationParms: " + obj.GetType().FullName, "obj"); + throw new ArgumentException("Invalid DHValidationParms: " + Platform.GetTypeName(obj), "obj"); } public DHValidationParms(DerBitString seed, DerInteger pgenCounter) diff --git a/crypto/src/crypto/engines/AesEngine.cs b/crypto/src/crypto/engines/AesEngine.cs index c84f4a964..ba62af4da 100644 --- a/crypto/src/crypto/engines/AesEngine.cs +++ b/crypto/src/crypto/engines/AesEngine.cs @@ -3,6 +3,7 @@ using System.Diagnostics; using Org.BouncyCastle.Crypto.Parameters; using Org.BouncyCastle.Crypto.Utilities; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Crypto.Engines { @@ -452,7 +453,8 @@ namespace Org.BouncyCastle.Crypto.Engines KeyParameter keyParameter = parameters as KeyParameter; if (keyParameter == null) - throw new ArgumentException("invalid parameter passed to AES init - " + parameters.GetType().Name); + throw new ArgumentException("invalid parameter passed to AES init - " + + Platform.GetTypeName(parameters)); WorkingKey = GenerateWorkingKey(keyParameter.GetKey(), forEncryption); diff --git a/crypto/src/crypto/engines/AesFastEngine.cs b/crypto/src/crypto/engines/AesFastEngine.cs index 18367a324..3a9c3a89e 100644 --- a/crypto/src/crypto/engines/AesFastEngine.cs +++ b/crypto/src/crypto/engines/AesFastEngine.cs @@ -3,6 +3,7 @@ using System.Diagnostics; using Org.BouncyCastle.Crypto.Parameters; using Org.BouncyCastle.Crypto.Utilities; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Crypto.Engines { @@ -788,7 +789,8 @@ namespace Org.BouncyCastle.Crypto.Engines KeyParameter keyParameter = parameters as KeyParameter; if (keyParameter == null) - throw new ArgumentException("invalid parameter passed to AES init - " + parameters.GetType().Name); + throw new ArgumentException("invalid parameter passed to AES init - " + + Platform.GetTypeName(parameters)); WorkingKey = GenerateWorkingKey(keyParameter.GetKey(), forEncryption); diff --git a/crypto/src/crypto/engines/AesLightEngine.cs b/crypto/src/crypto/engines/AesLightEngine.cs index a48fa5857..9cc9c34a0 100644 --- a/crypto/src/crypto/engines/AesLightEngine.cs +++ b/crypto/src/crypto/engines/AesLightEngine.cs @@ -3,6 +3,7 @@ using System.Diagnostics; using Org.BouncyCastle.Crypto.Parameters; using Org.BouncyCastle.Crypto.Utilities; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Crypto.Engines { @@ -349,7 +350,8 @@ namespace Org.BouncyCastle.Crypto.Engines KeyParameter keyParameter = parameters as KeyParameter; if (keyParameter == null) - throw new ArgumentException("invalid parameter passed to AES init - " + parameters.GetType().Name); + throw new ArgumentException("invalid parameter passed to AES init - " + + Platform.GetTypeName(parameters)); WorkingKey = GenerateWorkingKey(keyParameter.GetKey(), forEncryption); diff --git a/crypto/src/crypto/engines/BlowfishEngine.cs b/crypto/src/crypto/engines/BlowfishEngine.cs index 7b50e832f..e38f4e8f6 100644 --- a/crypto/src/crypto/engines/BlowfishEngine.cs +++ b/crypto/src/crypto/engines/BlowfishEngine.cs @@ -2,6 +2,7 @@ using System; using Org.BouncyCastle.Crypto.Parameters; using Org.BouncyCastle.Crypto.Utilities; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Crypto.Engines { @@ -329,7 +330,7 @@ namespace Org.BouncyCastle.Crypto.Engines ICipherParameters parameters) { if (!(parameters is KeyParameter)) - throw new ArgumentException("invalid parameter passed to Blowfish init - " + parameters.GetType().ToString()); + throw new ArgumentException("invalid parameter passed to Blowfish init - " + Platform.GetTypeName(parameters)); this.encrypting = forEncryption; this.workingKey = ((KeyParameter)parameters).GetKey(); diff --git a/crypto/src/crypto/engines/Cast5Engine.cs b/crypto/src/crypto/engines/Cast5Engine.cs index 1af30a335..53836db02 100644 --- a/crypto/src/crypto/engines/Cast5Engine.cs +++ b/crypto/src/crypto/engines/Cast5Engine.cs @@ -2,6 +2,7 @@ using System; using Org.BouncyCastle.Crypto.Parameters; using Org.BouncyCastle.Crypto.Utilities; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Crypto.Engines { @@ -334,7 +335,7 @@ namespace Org.BouncyCastle.Crypto.Engines ICipherParameters parameters) { if (!(parameters is KeyParameter)) - throw new ArgumentException("Invalid parameter passed to "+ AlgorithmName +" init - " + parameters.GetType().ToString()); + throw new ArgumentException("Invalid parameter passed to "+ AlgorithmName +" init - " + Platform.GetTypeName(parameters)); _encrypting = forEncryption; _workingKey = ((KeyParameter)parameters).GetKey(); diff --git a/crypto/src/crypto/engines/DesEdeEngine.cs b/crypto/src/crypto/engines/DesEdeEngine.cs index bc40b56a8..2fac24ac0 100644 --- a/crypto/src/crypto/engines/DesEdeEngine.cs +++ b/crypto/src/crypto/engines/DesEdeEngine.cs @@ -1,6 +1,7 @@ using System; using Org.BouncyCastle.Crypto.Parameters; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Crypto.Engines { @@ -24,7 +25,7 @@ namespace Org.BouncyCastle.Crypto.Engines ICipherParameters parameters) { if (!(parameters is KeyParameter)) - throw new ArgumentException("invalid parameter passed to DESede init - " + parameters.GetType().ToString()); + throw new ArgumentException("invalid parameter passed to DESede init - " + Platform.GetTypeName(parameters)); byte[] keyMaster = ((KeyParameter)parameters).GetKey(); if (keyMaster.Length != 24 && keyMaster.Length != 16) diff --git a/crypto/src/crypto/engines/DesEngine.cs b/crypto/src/crypto/engines/DesEngine.cs index a6d580bb6..cfd50681e 100644 --- a/crypto/src/crypto/engines/DesEngine.cs +++ b/crypto/src/crypto/engines/DesEngine.cs @@ -2,6 +2,7 @@ using System; using Org.BouncyCastle.Crypto.Parameters; using Org.BouncyCastle.Crypto.Utilities; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Crypto.Engines { @@ -31,7 +32,7 @@ namespace Org.BouncyCastle.Crypto.Engines ICipherParameters parameters) { if (!(parameters is KeyParameter)) - throw new ArgumentException("invalid parameter passed to DES init - " + parameters.GetType().ToString()); + throw new ArgumentException("invalid parameter passed to DES init - " + Platform.GetTypeName(parameters)); workingKey = GenerateWorkingKey(forEncryption, ((KeyParameter)parameters).GetKey()); } diff --git a/crypto/src/crypto/engines/GOST28147Engine.cs b/crypto/src/crypto/engines/GOST28147Engine.cs index e37ddaefd..71e6d9e44 100644 --- a/crypto/src/crypto/engines/GOST28147Engine.cs +++ b/crypto/src/crypto/engines/GOST28147Engine.cs @@ -183,7 +183,8 @@ namespace Org.BouncyCastle.Crypto.Engines } else if (parameters != null) { - throw new ArgumentException("invalid parameter passed to Gost28147 init - " + parameters.GetType().Name); + throw new ArgumentException("invalid parameter passed to Gost28147 init - " + + Platform.GetTypeName(parameters)); } } diff --git a/crypto/src/crypto/engines/HC128Engine.cs b/crypto/src/crypto/engines/HC128Engine.cs index 40c7a4e17..7bd1a48ed 100644 --- a/crypto/src/crypto/engines/HC128Engine.cs +++ b/crypto/src/crypto/engines/HC128Engine.cs @@ -2,6 +2,7 @@ using System; using Org.BouncyCastle.Crypto.Parameters; using Org.BouncyCastle.Crypto.Utilities; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Crypto.Engines { @@ -180,7 +181,7 @@ namespace Org.BouncyCastle.Crypto.Engines else { throw new ArgumentException( - "Invalid parameter passed to HC128 init - " + parameters.GetType().Name, + "Invalid parameter passed to HC128 init - " + Platform.GetTypeName(parameters), "parameters"); } diff --git a/crypto/src/crypto/engines/HC256Engine.cs b/crypto/src/crypto/engines/HC256Engine.cs index 6eb360711..b72258a19 100644 --- a/crypto/src/crypto/engines/HC256Engine.cs +++ b/crypto/src/crypto/engines/HC256Engine.cs @@ -2,6 +2,7 @@ using System; using Org.BouncyCastle.Crypto.Parameters; using Org.BouncyCastle.Crypto.Utilities; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Crypto.Engines { @@ -164,7 +165,7 @@ namespace Org.BouncyCastle.Crypto.Engines else { throw new ArgumentException( - "Invalid parameter passed to HC256 init - " + parameters.GetType().Name, + "Invalid parameter passed to HC256 init - " + Platform.GetTypeName(parameters), "parameters"); } diff --git a/crypto/src/crypto/engines/ISAACEngine.cs b/crypto/src/crypto/engines/ISAACEngine.cs index f25577130..b94ee6ed9 100644 --- a/crypto/src/crypto/engines/ISAACEngine.cs +++ b/crypto/src/crypto/engines/ISAACEngine.cs @@ -2,6 +2,7 @@ using System; using Org.BouncyCastle.Crypto.Parameters; using Org.BouncyCastle.Crypto.Utilities; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Crypto.Engines { @@ -41,7 +42,7 @@ namespace Org.BouncyCastle.Crypto.Engines { if (!(parameters is KeyParameter)) throw new ArgumentException( - "invalid parameter passed to ISAAC Init - " + parameters.GetType().Name, + "invalid parameter passed to ISAAC Init - " + Platform.GetTypeName(parameters), "parameters"); /* diff --git a/crypto/src/crypto/engines/IdeaEngine.cs b/crypto/src/crypto/engines/IdeaEngine.cs index 4909510ac..18a151c93 100644 --- a/crypto/src/crypto/engines/IdeaEngine.cs +++ b/crypto/src/crypto/engines/IdeaEngine.cs @@ -1,6 +1,7 @@ using System; using Org.BouncyCastle.Crypto.Parameters; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Crypto.Engines { @@ -52,7 +53,7 @@ namespace Org.BouncyCastle.Crypto.Engines ICipherParameters parameters) { if (!(parameters is KeyParameter)) - throw new ArgumentException("invalid parameter passed to IDEA init - " + parameters.GetType().ToString()); + throw new ArgumentException("invalid parameter passed to IDEA init - " + Platform.GetTypeName(parameters)); workingKey = GenerateWorkingKey(forEncryption, ((KeyParameter)parameters).GetKey()); diff --git a/crypto/src/crypto/engines/NoekeonEngine.cs b/crypto/src/crypto/engines/NoekeonEngine.cs index dd78a4ea5..f64be50ba 100644 --- a/crypto/src/crypto/engines/NoekeonEngine.cs +++ b/crypto/src/crypto/engines/NoekeonEngine.cs @@ -2,6 +2,7 @@ using System; using Org.BouncyCastle.Crypto.Parameters; using Org.BouncyCastle.Crypto.Utilities; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Crypto.Engines { @@ -70,7 +71,8 @@ namespace Org.BouncyCastle.Crypto.Engines ICipherParameters parameters) { if (!(parameters is KeyParameter)) - throw new ArgumentException("Invalid parameters passed to Noekeon init - " + parameters.GetType().Name, "parameters"); + throw new ArgumentException("Invalid parameters passed to Noekeon init - " + + Platform.GetTypeName(parameters), "parameters"); _forEncryption = forEncryption; _initialised = true; diff --git a/crypto/src/crypto/engines/RC2Engine.cs b/crypto/src/crypto/engines/RC2Engine.cs index b56953de5..4aca1894f 100644 --- a/crypto/src/crypto/engines/RC2Engine.cs +++ b/crypto/src/crypto/engines/RC2Engine.cs @@ -1,6 +1,7 @@ using System; using Org.BouncyCastle.Crypto.Parameters; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Crypto.Engines { @@ -135,7 +136,7 @@ namespace Org.BouncyCastle.Crypto.Engines } else { - throw new ArgumentException("invalid parameter passed to RC2 init - " + parameters.GetType().Name); + throw new ArgumentException("invalid parameter passed to RC2 init - " + Platform.GetTypeName(parameters)); } } diff --git a/crypto/src/crypto/engines/RC4Engine.cs b/crypto/src/crypto/engines/RC4Engine.cs index fd84b7d23..a515bb04e 100644 --- a/crypto/src/crypto/engines/RC4Engine.cs +++ b/crypto/src/crypto/engines/RC4Engine.cs @@ -1,6 +1,7 @@ using System; using Org.BouncyCastle.Crypto.Parameters; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Crypto.Engines { @@ -44,7 +45,7 @@ namespace Org.BouncyCastle.Crypto.Engines return; } - throw new ArgumentException("invalid parameter passed to RC4 init - " + parameters.GetType().ToString()); + throw new ArgumentException("invalid parameter passed to RC4 init - " + Platform.GetTypeName(parameters)); } public virtual string AlgorithmName diff --git a/crypto/src/crypto/engines/RC532Engine.cs b/crypto/src/crypto/engines/RC532Engine.cs index 169a60b98..d1c29e624 100644 --- a/crypto/src/crypto/engines/RC532Engine.cs +++ b/crypto/src/crypto/engines/RC532Engine.cs @@ -1,6 +1,7 @@ using System; using Org.BouncyCastle.Crypto.Parameters; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Crypto.Engines { @@ -91,7 +92,7 @@ namespace Org.BouncyCastle.Crypto.Engines } else { - throw new ArgumentException("invalid parameter passed to RC532 init - " + parameters.GetType().ToString()); + throw new ArgumentException("invalid parameter passed to RC532 init - " + Platform.GetTypeName(parameters)); } this.forEncryption = forEncryption; diff --git a/crypto/src/crypto/engines/RC564Engine.cs b/crypto/src/crypto/engines/RC564Engine.cs index ddcce0fa8..097fd60ba 100644 --- a/crypto/src/crypto/engines/RC564Engine.cs +++ b/crypto/src/crypto/engines/RC564Engine.cs @@ -1,6 +1,7 @@ using System; using Org.BouncyCastle.Crypto.Parameters; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Crypto.Engines { @@ -80,7 +81,7 @@ namespace Org.BouncyCastle.Crypto.Engines { if (!(typeof(RC5Parameters).IsInstanceOfType(parameters))) { - throw new ArgumentException("invalid parameter passed to RC564 init - " + parameters.GetType().ToString()); + throw new ArgumentException("invalid parameter passed to RC564 init - " + Platform.GetTypeName(parameters)); } RC5Parameters p = (RC5Parameters)parameters; diff --git a/crypto/src/crypto/engines/RC6Engine.cs b/crypto/src/crypto/engines/RC6Engine.cs index 196bd8394..9aeb1e7cb 100644 --- a/crypto/src/crypto/engines/RC6Engine.cs +++ b/crypto/src/crypto/engines/RC6Engine.cs @@ -1,6 +1,7 @@ using System; using Org.BouncyCastle.Crypto.Parameters; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Crypto.Engines { @@ -76,7 +77,7 @@ namespace Org.BouncyCastle.Crypto.Engines ICipherParameters parameters) { if (!(parameters is KeyParameter)) - throw new ArgumentException("invalid parameter passed to RC6 init - " + parameters.GetType().ToString()); + throw new ArgumentException("invalid parameter passed to RC6 init - " + Platform.GetTypeName(parameters)); this.forEncryption = forEncryption; diff --git a/crypto/src/crypto/engines/RijndaelEngine.cs b/crypto/src/crypto/engines/RijndaelEngine.cs index 80f522353..7025cb5dc 100644 --- a/crypto/src/crypto/engines/RijndaelEngine.cs +++ b/crypto/src/crypto/engines/RijndaelEngine.cs @@ -1,6 +1,7 @@ using System; using Org.BouncyCastle.Crypto.Parameters; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Crypto.Engines { @@ -582,7 +583,7 @@ namespace Org.BouncyCastle.Crypto.Engines return; } - throw new ArgumentException("invalid parameter passed to Rijndael init - " + parameters.GetType().ToString()); + throw new ArgumentException("invalid parameter passed to Rijndael init - " + Platform.GetTypeName(parameters)); } public virtual string AlgorithmName diff --git a/crypto/src/crypto/engines/SerpentEngineBase.cs b/crypto/src/crypto/engines/SerpentEngineBase.cs index a4c686922..a5d91b3be 100644 --- a/crypto/src/crypto/engines/SerpentEngineBase.cs +++ b/crypto/src/crypto/engines/SerpentEngineBase.cs @@ -1,6 +1,7 @@ using System; using Org.BouncyCastle.Crypto.Parameters; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Crypto.Engines { @@ -32,7 +33,7 @@ namespace Org.BouncyCastle.Crypto.Engines public virtual void Init(bool encrypting, ICipherParameters parameters) { if (!(parameters is KeyParameter)) - throw new ArgumentException("invalid parameter passed to " + AlgorithmName + " init - " + parameters.GetType().ToString()); + throw new ArgumentException("invalid parameter passed to " + AlgorithmName + " init - " + Platform.GetTypeName(parameters)); this.encrypting = encrypting; this.wKey = MakeWorkingKey(((KeyParameter)parameters).GetKey()); diff --git a/crypto/src/crypto/engines/SkipjackEngine.cs b/crypto/src/crypto/engines/SkipjackEngine.cs index a45dc9b24..c90646cc4 100644 --- a/crypto/src/crypto/engines/SkipjackEngine.cs +++ b/crypto/src/crypto/engines/SkipjackEngine.cs @@ -1,6 +1,7 @@ using System; using Org.BouncyCastle.Crypto.Parameters; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Crypto.Engines { @@ -48,7 +49,7 @@ namespace Org.BouncyCastle.Crypto.Engines ICipherParameters parameters) { if (!(parameters is KeyParameter)) - throw new ArgumentException("invalid parameter passed to SKIPJACK init - " + parameters.GetType().ToString()); + throw new ArgumentException("invalid parameter passed to SKIPJACK init - " + Platform.GetTypeName(parameters)); byte[] keyBytes = ((KeyParameter)parameters).GetKey(); diff --git a/crypto/src/crypto/engines/TEAEngine.cs b/crypto/src/crypto/engines/TEAEngine.cs index 2e1a7002b..7b700145e 100644 --- a/crypto/src/crypto/engines/TEAEngine.cs +++ b/crypto/src/crypto/engines/TEAEngine.cs @@ -2,6 +2,7 @@ using System; using Org.BouncyCastle.Crypto.Parameters; using Org.BouncyCastle.Crypto.Utilities; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Crypto.Engines { @@ -66,7 +67,7 @@ namespace Org.BouncyCastle.Crypto.Engines if (!(parameters is KeyParameter)) { throw new ArgumentException("invalid parameter passed to TEA init - " - + parameters.GetType().FullName); + + Platform.GetTypeName(parameters)); } _forEncryption = forEncryption; diff --git a/crypto/src/crypto/engines/ThreefishEngine.cs b/crypto/src/crypto/engines/ThreefishEngine.cs index 33ff3a421..eade3cc72 100644 --- a/crypto/src/crypto/engines/ThreefishEngine.cs +++ b/crypto/src/crypto/engines/ThreefishEngine.cs @@ -2,6 +2,7 @@ using System; using Org.BouncyCastle.Crypto.Parameters; using Org.BouncyCastle.Crypto.Utilities; +using Org.BouncyCastle.Utilities; using Org.BouncyCastle.Utilities.Encoders; namespace Org.BouncyCastle.Crypto.Engines @@ -174,7 +175,7 @@ namespace Org.BouncyCastle.Crypto.Engines else { throw new ArgumentException("Invalid parameter passed to Threefish init - " - + parameters.GetType().Name); + + Platform.GetTypeName(parameters)); } ulong[] keyWords = null; diff --git a/crypto/src/crypto/engines/TwofishEngine.cs b/crypto/src/crypto/engines/TwofishEngine.cs index 04a579ced..71c246594 100644 --- a/crypto/src/crypto/engines/TwofishEngine.cs +++ b/crypto/src/crypto/engines/TwofishEngine.cs @@ -1,6 +1,7 @@ using System; using Org.BouncyCastle.Crypto.Parameters; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Crypto.Engines { @@ -267,7 +268,7 @@ namespace Org.BouncyCastle.Crypto.Engines ICipherParameters parameters) { if (!(parameters is KeyParameter)) - throw new ArgumentException("invalid parameter passed to Twofish init - " + parameters.GetType().ToString()); + throw new ArgumentException("invalid parameter passed to Twofish init - " + Platform.GetTypeName(parameters)); this.encrypting = forEncryption; this.workingKey = ((KeyParameter)parameters).GetKey(); diff --git a/crypto/src/crypto/engines/XTEAEngine.cs b/crypto/src/crypto/engines/XTEAEngine.cs index 40d81fbe6..5fcfa4a57 100644 --- a/crypto/src/crypto/engines/XTEAEngine.cs +++ b/crypto/src/crypto/engines/XTEAEngine.cs @@ -2,6 +2,7 @@ using System; using Org.BouncyCastle.Crypto.Parameters; using Org.BouncyCastle.Crypto.Utilities; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Crypto.Engines { @@ -64,7 +65,7 @@ namespace Org.BouncyCastle.Crypto.Engines if (!(parameters is KeyParameter)) { throw new ArgumentException("invalid parameter passed to TEA init - " - + parameters.GetType().FullName); + + Platform.GetTypeName(parameters)); } _forEncryption = forEncryption; diff --git a/crypto/src/crypto/macs/GOST28147Mac.cs b/crypto/src/crypto/macs/GOST28147Mac.cs index 9a8f1b730..cc6b723d6 100644 --- a/crypto/src/crypto/macs/GOST28147Mac.cs +++ b/crypto/src/crypto/macs/GOST28147Mac.cs @@ -2,6 +2,7 @@ using System; using Org.BouncyCastle.Crypto; using Org.BouncyCastle.Crypto.Parameters; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Crypto.Macs { @@ -83,7 +84,7 @@ namespace Org.BouncyCastle.Crypto.Macs else { throw new ArgumentException("invalid parameter passed to Gost28147 init - " - + parameters.GetType().Name); + + Platform.GetTypeName(parameters)); } } diff --git a/crypto/src/crypto/macs/SkeinMac.cs b/crypto/src/crypto/macs/SkeinMac.cs index 1d61a41ca..07eff24f4 100644 --- a/crypto/src/crypto/macs/SkeinMac.cs +++ b/crypto/src/crypto/macs/SkeinMac.cs @@ -3,6 +3,7 @@ using System; using Org.BouncyCastle.Crypto.Digests; using Org.BouncyCastle.Crypto.Parameters; using Org.BouncyCastle.Crypto.Utilities; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Crypto.Macs { @@ -79,7 +80,7 @@ namespace Org.BouncyCastle.Crypto.Macs else { throw new ArgumentException("Invalid parameter passed to Skein MAC init - " - + parameters.GetType().Name); + + Platform.GetTypeName(parameters)); } if (skeinParameters.GetKey() == null) { diff --git a/crypto/src/crypto/tls/DefaultTlsAgreementCredentials.cs b/crypto/src/crypto/tls/DefaultTlsAgreementCredentials.cs index 5147a1990..fab978886 100644 --- a/crypto/src/crypto/tls/DefaultTlsAgreementCredentials.cs +++ b/crypto/src/crypto/tls/DefaultTlsAgreementCredentials.cs @@ -40,7 +40,7 @@ namespace Org.BouncyCastle.Crypto.Tls } else { - throw new ArgumentException("type not supported: " + privateKey.GetType().FullName, "privateKey"); + throw new ArgumentException("type not supported: " + Platform.GetTypeName(privateKey), "privateKey"); } this.mCertificate = certificate; diff --git a/crypto/src/crypto/tls/DefaultTlsEncryptionCredentials.cs b/crypto/src/crypto/tls/DefaultTlsEncryptionCredentials.cs index 34d15d146..5348ee88d 100644 --- a/crypto/src/crypto/tls/DefaultTlsEncryptionCredentials.cs +++ b/crypto/src/crypto/tls/DefaultTlsEncryptionCredentials.cs @@ -2,6 +2,7 @@ using System.IO; using Org.BouncyCastle.Crypto.Parameters; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Crypto.Tls { @@ -29,7 +30,7 @@ namespace Org.BouncyCastle.Crypto.Tls } else { - throw new ArgumentException("type not supported: " + privateKey.GetType().FullName, "privateKey"); + throw new ArgumentException("type not supported: " + Platform.GetTypeName(privateKey), "privateKey"); } this.mContext = context; diff --git a/crypto/src/crypto/tls/DefaultTlsSignerCredentials.cs b/crypto/src/crypto/tls/DefaultTlsSignerCredentials.cs index c7a136573..0ff732a97 100644 --- a/crypto/src/crypto/tls/DefaultTlsSignerCredentials.cs +++ b/crypto/src/crypto/tls/DefaultTlsSignerCredentials.cs @@ -2,6 +2,7 @@ using System; using System.IO; using Org.BouncyCastle.Crypto.Parameters; +using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Crypto.Tls { @@ -48,7 +49,7 @@ namespace Org.BouncyCastle.Crypto.Tls } else { - throw new ArgumentException("type not supported: " + privateKey.GetType().FullName, "privateKey"); + throw new ArgumentException("type not supported: " + Platform.GetTypeName(privateKey), "privateKey"); } this.mSigner.Init(context); diff --git a/crypto/src/openpgp/PgpPublicKeyRingBundle.cs b/crypto/src/openpgp/PgpPublicKeyRingBundle.cs index e73848439..91113e904 100644 --- a/crypto/src/openpgp/PgpPublicKeyRingBundle.cs +++ b/crypto/src/openpgp/PgpPublicKeyRingBundle.cs @@ -52,7 +52,7 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp if (pgpPub == null) { - throw new PgpException(obj.GetType().FullName + " found where PgpPublicKeyRing expected"); + throw new PgpException(Platform.GetTypeName(obj) + " found where PgpPublicKeyRing expected"); } long key = pgpPub.GetPublicKey().KeyId; diff --git a/crypto/src/openpgp/PgpSecretKeyRingBundle.cs b/crypto/src/openpgp/PgpSecretKeyRingBundle.cs index b0df0ed3f..c9f4d3959 100644 --- a/crypto/src/openpgp/PgpSecretKeyRingBundle.cs +++ b/crypto/src/openpgp/PgpSecretKeyRingBundle.cs @@ -1,6 +1,5 @@ using System; using System.Collections; -using System.Globalization; using System.IO; using Org.BouncyCastle.Utilities; @@ -53,7 +52,7 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp if (pgpSecret == null) { - throw new PgpException(obj.GetType().FullName + " found where PgpSecretKeyRing expected"); + throw new PgpException(Platform.GetTypeName(obj) + " found where PgpSecretKeyRing expected"); } long key = pgpSecret.GetPublicKey().KeyId; diff --git a/crypto/src/openssl/MiscPemGenerator.cs b/crypto/src/openssl/MiscPemGenerator.cs index 443e446f7..22ae1eae1 100644 --- a/crypto/src/openssl/MiscPemGenerator.cs +++ b/crypto/src/openssl/MiscPemGenerator.cs @@ -3,7 +3,6 @@ using System.Collections; using System.IO; using Org.BouncyCastle.Asn1; -using Org.BouncyCastle.Asn1.Cms; using Org.BouncyCastle.Asn1.CryptoPro; using Org.BouncyCastle.Asn1.Pkcs; using Org.BouncyCastle.Asn1.X509; @@ -127,7 +126,7 @@ namespace Org.BouncyCastle.OpenSsl } else { - throw new PemGenerationException("Object type not supported: " + obj.GetType().FullName); + throw new PemGenerationException("Object type not supported: " + Platform.GetTypeName(obj)); } return new PemObject(type, encoding); @@ -185,7 +184,7 @@ namespace Org.BouncyCastle.OpenSsl if (type == null || keyData == null) { // TODO Support other types? - throw new PemGenerationException("Object type not supported: " + obj.GetType().FullName); + throw new PemGenerationException("Object type not supported: " + Platform.GetTypeName(obj)); } @@ -250,7 +249,7 @@ namespace Org.BouncyCastle.OpenSsl } else { - throw new ArgumentException("Cannot handle private key of type: " + akp.GetType().FullName, "akp"); + throw new ArgumentException("Cannot handle private key of type: " + Platform.GetTypeName(akp), "akp"); } return info.ParsePrivateKey().GetEncoded(); diff --git a/crypto/src/pkcs/PrivateKeyInfoFactory.cs b/crypto/src/pkcs/PrivateKeyInfoFactory.cs index aafc4c292..a349a11d2 100644 --- a/crypto/src/pkcs/PrivateKeyInfoFactory.cs +++ b/crypto/src/pkcs/PrivateKeyInfoFactory.cs @@ -173,7 +173,7 @@ namespace Org.BouncyCastle.Pkcs return new PrivateKeyInfo(algID, new DerOctetString(keyBytes)); } - throw new ArgumentException("Class provided is not convertible: " + key.GetType().FullName); + throw new ArgumentException("Class provided is not convertible: " + Platform.GetTypeName(key)); } public static PrivateKeyInfo CreatePrivateKeyInfo( diff --git a/crypto/src/pkix/PkixCertPathBuilder.cs b/crypto/src/pkix/PkixCertPathBuilder.cs index 7082fe409..fa38a5ec0 100644 --- a/crypto/src/pkix/PkixCertPathBuilder.cs +++ b/crypto/src/pkix/PkixCertPathBuilder.cs @@ -42,7 +42,7 @@ namespace Org.BouncyCastle.Pkix throw new PkixCertPathBuilderException( "TargetConstraints must be an instance of " + typeof(X509CertStoreSelector).FullName + " for " - + this.GetType() + " class."); + + Platform.GetTypeName(this) + " class."); } ISet targets = new HashSet(); diff --git a/crypto/src/pkix/PkixParameters.cs b/crypto/src/pkix/PkixParameters.cs index 47d3b5e37..01ed9d4fa 100644 --- a/crypto/src/pkix/PkixParameters.cs +++ b/crypto/src/pkix/PkixParameters.cs @@ -737,7 +737,7 @@ namespace Org.BouncyCastle.Pkix if (!(obj is TrustAnchor)) { throw new InvalidCastException("All elements of set must be " - + "of type " + typeof(TrustAnchor).Name + "."); + + "of type " + typeof(TrustAnchor).FullName + "."); } } this.trustedACIssuers = new HashSet(trustedACIssuers); diff --git a/crypto/src/util/Platform.cs b/crypto/src/util/Platform.cs index 361fe7536..86484854d 100644 --- a/crypto/src/util/Platform.cs +++ b/crypto/src/util/Platform.cs @@ -220,5 +220,10 @@ namespace Org.BouncyCastle.Utilities { return InvariantCompareInfo.IsSuffix(source, suffix, CompareOptions.Ordinal); } + + internal static string GetTypeName(object obj) + { + return obj.GetType().FullName; + } } } diff --git a/crypto/src/x509/SubjectPublicKeyInfoFactory.cs b/crypto/src/x509/SubjectPublicKeyInfoFactory.cs index bb6f37831..7614321d4 100644 --- a/crypto/src/x509/SubjectPublicKeyInfoFactory.cs +++ b/crypto/src/x509/SubjectPublicKeyInfoFactory.cs @@ -1,7 +1,4 @@ using System; -using System.IO; -using System.Collections; -using System.Text; using Org.BouncyCastle.Crypto.Parameters; using Org.BouncyCastle.Asn1; @@ -167,7 +164,7 @@ namespace Org.BouncyCastle.X509 return new SubjectPublicKeyInfo(algID, new DerOctetString(keyBytes)); } - throw new ArgumentException("Class provided no convertible: " + key.GetType().FullName); + throw new ArgumentException("Class provided no convertible: " + Platform.GetTypeName(key)); } private static void ExtractBytes( -- cgit 1.5.1