Skip to content

Instantly share code, notes, and snippets.

@vhyrbi
vhyrbi / SslCertificateAuthority.java
Created August 12, 2014 13:03
Android - Example on using personal Certificate Authority
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.security.KeyManagementException;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.Certificate;
import java.security.cert.CertificateException;
@vhyrbi
vhyrbi / SSLHelper.m
Last active February 13, 2022 10:59
iOS - How to add HTTPS support for one's own Certificate Authority
#import <Security/Security.h>
#import <CoreFoundation/CoreFoundation.h>
#import <Foundation/Foundation.h>
@interface SSLHelper : NSObject
+ (SSLHelper *)sharedInstance;
- (void) addCertToKeychain:(NSData*)certInDer;
- (BOOL) canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace;
- (BOOL) manageAuthorizationForChallenge:(NSURLAuthenticationChallenge*)challenge;