diff --git a/crypto/src/asn1/Asn1Object.cs b/crypto/src/asn1/Asn1Object.cs
index 08bd599c1..a86fdbb4a 100644
--- a/crypto/src/asn1/Asn1Object.cs
+++ b/crypto/src/asn1/Asn1Object.cs
@@ -13,13 +13,18 @@ namespace Org.BouncyCastle.Asn1
public static Asn1Object FromByteArray(
byte[] data)
{
- try
+ try
{
- return new Asn1InputStream(data).ReadObject();
+ MemoryStream input = new MemoryStream(data, false);
+ Asn1InputStream asn1 = new Asn1InputStream(input, data.Length);
+ Asn1Object result = asn1.ReadObject();
+ if (input.Position != input.Length)
+ throw new IOException("extra data found after object");
+ return result;
}
catch (InvalidCastException)
{
- throw new IOException("cannot recognise object in stream");
+ throw new IOException("cannot recognise object in byte array");
}
}
@@ -36,7 +41,7 @@ namespace Org.BouncyCastle.Asn1
}
catch (InvalidCastException)
{
- throw new IOException("cannot recognise object in stream");
+ throw new IOException("cannot recognise object in stream");
}
}
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/BERBitString.cs b/crypto/src/asn1/BERBitString.cs
new file mode 100644
index 000000000..d8cd00330
--- /dev/null
+++ b/crypto/src/asn1/BERBitString.cs
@@ -0,0 +1,43 @@
+using System;
+
+using Org.BouncyCastle.Utilities;
+
+namespace Org.BouncyCastle.Asn1
+{
+ public class BerBitString
+ : DerBitString
+ {
+ public BerBitString(byte[] data, int padBits)
+ : base(data, padBits)
+ {
+ }
+
+ public BerBitString(byte[] data)
+ : base(data)
+ {
+ }
+
+ public BerBitString(int namedBits)
+ : base(namedBits)
+ {
+ }
+
+ public BerBitString(Asn1Encodable obj)
+ : base(obj)
+ {
+ }
+
+ internal override void Encode(
+ DerOutputStream derOut)
+ {
+ if (derOut is Asn1OutputStream || derOut is BerOutputStream)
+ {
+ derOut.WriteEncoded(Asn1Tags.BitString, (byte)mPadBits, mData);
+ }
+ else
+ {
+ base.Encode(derOut);
+ }
+ }
+ }
+}
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/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/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 d5cb872bc..a3c2cee01 100644
--- a/crypto/src/asn1/DerBitString.cs
+++ b/crypto/src/asn1/DerBitString.cs
@@ -1,6 +1,8 @@
using System;
+using System.Diagnostics;
using System.Text;
+using Org.BouncyCastle.Math;
using Org.BouncyCastle.Utilities;
namespace Org.BouncyCastle.Asn1
@@ -11,83 +13,10 @@ namespace Org.BouncyCastle.Asn1
private static readonly char[] table
= { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
- private readonly byte[] data;
- private readonly int padBits;
+ protected readonly byte[] mData;
+ protected readonly int mPadBits;
- /**
- * return the correct number of pad bits for a bit string defined in
- * a 32 bit constant
- */
- static internal int GetPadBits(
- int bitString)
- {
- int val = 0;
- for (int i = 3; i >= 0; i--)
- {
- //
- // this may look a little odd, but if it isn't done like this pre jdk1.2
- // JVM's break!
- //
- if (i != 0)
- {
- if ((bitString >> (i * 8)) != 0)
- {
- val = (bitString >> (i * 8)) & 0xFF;
- break;
- }
- }
- else
- {
- if (bitString != 0)
- {
- val = bitString & 0xFF;
- break;
- }
- }
- }
-
- if (val == 0)
- {
- return 7;
- }
-
- int bits = 1;
-
- while (((val <<= 1) & 0xFF) != 0)
- {
- bits++;
- }
-
- return 8 - bits;
- }
-
- /**
- * return the correct number of bytes for a bit string defined in
- * a 32 bit constant
- */
- static internal byte[] GetBytes(
- int bitString)
- {
- int bytes = 4;
- for (int i = 3; i >= 1; i--)
- {
- if ((bitString & (0xFF << (i * 8))) != 0)
- {
- break;
- }
- bytes--;
- }
-
- byte[] result = new byte[bytes];
- for (int i = 0; i < bytes; i++)
- {
- result[i] = (byte) ((bitString >> (i * 8)) & 0xFF);
- }
-
- return result;
- }
-
- /**
+ /**
* return a Bit string from the passed in object
*
* @exception ArgumentException if the object cannot be converted.
@@ -100,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));
}
/**
@@ -126,15 +55,7 @@ namespace Org.BouncyCastle.Asn1
return FromAsn1Octets(((Asn1OctetString)o).GetOctets());
}
- internal DerBitString(
- byte data,
- int padBits)
- {
- this.data = new byte[]{ data };
- this.padBits = padBits;
- }
-
- /**
+ /**
* @param data the octets making up the bit string.
* @param padBits the number of extra bits at the end of the string.
*/
@@ -142,67 +63,152 @@ namespace Org.BouncyCastle.Asn1
byte[] data,
int padBits)
{
- // TODO Deep copy?
- this.data = data;
- this.padBits = padBits;
+ if (data == null)
+ throw new ArgumentNullException("data");
+ if (padBits < 0 || padBits > 7)
+ throw new ArgumentException("must be in the range 0 to 7", "padBits");
+ if (data.Length == 0 && padBits != 0)
+ throw new ArgumentException("if 'data' is empty, 'padBits' must be 0");
+
+ this.mData = Arrays.Clone(data);
+ this.mPadBits = padBits;
}
public DerBitString(
byte[] data)
+ : this(data, 0)
{
- // TODO Deep copy?
- this.data = data;
}
- public DerBitString(
+ public DerBitString(
+ int namedBits)
+ {
+ if (namedBits == 0)
+ {
+ this.mData = new byte[0];
+ this.mPadBits = 0;
+ return;
+ }
+
+ int bits = BigInteger.BitLen(namedBits);
+ int bytes = (bits + 7) / 8;
+
+ Debug.Assert(0 < bytes && bytes <= 4);
+
+ byte[] data = new byte[bytes];
+ --bytes;
+
+ for (int i = 0; i < bytes; i++)
+ {
+ data[i] = (byte)namedBits;
+ namedBits >>= 8;
+ }
+
+ Debug.Assert((namedBits & 0xFF) != 0);
+
+ data[bytes] = (byte)namedBits;
+
+ int padBits = 0;
+ while ((namedBits & (1 << padBits)) == 0)
+ {
+ ++padBits;
+ }
+
+ Debug.Assert(padBits < 8);
+
+ this.mData = data;
+ this.mPadBits = padBits;
+ }
+
+ public DerBitString(
Asn1Encodable obj)
+ : this(obj.GetDerEncoded())
{
- this.data = obj.GetDerEncoded();
- //this.padBits = 0;
}
- public byte[] GetBytes()
+ /**
+ * Return the octets contained in this BIT STRING, checking that this BIT STRING really
+ * does represent an octet aligned string. Only use this method when the standard you are
+ * following dictates that the BIT STRING will be octet aligned.
+ *
+ * @return a copy of the octet aligned data.
+ */
+ public virtual byte[] GetOctets()
+ {
+ if (mPadBits != 0)
+ throw new InvalidOperationException("attempt to get non-octet aligned data from BIT STRING");
+
+ return Arrays.Clone(mData);
+ }
+
+ public virtual byte[] GetBytes()
{
- return data;
+ byte[] data = Arrays.Clone(mData);
+
+ // DER requires pad bits be zero
+ if (mPadBits > 0)
+ {
+ data[data.Length - 1] &= (byte)(0xFF << mPadBits);
+ }
+
+ return data;
}
- public int PadBits
+ public virtual int PadBits
{
- get { return padBits; }
+ get { return mPadBits; }
}
/**
* @return the value of the bit string as an int (truncating if necessary)
*/
- public int IntValue
+ public virtual int IntValue
{
get
{
- int value = 0;
-
- for (int i = 0; i != data.Length && i != 4; i++)
- {
- value |= (data[i] & 0xff) << (8 * i);
- }
-
- return value;
+ int value = 0, length = System.Math.Min(4, mData.Length);
+ for (int i = 0; i < length; ++i)
+ {
+ value |= (int)mData[i] << (8 * i);
+ }
+ if (mPadBits > 0 && length == mData.Length)
+ {
+ int mask = (1 << mPadBits) - 1;
+ value &= ~(mask << (8 * (length - 1)));
+ }
+ return value;
}
}
- internal override void Encode(
+ internal override void Encode(
DerOutputStream derOut)
{
- byte[] bytes = new byte[GetBytes().Length + 1];
-
- bytes[0] = (byte) PadBits;
- Array.Copy(GetBytes(), 0, bytes, 1, bytes.Length - 1);
-
- derOut.WriteEncoded(Asn1Tags.BitString, bytes);
+ if (mPadBits > 0)
+ {
+ int last = mData[mData.Length - 1];
+ int mask = (1 << mPadBits) - 1;
+ int unusedBits = last & mask;
+
+ if (unusedBits != 0)
+ {
+ byte[] contents = Arrays.Prepend(mData, (byte)mPadBits);
+
+ /*
+ * X.690-0207 11.2.1: Each unused bit in the final octet of the encoding of a bit string value shall be set to zero.
+ */
+ contents[contents.Length - 1] = (byte)(last ^ unusedBits);
+
+ derOut.WriteEncoded(Asn1Tags.BitString, contents);
+ return;
+ }
+ }
+
+ derOut.WriteEncoded(Asn1Tags.BitString, (byte)mPadBits, mData);
}
- protected override int Asn1GetHashCode()
+ protected override int Asn1GetHashCode()
{
- return padBits.GetHashCode() ^ Arrays.GetHashCode(data);
+ return mPadBits.GetHashCode() ^ Arrays.GetHashCode(mData);
}
protected override bool Asn1Equals(
@@ -213,8 +219,8 @@ namespace Org.BouncyCastle.Asn1
if (other == null)
return false;
- return this.padBits == other.padBits
- && Arrays.AreEqual(this.data, other.data);
+ return this.mPadBits == other.mPadBits
+ && Arrays.AreEqual(this.mData, other.mData);
}
public override string GetString()
@@ -236,12 +242,23 @@ namespace Org.BouncyCastle.Asn1
internal static DerBitString FromAsn1Octets(byte[] octets)
{
if (octets.Length < 1)
- throw new ArgumentException("truncated BIT STRING detected");
+ throw new ArgumentException("truncated BIT STRING detected", "octets");
+
+ int padBits = octets[0];
+ byte[] data = Arrays.CopyOfRange(octets, 1, octets.Length);
+
+ if (padBits > 0 && padBits < 8 && data.Length > 0)
+ {
+ int last = data[data.Length - 1];
+ int mask = (1 << padBits) - 1;
+
+ if ((last & mask) != 0)
+ {
+ return new BerBitString(data, padBits);
+ }
+ }
- int padBits = octets[0];
- byte[] data = new byte[octets.Length - 1];
- Array.Copy(octets, 1, data, 0, data.Length);
- return new DerBitString(data, padBits);
+ return new DerBitString(data, padBits);
}
}
}
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 17c42e7cf..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");
}
/**
@@ -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/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 f9f6a79d6..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");
}
/**
@@ -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/DerOutputStream.cs b/crypto/src/asn1/DerOutputStream.cs
index c03d9dc11..69d5d5f28 100644
--- a/crypto/src/asn1/DerOutputStream.cs
+++ b/crypto/src/asn1/DerOutputStream.cs
@@ -19,7 +19,7 @@ namespace Org.BouncyCastle.Asn1
if (length > 127)
{
int size = 1;
- uint val = (uint) length;
+ uint val = (uint)length;
while ((val >>= 8) != 0)
{
@@ -43,18 +43,29 @@ namespace Org.BouncyCastle.Asn1
int tag,
byte[] bytes)
{
- WriteByte((byte) tag);
+ WriteByte((byte)tag);
WriteLength(bytes.Length);
Write(bytes, 0, bytes.Length);
}
- internal void WriteEncoded(
+ internal void WriteEncoded(
+ int tag,
+ byte first,
+ byte[] bytes)
+ {
+ WriteByte((byte)tag);
+ WriteLength(bytes.Length + 1);
+ WriteByte(first);
+ Write(bytes, 0, bytes.Length);
+ }
+
+ internal void WriteEncoded(
int tag,
byte[] bytes,
int offset,
int length)
{
- WriteByte((byte) tag);
+ WriteByte((byte)tag);
WriteLength(length);
Write(bytes, offset, length);
}
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 4f0792636..5d058619d 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/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/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/PKIFailureInfo.cs b/crypto/src/asn1/cmp/PKIFailureInfo.cs
index 1df0e0693..75a3ff0d7 100644
--- a/crypto/src/asn1/cmp/PKIFailureInfo.cs
+++ b/crypto/src/asn1/cmp/PKIFailureInfo.cs
@@ -2,66 +2,89 @@ using System;
namespace Org.BouncyCastle.Asn1.Cmp
{
- /**
- * <pre>
- * PKIFailureInfo ::= BIT STRING {
- * badAlg (0),
- * -- unrecognized or unsupported Algorithm Identifier
- * badMessageCheck (1), -- integrity check failed (e.g., signature did not verify)
- * badRequest (2),
- * -- transaction not permitted or supported
- * badTime (3), -- messageTime was not sufficiently close to the system time, as defined by local policy
- * badCertId (4), -- no certificate could be found matching the provided criteria
- * badDataFormat (5),
- * -- the data submitted has the wrong format
- * wrongAuthority (6), -- the authority indicated in the request is different from the one creating the response token
- * incorrectData (7), -- the requester's data is incorrect (for notary services)
- * missingTimeStamp (8), -- when the timestamp is missing but should be there (by policy)
- * badPOP (9) -- the proof-of-possession failed
- * timeNotAvailable (14),
- * -- the TSA's time source is not available
- * unacceptedPolicy (15),
- * -- the requested TSA policy is not supported by the TSA
- * unacceptedExtension (16),
- * -- the requested extension is not supported by the TSA
- * addInfoNotAvailable (17)
- * -- the additional information requested could not be understood
- * -- or is not available
- * systemFailure (25)
- * -- the request cannot be handled due to system failure
- * </pre>
- */
+ /**
+ * <pre>
+ * PKIFailureInfo ::= BIT STRING {
+ * badAlg (0),
+ * -- unrecognized or unsupported Algorithm Identifier
+ * badMessageCheck (1), -- integrity check failed (e.g., signature did not verify)
+ * badRequest (2),
+ * -- transaction not permitted or supported
+ * badTime (3), -- messageTime was not sufficiently close to the system time, as defined by local policy
+ * badCertId (4), -- no certificate could be found matching the provided criteria
+ * badDataFormat (5),
+ * -- the data submitted has the wrong format
+ * wrongAuthority (6), -- the authority indicated in the request is different from the one creating the response token
+ * incorrectData (7), -- the requester's data is incorrect (for notary services)
+ * missingTimeStamp (8), -- when the timestamp is missing but should be there (by policy)
+ * badPOP (9) -- the proof-of-possession failed
+ * certRevoked (10),
+ * certConfirmed (11),
+ * wrongIntegrity (12),
+ * badRecipientNonce (13),
+ * timeNotAvailable (14),
+ * -- the TSA's time source is not available
+ * unacceptedPolicy (15),
+ * -- the requested TSA policy is not supported by the TSA
+ * unacceptedExtension (16),
+ * -- the requested extension is not supported by the TSA
+ * addInfoNotAvailable (17)
+ * -- the additional information requested could not be understood
+ * -- or is not available
+ * badSenderNonce (18),
+ * badCertTemplate (19),
+ * signerNotTrusted (20),
+ * transactionIdInUse (21),
+ * unsupportedVersion (22),
+ * notAuthorized (23),
+ * systemUnavail (24),
+ * systemFailure (25),
+ * -- the request cannot be handled due to system failure
+ * duplicateCertReq (26)
+ * </pre>
+ */
public class PkiFailureInfo
: DerBitString
{
- public const int BadAlg = (1 << 7); // unrecognized or unsupported Algorithm Identifier
- public const int BadMessageCheck = (1 << 6); // integrity check failed (e.g., signature did not verify)
- public const int BadRequest = (1 << 5);
- public const int BadTime = (1 << 4); // -- messageTime was not sufficiently close to the system time, as defined by local policy
- public const int BadCertId = (1 << 3); // no certificate could be found matching the provided criteria
- public const int BadDataFormat = (1 << 2);
- public const int WrongAuthority = (1 << 1); // the authority indicated in the request is different from the one creating the response token
- public const int IncorrectData = 1; // the requester's data is incorrect (for notary services)
- public const int MissingTimeStamp = (1 << 15); // when the timestamp is missing but should be there (by policy)
- public const int BadPop = (1 << 14); // the proof-of-possession failed
- public const int TimeNotAvailable = (1 << 9); // the TSA's time source is not available
- public const int UnacceptedPolicy = (1 << 8); // the requested TSA policy is not supported by the TSA
- public const int UnacceptedExtension = (1 << 23); //the requested extension is not supported by the TSA
- public const int AddInfoNotAvailable = (1 << 22); //the additional information requested could not be understood or is not available
- public const int SystemFailure = (1 << 30); //the request cannot be handled due to system failure
+ public const int BadAlg = (1 << 7); // unrecognized or unsupported Algorithm Identifier
+ public const int BadMessageCheck = (1 << 6); // integrity check failed (e.g., signature did not verify)
+ public const int BadRequest = (1 << 5);
+ public const int BadTime = (1 << 4); // -- messageTime was not sufficiently close to the system time, as defined by local policy
+ public const int BadCertId = (1 << 3); // no certificate could be found matching the provided criteria
+ public const int BadDataFormat = (1 << 2);
+ public const int WrongAuthority = (1 << 1); // the authority indicated in the request is different from the one creating the response token
+ public const int IncorrectData = 1; // the requester's data is incorrect (for notary services)
+ public const int MissingTimeStamp = (1 << 15); // when the timestamp is missing but should be there (by policy)
+ public const int BadPop = (1 << 14); // the proof-of-possession failed
+ public const int CertRevoked = (1 << 13);
+ public const int CertConfirmed = (1 << 12);
+ public const int WrongIntegrity = (1 << 11);
+ public const int BadRecipientNonce = (1 << 10);
+ public const int TimeNotAvailable = (1 << 9); // the TSA's time source is not available
+ public const int UnacceptedPolicy = (1 << 8); // the requested TSA policy is not supported by the TSA
+ public const int UnacceptedExtension = (1 << 23); //the requested extension is not supported by the TSA
+ public const int AddInfoNotAvailable = (1 << 22); //the additional information requested could not be understood or is not available
+ public const int BadSenderNonce = (1 << 21);
+ public const int BadCertTemplate = (1 << 20);
+ public const int SignerNotTrusted = (1 << 19);
+ public const int TransactionIdInUse = (1 << 18);
+ public const int UnsupportedVersion = (1 << 17);
+ public const int NotAuthorized = (1 << 16);
+ public const int SystemUnavail = (1 << 31);
+ public const int SystemFailure = (1 << 30); //the request cannot be handled due to system failure
+ public const int DuplicateCertReq = (1 << 29);
- /**
+ /**
* Basic constructor.
*/
- public PkiFailureInfo(
- int info)
- : base(GetBytes(info), GetPadBits(info))
+ public PkiFailureInfo(int info)
+ : base(info)
{
}
public PkiFailureInfo(
DerBitString info)
- : base(info.GetBytes(), info.PadBits)
+ : base(info.GetBytes(), info.PadBits)
{
}
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 aabaf4386..9f29c6242 100644
--- a/crypto/src/asn1/cms/OriginatorPublicKey.cs
+++ b/crypto/src/asn1/cms/OriginatorPublicKey.cs
@@ -1,29 +1,30 @@
using System;
-using Org.BouncyCastle.Asn1;
using Org.BouncyCastle.Asn1.X509;
+using Org.BouncyCastle.Utilities;
namespace Org.BouncyCastle.Asn1.Cms
{
public class OriginatorPublicKey
: Asn1Encodable
{
- private AlgorithmIdentifier algorithm;
- private DerBitString publicKey;
+ private readonly AlgorithmIdentifier mAlgorithm;
+ private readonly DerBitString mPublicKey;
- public OriginatorPublicKey(
+ public OriginatorPublicKey(
AlgorithmIdentifier algorithm,
byte[] publicKey)
{
- this.algorithm = algorithm;
- this.publicKey = new DerBitString(publicKey);
+ this.mAlgorithm = algorithm;
+ this.mPublicKey = new DerBitString(publicKey);
}
+ [Obsolete("Use 'GetInstance' instead")]
public OriginatorPublicKey(
Asn1Sequence seq)
{
- algorithm = AlgorithmIdentifier.GetInstance(seq[0]);
- publicKey = (DerBitString) seq[1];
+ this.mAlgorithm = AlgorithmIdentifier.GetInstance(seq[0]);
+ this.mPublicKey = DerBitString.GetInstance(seq[1]);
}
/**
@@ -55,19 +56,19 @@ namespace Org.BouncyCastle.Asn1.Cms
return (OriginatorPublicKey)obj;
if (obj is Asn1Sequence)
- return new OriginatorPublicKey((Asn1Sequence) obj);
+ 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
{
- get { return algorithm; }
+ get { return mAlgorithm; }
}
public DerBitString PublicKey
{
- get { return publicKey; }
+ get { return mPublicKey; }
}
/**
@@ -81,7 +82,7 @@ namespace Org.BouncyCastle.Asn1.Cms
*/
public override Asn1Object ToAsn1Object()
{
- return new DerSequence(algorithm, publicKey);
+ return new DerSequence(mAlgorithm, mPublicKey);
}
}
}
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
{
/// <remarks>
@@ -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
{
/// <remarks>
@@ -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
{
/// <remarks>
@@ -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
{
/// <remarks>
@@ -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
{
/// <remarks>
@@ -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
{
/// <remarks>
@@ -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
{
/// <remarks>
@@ -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 972ef8c6b..7794c81fa 100644
--- a/crypto/src/asn1/ess/OtherCertID.cs
+++ b/crypto/src/asn1/ess/OtherCertID.cs
@@ -1,6 +1,8 @@
using System;
+using Org.BouncyCastle.Asn1.Oiw;
using Org.BouncyCastle.Asn1.X509;
+using Org.BouncyCastle.Utilities;
namespace Org.BouncyCastle.Asn1.Ess
{
@@ -26,7 +28,7 @@ namespace Org.BouncyCastle.Asn1.Ess
throw new ArgumentException(
"unknown object in 'OtherCertID' factory : "
- + o.GetType().Name + ".");
+ + Platform.GetTypeName(o) + ".");
}
/**
@@ -78,7 +80,7 @@ namespace Org.BouncyCastle.Asn1.Ess
if (otherCertHash.ToAsn1Object() is Asn1OctetString)
{
// SHA-1
- return new AlgorithmIdentifier("1.3.14.3.2.26");
+ return new AlgorithmIdentifier(OiwObjectIdentifiers.IdSha1);
}
return DigestInfo.GetInstance(otherCertHash).AlgorithmID;
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/misc/NetscapeCertType.cs b/crypto/src/asn1/misc/NetscapeCertType.cs
index d5db6523d..d809eae66 100644
--- a/crypto/src/asn1/misc/NetscapeCertType.cs
+++ b/crypto/src/asn1/misc/NetscapeCertType.cs
@@ -36,7 +36,7 @@ namespace Org.BouncyCastle.Asn1.Misc
* e.g. (X509NetscapeCertType.sslCA | X509NetscapeCertType.smimeCA)
*/
public NetscapeCertType(int usage)
- : base(GetBytes(usage), GetPadBits(usage))
+ : base(usage)
{
}
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 dd666addf..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(
@@ -94,7 +95,12 @@ namespace Org.BouncyCastle.Asn1.Ocsp
get { return signature; }
}
- [Obsolete("Use Certs property instead")]
+ public byte[] GetSignatureOctets()
+ {
+ return signature.GetOctets();
+ }
+
+ [Obsolete("Use Certs property instead")]
public Asn1Sequence GetCerts()
{
return certs;
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 a07e7a709..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(
@@ -80,7 +80,12 @@ namespace Org.BouncyCastle.Asn1.Ocsp
get { return signatureValue; }
}
- public Asn1Sequence Certs
+ public byte[] GetSignatureOctets()
+ {
+ return signatureValue.GetOctets();
+ }
+
+ public Asn1Sequence Certs
{
get { return certs; }
}
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/CertificationRequest.cs b/crypto/src/asn1/pkcs/CertificationRequest.cs
index 32b1612d2..35bdd56eb 100644
--- a/crypto/src/asn1/pkcs/CertificationRequest.cs
+++ b/crypto/src/asn1/pkcs/CertificationRequest.cs
@@ -73,7 +73,12 @@ namespace Org.BouncyCastle.Asn1.Pkcs
get { return sigBits; }
}
- public override Asn1Object ToAsn1Object()
+ public byte[] GetSignatureOctets()
+ {
+ return sigBits.GetOctets();
+ }
+
+ public override Asn1Object ToAsn1Object()
{
return new DerSequence(reqInfo, sigAlgId, sigBits);
}
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 5b64d6f67..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
@@ -43,7 +43,7 @@ namespace Org.BouncyCastle.Asn1.Pkcs
public override Asn1Object ToAsn1Object()
{
- return new DerSequence(ObjectID, Parameters);
+ return new DerSequence(Algorithm, Parameters);
}
}
}
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/PrivateKeyInfo.cs b/crypto/src/asn1/pkcs/PrivateKeyInfo.cs
index 404277ba6..c5be7a315 100644
--- a/crypto/src/asn1/pkcs/PrivateKeyInfo.cs
+++ b/crypto/src/asn1/pkcs/PrivateKeyInfo.cs
@@ -29,14 +29,14 @@ namespace Org.BouncyCastle.Asn1.Pkcs
return new PrivateKeyInfo(Asn1Sequence.GetInstance(obj));
}
- public PrivateKeyInfo(AlgorithmIdentifier algID, Asn1Object privateKey)
+ public PrivateKeyInfo(AlgorithmIdentifier algID, Asn1Encodable privateKey)
: this(algID, privateKey, null)
{
}
public PrivateKeyInfo(
AlgorithmIdentifier algID,
- Asn1Object privateKey,
+ Asn1Encodable privateKey,
Asn1Set attributes)
{
this.algID = algID;
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/sec/ECPrivateKeyStructure.cs b/crypto/src/asn1/sec/ECPrivateKeyStructure.cs
index 8d805fa30..32e020c0b 100644
--- a/crypto/src/asn1/sec/ECPrivateKeyStructure.cs
+++ b/crypto/src/asn1/sec/ECPrivateKeyStructure.cs
@@ -23,6 +23,7 @@ namespace Org.BouncyCastle.Asn1.Sec
return new ECPrivateKeyStructure(Asn1Sequence.GetInstance(obj));
}
+ [Obsolete("Use 'GetInstance' instead")]
public ECPrivateKeyStructure(
Asn1Sequence seq)
{
@@ -32,6 +33,7 @@ namespace Org.BouncyCastle.Asn1.Sec
this.seq = seq;
}
+ [Obsolete("Use constructor which takes 'orderBitLength' instead, to guarantee correct encoding")]
public ECPrivateKeyStructure(
BigInteger key)
{
@@ -44,12 +46,30 @@ namespace Org.BouncyCastle.Asn1.Sec
}
public ECPrivateKeyStructure(
+ int orderBitLength,
+ BigInteger key)
+ {
+ if (key == null)
+ throw new ArgumentNullException("key");
+ if (orderBitLength < key.BitLength)
+ throw new ArgumentException("must be >= key bitlength", "orderBitLength");
+
+ byte[] bytes = BigIntegers.AsUnsignedByteArray((orderBitLength + 7) / 8, key);
+
+ this.seq = new DerSequence(
+ new DerInteger(1),
+ new DerOctetString(bytes));
+ }
+
+ [Obsolete("Use constructor which takes 'orderBitLength' instead, to guarantee correct encoding")]
+ public ECPrivateKeyStructure(
BigInteger key,
Asn1Encodable parameters)
: this(key, null, parameters)
{
}
+ [Obsolete("Use constructor which takes 'orderBitLength' instead, to guarantee correct encoding")]
public ECPrivateKeyStructure(
BigInteger key,
DerBitString publicKey,
@@ -75,6 +95,44 @@ namespace Org.BouncyCastle.Asn1.Sec
this.seq = new DerSequence(v);
}
+ public ECPrivateKeyStructure(
+ int orderBitLength,
+ BigInteger key,
+ Asn1Encodable parameters)
+ : this(orderBitLength, key, null, parameters)
+ {
+ }
+
+ public ECPrivateKeyStructure(
+ int orderBitLength,
+ BigInteger key,
+ DerBitString publicKey,
+ Asn1Encodable parameters)
+ {
+ if (key == null)
+ throw new ArgumentNullException("key");
+ if (orderBitLength < key.BitLength)
+ throw new ArgumentException("must be >= key bitlength", "orderBitLength");
+
+ byte[] bytes = BigIntegers.AsUnsignedByteArray((orderBitLength + 7) / 8, key);
+
+ Asn1EncodableVector v = new Asn1EncodableVector(
+ new DerInteger(1),
+ new DerOctetString(bytes));
+
+ if (parameters != null)
+ {
+ v.Add(new DerTaggedObject(true, 0, parameters));
+ }
+
+ if (publicKey != null)
+ {
+ v.Add(new DerTaggedObject(true, 1, publicKey));
+ }
+
+ this.seq = new DerSequence(v);
+ }
+
public virtual BigInteger GetKey()
{
Asn1OctetString octs = (Asn1OctetString) seq[1];
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/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/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/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/AttributeCertificate.cs b/crypto/src/asn1/x509/AttributeCertificate.cs
index 5f85910da..41893b6b4 100644
--- a/crypto/src/asn1/x509/AttributeCertificate.cs
+++ b/crypto/src/asn1/x509/AttributeCertificate.cs
@@ -63,7 +63,12 @@ namespace Org.BouncyCastle.Asn1.X509
get { return signatureValue; }
}
- /**
+ public byte[] GetSignatureOctets()
+ {
+ return signatureValue.GetOctets();
+ }
+
+ /**
* Produce an object suitable for an Asn1OutputStream.
* <pre>
* AttributeCertificate ::= Sequence {
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/CertificateList.cs b/crypto/src/asn1/x509/CertificateList.cs
index 0412e0816..567cf132a 100644
--- a/crypto/src/asn1/x509/CertificateList.cs
+++ b/crypto/src/asn1/x509/CertificateList.cs
@@ -80,7 +80,12 @@ namespace Org.BouncyCastle.Asn1.X509
get { return sig; }
}
- public int Version
+ public byte[] GetSignatureOctets()
+ {
+ return sig.GetOctets();
+ }
+
+ public int Version
{
get { return tbsCertList.Version; }
}
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 710ddc922..b8794ea8f 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
@@ -202,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(
@@ -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/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/KeyUsage.cs b/crypto/src/asn1/x509/KeyUsage.cs
index fef04e8b9..aeaffb708 100644
--- a/crypto/src/asn1/x509/KeyUsage.cs
+++ b/crypto/src/asn1/x509/KeyUsage.cs
@@ -53,9 +53,8 @@ namespace Org.BouncyCastle.Asn1.X509
* allowed uses for the key.
* e.g. (KeyUsage.keyEncipherment | KeyUsage.dataEncipherment)
*/
- public KeyUsage(
- int usage)
- : base(GetBytes(usage), GetPadBits(usage))
+ public KeyUsage(int usage)
+ : base(usage)
{
}
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
{
/// <remarks>
@@ -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/ReasonFlags.cs b/crypto/src/asn1/x509/ReasonFlags.cs
index f204c36aa..ad45e84ae 100644
--- a/crypto/src/asn1/x509/ReasonFlags.cs
+++ b/crypto/src/asn1/x509/ReasonFlags.cs
@@ -31,13 +31,12 @@ namespace Org.BouncyCastle.Asn1.X509
* @param reasons - the bitwise OR of the Key Reason flags giving the
* allowed uses for the key.
*/
- public ReasonFlags(
- int reasons)
- : base(GetBytes(reasons), GetPadBits(reasons))
+ public ReasonFlags(int reasons)
+ : base(reasons)
{
}
- public ReasonFlags(
+ public ReasonFlags(
DerBitString reasons)
: base(reasons.GetBytes(), reasons.PadBits)
{
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/SubjectPublicKeyInfo.cs b/crypto/src/asn1/x509/SubjectPublicKeyInfo.cs
index 8ce4b2762..477329b7e 100644
--- a/crypto/src/asn1/x509/SubjectPublicKeyInfo.cs
+++ b/crypto/src/asn1/x509/SubjectPublicKeyInfo.cs
@@ -75,7 +75,7 @@ namespace Org.BouncyCastle.Asn1.X509
*/
public Asn1Object GetPublicKey()
{
- return Asn1Object.FromByteArray(keyData.GetBytes());
+ return Asn1Object.FromByteArray(keyData.GetOctets());
}
/**
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/X509CertificateStructure.cs b/crypto/src/asn1/x509/X509CertificateStructure.cs
index c8558ae61..6e7c85de6 100644
--- a/crypto/src/asn1/x509/X509CertificateStructure.cs
+++ b/crypto/src/asn1/x509/X509CertificateStructure.cs
@@ -119,6 +119,11 @@ namespace Org.BouncyCastle.Asn1.X509
get { return sig; }
}
+ public byte[] GetSignatureOctets()
+ {
+ return sig.GetOctets();
+ }
+
public override Asn1Object ToAsn1Object()
{
return new DerSequence(tbsCert, sigAlgID, sig);
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/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/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/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/asn1/x9/X962Parameters.cs b/crypto/src/asn1/x9/X962Parameters.cs
index 5b7eaa1de..04a5c9cbe 100644
--- a/crypto/src/asn1/x9/X962Parameters.cs
+++ b/crypto/src/asn1/x9/X962Parameters.cs
@@ -1,3 +1,5 @@
+using System;
+
using Org.BouncyCastle.Asn1;
namespace Org.BouncyCastle.Asn1.X9
@@ -7,6 +9,34 @@ namespace Org.BouncyCastle.Asn1.X9
{
private readonly Asn1Object _params;
+ public static X962Parameters GetInstance(
+ object obj)
+ {
+ if (obj == null || obj is X962Parameters)
+ {
+ return (X962Parameters)obj;
+ }
+
+ if (obj is Asn1Object)
+ {
+ return new X962Parameters((Asn1Object)obj);
+ }
+
+ if (obj is byte[])
+ {
+ try
+ {
+ return new X962Parameters(Asn1Object.FromByteArray((byte[])obj));
+ }
+ catch (Exception e)
+ {
+ throw new ArgumentException("unable to parse encoded data: " + e.Message, e);
+ }
+ }
+
+ throw new ArgumentException("unknown object in getInstance()");
+ }
+
public X962Parameters(
X9ECParameters ecParameters)
{
@@ -30,6 +60,11 @@ namespace Org.BouncyCastle.Asn1.X9
get { return (_params is DerObjectIdentifier); }
}
+ public bool IsImplicitlyCA
+ {
+ get { return (_params is Asn1Null); }
+ }
+
public Asn1Object Parameters
{
get { return _params; }
diff --git a/crypto/src/asn1/x9/X9ECParameters.cs b/crypto/src/asn1/x9/X9ECParameters.cs
index 2b6b14bcb..0fa343768 100644
--- a/crypto/src/asn1/x9/X9ECParameters.cs
+++ b/crypto/src/asn1/x9/X9ECParameters.cs
@@ -20,6 +20,21 @@ namespace Org.BouncyCastle.Asn1.X9
private BigInteger h;
private byte[] seed;
+ public static X9ECParameters GetInstance(Object obj)
+ {
+ if (obj is X9ECParameters)
+ {
+ return (X9ECParameters)obj;
+ }
+
+ if (obj != null)
+ {
+ return new X9ECParameters(Asn1Sequence.GetInstance(obj));
+ }
+
+ return null;
+ }
+
public X9ECParameters(
Asn1Sequence seq)
{
|