How can I decode a SSL certificate using python?

Python’s standard library, even in the latest version, does not include anything that can decode X.509 certificates. However, the add-on cryptography package does support this. Quoting an example from the documentation: >>> from cryptography import x509 >>> from cryptography.hazmat.backends import default_backend >>> cert = x509.load_pem_x509_certificate(pem_data, default_backend()) >>> cert.serial_number 2 Another add-on package that might be … Read more

What is the reason of kSecTrustResultRecoverableTrustFailure?

It may be a server certificate problem…. Check here, I solved my kSecTrustResultRecoverableTrustFailure problem, adding subjectAltName = DNS:example.com into openssl config file, specifically in server key generation… If you are not using openssl to generate it, I’m sorry but I can help you.. Anyway if you want to use openssl, here is a good tutorial … Read more

How to use Client Certificate Authentication in iOS App

Your NSURLConnection delegate should respond to the connection:didReceiveAuthenticationChallenge: delegate method (see link below). http://developer.apple.com/library/ios/documentation/cocoa/reference/foundation/Classes/NSURLConnection_Class/Reference/Reference.html#//apple_ref/occ/instm/NSObject/connection:didReceiveAuthenticationChallenge: It should respond by asking the challenge for its ‘sender’ and providing it with an appropriate credential. Something like: – (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge { id sender = [challenge sender]; // create a credential from a certificate // see doco for … Read more

Using curl in php with client certificate and private key in separate files

Here is a PHP script with a literal translation of your command line call: <?php $data = “var1=value1&var2=value2&…”; $url = “https://www.somesite.com/page”; $keyFile = “key.pem”; $caFile = “ca.pem”; $certFile = “client.pem”; $certPass = “xxxxxx”; // Initialise cURL $ch = curl_init($actualUrl); // The -d option is equivalent to CURLOPT_POSTFIELDS. But… // PHP’s libcurl interface does not implement … Read more

How do I use the node.js request module to make an SSL call with my own certificate?

This largely elaborates on Peter Lyons’ answer, providing an example. I am assuming that you are requesting a domain running over HTTPS with a certificate signed by your own certificate authority (ca). When using the request library, as you do, there is no need to actually instantiate the agent yourself, you can simply provide some … Read more

How do I tell WCF to skip verification of the certificate?

You might be able to achieve this in Silverlight by allowing cross-domain communication between the web server the hosts the Silverlight application and the remote WCF service. In that case you need to place a clientaccesspolicy.xml file at the root of the domain where the WCF service is hosted: <?xml version=”1.0″ encoding=”utf-8″?> <access-policy> <cross-domain-access> <policy> … Read more

SSLStream example – how do I get certificates that work?

You can get the example to work even with self-signed certificates. I’ve extracted the commands from the makecert tutorial that you’re using with minor modifications: makecert -sv RootCATest.pvk -r -n “CN=FakeServerName” RootCATest.cer makecert -ic RootCATest.cer -iv RootCATest.pvk -n “CN=FakeServerName” -sv TempCert.pvk -pe -sky exchange TempCert.cer cert2spc TempCert.cer TempCert.spc pvkimprt -pfx TempCert.spc TempCert.pvk makecert and cert2psc … Read more