Created
July 23, 2014 19:31
-
-
Save zgramana/9f98a3e7046ec738b0aa to your computer and use it in GitHub Desktop.
Use a self-signed certificate in Couchbase Lite for iOS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
openssl x509 -outform der -in cert.pem -out cert.der |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void) registerCerts { | |
NSString *path = [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/cert.der"]; | |
NSData *certData = [NSData dataWithContentsOfFile:path]; | |
SecCertificateRef selfRef = SecCertificateCreateWithData(NULL, (__bridge CFDataRef)(certData)); | |
NSArray *certs = [NSArray arrayWithObject:(__bridge id)(selfRef)]; | |
[CBLReplication setAnchorCerts:certs onlyThese:NO]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment