[Mono-list] Problems with CRLDistributionPointsExtension

Hellan.Kim KHE KHE@kmd.dk
Wed, 23 Feb 2005 15:44:48 +0100


This is a multi-part message in MIME format.

------_=_NextPart_001_01C519B6.391E17F2
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit

I get exceptions when trying to parse a CRLDistributionPointsExtension
object since I need to find the directory location of the CRL.
My code looks something like this:
 
CRLDistributionPointsExtension cdpExt = null;
foreach( X509Extension xe in x509.Extensions ) 
{
  if( xe.Oid != "2.5.29.31" )
    continue;
  cdpExt = new CRLDistributionPointsExtension( xe );
  break;
}
 
if(cdpExt == null)
  throw new CryptographicException("No cRLDistributionPoint extension
found in certificate.");
 
// Testing
string xx = cdpExt.Oid;      // Works just fine
xx = cdpExt.Name;           // Works just fine
xx = cdpExt.ToString();    // !!!!!!!!! Throws exception

The following exception is thrown:
 
An unhandled exception of type 'System.NullReferenceException' occurred
in mono.security.dll
Additional information: Object reference not set to an instance of an
object.

Any idea what I can do to make this work?
 
Med venlig hilsen / Best regards
 
Kim Hellan
KMD / Sikkerhed
Mailto:khe@kmd.dk <mailto:khe@kmd.dk> 
 




___________________________________________________________________
www.kmd.dk www.kundenet.kmd.dk www.eboks.dk www.civitas.dk
www.netborger.dk

Hvis du har modtaget denne mail ved en fejl vil jeg gerne, at du
informerer mig og sletter den.
KMD skaber it-services, der fremmer effektivitet hos det offentlige,
erhvervslivet og borgerne.

If you received this e-mail by mistake, please notify me and delete it.
Thank you.
Our mission is to enhance the efficiency of the public sector and
improve its service of the general public. 



------_=_NextPart_001_01C519B6.391E17F2
Content-Type: text/html;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dus-ascii">
<META content=3D"MSHTML 6.00.2800.1491" name=3DGENERATOR></HEAD>
<BODY>
<DIV><FONT face=3DVerdana size=3D2><SPAN class=3D916213814-23022005>I =
get exceptions=20
when trying to parse a CRLDistributionPointsExtension object since I =
need to=20
find the directory location of the CRL.</SPAN></FONT></DIV>
<DIV><FONT face=3DVerdana size=3D2><SPAN class=3D916213814-23022005>My =
code looks=20
something like this:</SPAN></FONT></DIV>
<DIV><FONT face=3DVerdana size=3D2><SPAN=20
class=3D916213814-23022005></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DVerdana size=3D2><SPAN=20
class=3D916213814-23022005>CRLDistributionPointsExtension cdpExt =3D=20
null;<BR>foreach( X509Extension xe in x509.Extensions ) <BR>{<BR>&nbsp; =
if(=20
xe.Oid !=3D "2.5.29.31" )<BR>&nbsp;&nbsp;&nbsp; continue;<BR>&nbsp; =
cdpExt =3D new=20
CRLDistributionPointsExtension( xe );<BR>&nbsp; =
break;<BR>}</SPAN></FONT></DIV>
<DIV><FONT face=3DVerdana size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DVerdana size=3D2><SPAN =
class=3D916213814-23022005>if(cdpExt =3D=3D=20
null)<BR>&nbsp; throw new CryptographicException("No =
cRLDistributionPoint=20
extension found in certificate.");</SPAN></FONT></DIV>
<DIV><FONT face=3DVerdana size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DVerdana size=3D2><SPAN class=3D916213814-23022005>//=20
Testing</SPAN></FONT></DIV>
<DIV><FONT face=3DVerdana size=3D2><SPAN =
class=3D916213814-23022005>string xx =3D=20
cdpExt.Oid;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Works just fine<BR>xx =
=3D=20
cdpExt.Name;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;//=20
Works just fine<BR>xx =3D cdpExt.ToString();&nbsp;&nbsp;&nbsp; // =
!!!!!!!!! Throws=20
exception<BR></DIV></SPAN></FONT>
<DIV><FONT face=3DVerdana size=3D2><SPAN class=3D916213814-23022005>The =
following=20
exception is thrown:</SPAN></FONT></DIV>
<DIV><FONT face=3DVerdana size=3D2><SPAN=20
class=3D916213814-23022005></SPAN></FONT><FONT face=3DVerdana =
size=3D2><SPAN=20
class=3D916213814-23022005></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DVerdana size=3D2>An unhandled exception of type=20
'System.NullReferenceException' occurred in =
mono.security.dll</FONT></DIV>
<DIV><FONT face=3DVerdana size=3D2>Additional information: Object =
reference not set=20
to an instance of an object.<BR></FONT></DIV>
<DIV><FONT face=3DVerdana size=3D2><SPAN class=3D916213814-23022005>Any =
idea what I=20
can do to make this work?</SPAN></FONT></DIV>
<DIV><FONT face=3DVerdana size=3D2><SPAN=20
class=3D916213814-23022005></SPAN></FONT>&nbsp;</DIV>
<DIV align=3Dleft><FONT face=3D"Bookman Old Style" size=3D2>Med venlig =
hilsen / Best=20
regards</FONT></DIV>
<DIV><FONT face=3D"Bookman Old Style" size=3D1></FONT>&nbsp;</DIV>
<DIV align=3Dleft><FONT size=3D1><FONT face=3D"Bookman Old Style"><FONT =
color=3D#0000ff=20
size=3D3><STRONG>Kim Hellan</STRONG></FONT><BR></FONT><FONT=20
face=3D"Bookman Old Style" size=3D2>KMD / Sikkerhed<BR></FONT></FONT><A=20
href=3D"mailto:khe@kmd.dk"><FONT face=3D"Bookman Old Style"=20
size=3D2>Mailto:khe@kmd.dk</FONT></A></DIV>
<DIV><FONT face=3DVerdana size=3D2></FONT>&nbsp;</DIV><br>
<br>
<br>
<br>
___________________________________________________________________<br>
www.kmd.dk   www.kundenet.kmd.dk   www.eboks.dk   www.civitas.dk   =
www.netborger.dk<br>
<br>
Hvis du har modtaget denne mail ved en fejl vil jeg gerne, at du =
informerer mig og sletter den.<br>
KMD skaber it-services, der fremmer effektivitet hos det offentlige, =
erhvervslivet og borgerne.<br>
<br>
If you received this e-mail by mistake, please notify me and delete it. =
Thank you.<br>
Our mission is to enhance the efficiency of the public sector and =
improve its service of the general public. <br>
<br>
</BODY></HTML>

------_=_NextPart_001_01C519B6.391E17F2--