certificate verification

Simon Barber <[email protected]> Tue, 4 Nov 2008 11:59:56 -0800
Newsgroups gmane.comp.python.cryptography
Message-ID <[email protected]>
This is a multi-part message in MIME format.

------=_NextPart_000_0161_01C93E74.DDF61430
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit

I am writing a test case, and want to verify a certificate I've made -
without using an SSL connection. I've tried following the certificate
verification example in the "OpenSSL" O'Reilly book - Is this a good
approach or is there a better way? The example code does this:

 

X509_STORE_new()

X509_STORE_load_locations()

X509_STORE_set_detault_paths()

X509_STORE_set_flags()

X509_STORE_CTX_new()

X509_STORE_CTX_init()

X509_verify_cert()

 

but some of the C functions don't appear in the M2Crypto wrappers. My first
problem is that X509.X509_Store_Context() requires a x509_store_ctx be
passed in - where do I get one? Next problem - what is the right way to call
the C functions that are not wrapped? I have my root CA cert in an X509
structure, not in a file, so I'd rather not use X509_STORE_load_locations().

 

Any help much appreciated.

 

Simon


------=_NextPart_000_0161_01C93E74.DDF61430
Content-Type: text/html;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<html xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns=3D"http://www.w3.org/TR/REC-html40">

<head>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<meta name=3DGenerator content=3D"Microsoft Word 11 (filtered medium)">
<style>
<!--
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:12.0pt;
	font-family:"Times New Roman";}
a:link, span.MsoHyperlink
	{color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{color:purple;
	text-decoration:underline;}
span.EmailStyle17
	{mso-style-type:personal-compose;
	font-family:Arial;
	color:windowtext;}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
	{page:Section1;}
-->
</style>

</head>

<body lang=3DEN-US link=3Dblue vlink=3Dpurple>

<div class=3DSection1>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>I am writing a test case, and want to verify a =
certificate I&#8217;ve
made &#8211; without using an SSL connection. I&#8217;ve tried following =
the
certificate verification example in the &#8220;OpenSSL&#8221; =
O&#8217;Reilly
book &#8211; Is this a good approach or is there a better way? The =
example code
does this:<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>X509_STORE_new()<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>X509_STORE_load_locations()<o:p></o:p></span></font></=
p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>X509_STORE_set_detault_paths()<o:p></o:p></span></font=
></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>X509_STORE_set_flags()<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>X509_STORE_CTX_new()<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>X509_STORE_CTX_init()<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>X509_verify_cert()<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>but some of the C functions don&#8217;t appear in the
M2Crypto wrappers. My first problem is that X509.X509_Store_Context() =
requires
a x509_store_ctx be passed in &#8211; where do I get one? Next problem =
&#8211; what
is the right way to call the C functions that are not wrapped? I have my =
root
CA cert in an X509 structure, not in a file, so I&#8217;d rather not use
X509_STORE_load_locations().<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>Any help much =
appreciated.<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DArial><span =
style=3D'font-size:10.0pt;
font-family:Arial'>Simon<o:p></o:p></span></font></p>

</div>

</body>

</html>

------=_NextPart_000_0161_01C93E74.DDF61430--