How to pin the Public key of a certificate on iOS

In case you are in need of knowing how to extract this information from the certificate in your iOS code, here you have one way to do it. First of all add the security framework. #import <Security/Security.h> The add the openssl libraries. You can download them from https://github.com/st3fan/ios-openssl #import <openssl/x509.h> The NSURLConnectionDelegate Protocol allows you … Read more

Ignore self-signed ssl cert using Jersey Client [duplicate]

After some searching and trawling through some old stackoverflow questions I’ve found a solution in a previously asked SO question: Question: Java client certificates over HTTPS/SSL Answer Java client certificates over HTTPS/SSL Here’s the code that I ended up using. // Create a trust manager that does not validate certificate chains TrustManager[] trustAllCerts = new … Read more

Java Keytool error after importing certificate , “keytool error: java.io.FileNotFoundException & Access Denied”

This could happen if you are not running the command prompt in administrator mode. If you are using windows 7, you can go to run, type cmd and hit Ctrl+Shift+enter. This will open the command prompt in administrator mode. If not, you can also go to start -> all programs -> accessories -> right click … Read more

Using SSL and SslStream for peer to peer authentication?

Step 1: Generating a self-signed certificate: I downloaded the Certificate.cs class posted by Doug Cook I used this code to generate a .pfx certificate file: byte[] c = Certificate.CreateSelfSignCertificatePfx( “CN=yourhostname.com”, //host name DateTime.Parse(“2000-01-01”), //not valid before DateTime.Parse(“2010-01-01”), //not valid after “mypassword”); //password to encrypt key file using (BinaryWriter binWriter = new BinaryWriter( File.Open(@”testcert.pfx”, FileMode.Create))) { … Read more

How can I have CodeIgniter load specific pages using SSL?

There are few ways to tackle this. Option 1: I would probably have the code deployed to both folders, then in the file: /system/application/config/config.php, set your page to: $config[‘base_url’] = “http://www.yoursite.com/”; or $config[‘base_url’] = “https://www.yoursite.com/”; Then in your non-ssl VirtualHost folder, set your config to redirect protected pages by folder to the SSL site: RedirectPermanent … Read more

What is CA certificate, and why do we need it?

A CA certificate is a digital certificate issued by a certificate authority (CA), so SSL clients (such as web browsers) can use it to verify the SSL certificates sign by this CA. For example, stackoverflow.com uses Let’s Encrypt to sign its servers, and SSL certificates sent by stackoverflow.com mention they are signed by Let’s Encrypt. … Read more

Using Apache httpclient for https

I put together this test app to reproduce the issue using the HTTP testing framework from the Apache HttpClient package: ClassLoader cl = HCTest.class.getClassLoader(); URL url = cl.getResource(“test.keystore”); KeyStore keystore = KeyStore.getInstance(“jks”); char[] pwd = “nopassword”.toCharArray(); keystore.load(url.openStream(), pwd); TrustManagerFactory tmf = TrustManagerFactory.getInstance( TrustManagerFactory.getDefaultAlgorithm()); tmf.init(keystore); TrustManager[] tm = tmf.getTrustManagers(); KeyManagerFactory kmfactory = KeyManagerFactory.getInstance( KeyManagerFactory.getDefaultAlgorithm()); kmfactory.init(keystore, pwd); … Read more