I am trying to integrate SSL public key pinning in Alamofire swift 5, but I found ServerTrustPolicyManager which is deprecated. Please help me to integrate. Thanks.
How to do SSL public key pinning in Alamofire swift 5
4.4k Views Asked by Bhimashankar At
1
There are 1 best solutions below
Related Questions in IOS
- URLSession requesting JSON array from server not working
- Incorrect display of LinearGradientBrush in IOS
- Module not found when building flutter app for IOS
- How to share metadata of an audio url file to a WhatsApp conversation with friends
- Occasional crash at NSURLSessionDataTask dataTaskWithRequest:completionHandler:
- Expo Deep linking on iOS is not working (because of Google sign-in?)
- On iOS, the keyboard does not offer a 6-character SMS code
- Hi, there is an error happened when I build my flutter app, after I'm installing firebase packages occurs that error
- The copy/paste functionalities don't work only on iOS in the Flutter app
- Hide LiveActivityIntent Button from Shortcuts App
- While Running Github Actions Pipeline: No Signing Certificate "iOS Development" found: No "iOS Development" signing certificate matching team ID
- Actionable notification api call not working in background
- Accessibility : Full keyboard access with scroll view in swiftui
- There is a problem with the request entity - You are not allowed to create 'iOS' profile with App ID 'XXXX'
- I am getting "binding has not yet been initialized" error when trying to connect firebase with flutter
Related Questions in SWIFT
- Navigate after logged in with webservice
- URLSession requesting JSON array from server not working
- When using onDrag in SwiftUI on Mac how can I detect when the dragged object has been released anywhere?
- Protect OpenAI key using Firebase function
- How to correct error: "Cannot convert value of type 'MyType.Type' to expected argument type 'Binding<MyType>'"?
- How to share metadata of an audio url file to a WhatsApp conversation with friends
- Using @Bindable with a Observable type in SwiftUI
- How to make a scroll view of 9 images in a forEach loop open on image 6 if image 6 is clicked on from a grid?
- Using MTLPixelFormat.rgba16Float results in random round-off errors
- Search and highlight text of current text in PDFKit Swift
- How is passing a function as a parameter related to escaping autoclosure?
- Actionable notification api call not working in background
- Custom layout occupies all horizontal space
- Is it possible to fix slow CKAsset loading on Cloudkit?
- Thread 1: Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional value - MapView.isMyLocationEnabled
Related Questions in ALAMOFIRE
- Response not coming from Alamofire post method servicecall in swift
- react native app wont start on ios, ld: Undefined symbols:
- How to manually parse a nested array from a JSON file into a nested array of a data model?
- How to read the data with button press in SwiftUI view where, data called from function
- Send array as a parameter in Alamofire API call in Swift
- Failed to update from GitHub
- Why I keep getting message "The network connection was lost. 1005" but my connection works fine and the request in Postman works fine too?
- No such module Alamofire, XCode 15.2 and M1 chip
- Alamofire: responseJSON deprecated how to fix on my code
- How to fix Alamofire responseJSON deprecated warning!!!! and how to use responseDecodable here
- Alamofire 4->5 taskWillPerformHTTPRedirection Upgrade
- Alamofire uploadProgress never called
- Determine version number of Alamofire programatically?
- Why imgur adds white background to some png images, and to others not with Alamofire and Swift?
- CoinMarketCap API with Alamofire decoding data error
Related Questions in SWIFT5
- How to do a Tuple extension in current Swift? It seems to be available experimentally
- No such module 'SwiftData'
- Is it perfectly correct that this computed property will work like a "pointer" in current Swift?
- Combining drawing animation with live video using Swift and Pencilkit
- Is it absolutely the case that Swift >will not< deep copy a large array, when one "guard let" the array?
- Is there a way to drop the comma and space elements when using Date.FormatStyle?
- NavigationStackView .searchable modifier not visible when embedded in NavigationSplitView
- Get height of a view inside ZStack in SwiftUI
- How to add axis titles with DGCharts in Swift?
- swift | Nothing in multiple TableView with custom cell
- Xcode 15: After deploy build to TestFlight, fonts have another style
- xcode datatask not running
- How can I change the source location of an OSLog Message?
- QLPreviewControllerRepresentation does not conform to protocol UIViewControllerRepresentable
- NSBatchInsert does not work for CoreData Transformable Attribute e.g. Dictionary<String, String>
Related Questions in PUBLIC-KEY-PINNING
- URLError from rejecting a URLAuthenticationChallenge is too generic
- Extracting ssl certificate or expiry date from publickey in swift ios
- Public Pinning in Android
- SSL public key pinning is not working with HttpClientHandler for Xamarin.iOS, can still be eavesdropped. How do I secure the app against MITM attacks?
- Certificate pinning Android with Retrofit
- How to do SSL public key pinning in Alamofire swift 5
- HTTPS - verification of server SSL certificate by the browser
- iOS TLS/SSL Pinning using NSRequiresCertificateTransparency key in Info.plist
- Public Key Pinning Extension for HTTP
- How to implement SSL Pinning - Public Key Pinning (Not Certificate Pinning) with Moya in Swift?
- Is it necessary to store SPKI hash securely in android?
- OkHttp certificatePinner seems not working
- How to validate public hash key of google managed ssl certificate while doing http request to server in python?
- Public Pinning is iOS Not working with Almofire
- SSLPinning is not working on android <= 23 with OKHTTTP
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
To integrate SSL public key pinning you first have to add your SSL certificate in your project's target by dragging and dropping it.
To test if your certificate is in the correct format you can try to get the value from
publicKeysparameter of theAlamofireExtensionin your mainBundle, like this:If that array have at least one element, then you are ready. If it does not, then try importing your SSL certificate to your Mac's Keychain, then export it as
.cerand then add it to your project's target. (this should work)To check if the public key of the SSL certificate is the one that you import in your project you can use the Alamofire's
ServerTrustManagerwith aPublicKeysTrustEvaluatorinstance, when you create yourSession:Make sure that in the
evaluatorsdictionary, the key ("your.domain.com"in the code above) is your servers domain and if you don't want for Alamofire to perform the default validation and/or validate the host you can passfalseto those parameters inPublicKeysTrustEvaluator's initializer:Then you have to use this
Sessioninstance to make any request in your domain, like this:As @JonShier pointed out in the comments: You need to keep your
Sessionalive beyond the declaring scope. Usually this is done through a single or other outside reference.