[Mono-dev] Mono.Security: Error when loading a CRL in ASN1

Jonathon Rossi jono at jonorossi.com
Thu Oct 15 21:40:15 EDT 2009


I am trying to load a CRL with the Mono.Security library (tried with the Windows binaries, and with the trunk) like this:
X509Crl crl = X509Crl.CreateFromFile(@"C:\ca.crl");

And I get a CryptographicException: Input data cannot be coded as a valid

I have looking into the source code and this is occurring inside
ASN1.DecodeTLV. At this point the code is trying to do a block copy of 104
bytes, where the asn1 array only has 103 left (pos+length), and it throws an
ArgumentException: "Offset and length were out of bounds for the array or
count is greater than the number of elements from index to the end of the
source collection."

Mono.Security.dll!Mono.Security.ASN1.DecodeTLV(byte[] asn1 = {byte[69237]},
ref int pos = 69134, out byte tag = 104, out int length = 104, out byte[]
content = {byte[104]}) Line 279 + 0x33 bytes
Mono.Security.dll!Mono.Security.ASN1.Decode(byte[] asn1 = {byte[69237]}, ref
int anPos = 69134, int anLength = 69237) Line 249 + 0x36 bytes
Mono.Security.dll!Mono.Security.ASN1.ASN1(byte[] data = {byte[69237]}) Line
90 + 0x26 bytes
Mono.Security.dll!Mono.Security.X509.X509Crl.Parse(byte[] crl =
{byte[69237]}) Line 139 + 0x33 bytes
Mono.Security.dll!Mono.Security.X509.X509Crl.X509Crl(byte[] crl =
{byte[69237]}) Line 131 + 0x13 bytes
Mono.Security.dll!Mono.Security.X509.X509Crl.CreateFromFile(string filename
= "C:\\ca.crl") Line 421 + 0x20 bytes
ConsoleApplication2.exe!ConsoleApplication2.Program.Main(string[] args =
{string[0]}) Line 14 + 0x12 bytes

The CRL is 68KB, and verifies using certutil.

I cannot provide the CRL, however any pointers on what could be causing this
would be really helpful.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20091016/9194c5a4/attachment.html 

More information about the Mono-devel-list mailing list