+2005-02-10 Sebastien Pouliot <sebastien@ximian.com>
+
+ * DSA.cs: Weekly fix to case where DSAParameters.Counter is 0 :-(
+ A new unit test was added for this specific case so it's hopefully
+ the last fix for this. Fixed exception reporting to match NET_2_0.
+
2005-01-30 Sebastien Pouliot <sebastien@ximian.com>
* DSA.cs: Really fixed case where DSAParameters.Counter is 0.
sb.Append ("<PgenCounter>");
// the number of bytes is important (no matter == 0x00)
- byte[] inArr = BitConverterLE.GetBytes (dsaParams.Counter);
- int l = inArr.Length;
- if (l > 0) {
+ if (dsaParams.Counter != 0) {
+ byte[] inArr = BitConverterLE.GetBytes (dsaParams.Counter);
+ int l = inArr.Length;
while (inArr[l-1] == 0x00)
l--;
- byte[] c = new byte [l];
- Buffer.BlockCopy (inArr, 0, c, 0, l);
- sb.Append (Convert.ToBase64String (c));
+
+ sb.Append (Convert.ToBase64String (inArr, 0, l));
} else {
sb.Append ("AA=="); // base64 encoded 0
}
sb.Append ("</X>");
}
else if (includePrivateParameters) {
+#if NET_2_0
+ throw new ArgumentNullException ("X");
+#else
throw new CryptographicException (
Locale.GetText ("Missing private key informations"));
+#endif
}
sb.Append ("</DSAKeyValue>");