Skip to content

Commit 584dcad

Browse files
authored
Merge pull request #18 from sharmahimanshu/feature/libraryUpgrade
SSL pinning support
2 parents 1a75860 + b1a12c0 commit 584dcad

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

Sources/ScClient/client.swift

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,5 +196,23 @@ public class ScClient : Listener, WebSocketDelegate {
196196
public func disableSSLVerification(value : Bool) {
197197
socket.disableSSLCertValidation = value
198198
}
199+
200+
/**
201+
Uses the .cer files in your app's bundle
202+
*/
203+
public func useSSLCertificate() {
204+
socket.security = SSLSecurity()
205+
}
206+
207+
/**
208+
You load either a Data blob of your certificate or you can use a SecKeyRef if you have a public key you want to use.
209+
- Parameters:
210+
- data: Data blob of your certificate.
211+
- usePublicKeys: The usePublicKeys bool is whether to use the certificates for validation or the public keys.
212+
*/
213+
public func loadSSLCertificateFromData(data : Data, usePublicKeys : Bool = false) {
214+
socket.security = SSLSecurity(certs: [SSLCert(data: data)], usePublicKeys: usePublicKeys)
215+
}
216+
199217
}
200218

0 commit comments

Comments
 (0)