- 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));
+ if (dsaParams.Counter != 0) {
+ byte[] inArr = BitConverterLE.GetBytes (dsaParams.Counter);
+ int l = inArr.Length;
+ while (inArr[l-1] == 0x00)
+ l--;
+
+ sb.Append (Convert.ToBase64String (inArr, 0, l));
+ } else {
+ sb.Append ("AA=="); // base64 encoded 0
+ }