...
The following sample configuration shows how to set the public key pin for two domains. The Gini Bank SDK’s default networking implementation uses by default pay-api.gini.net
and user.gini.net
. It should be saved under res/xml/network_security_config.xml
:
Code Block | ||
---|---|---|
| ||
<?xml version="1.0" encoding="utf-8"?> <network-security-config> <domain-config> <trustkit-config disableDefaultReportUri="true" enforcePinning="true" /> <domain includeSubdomains="false">pay-api.gini.net</domain> <pin-set> <!-- old *.gini.net public key--> <pin digest="SHA-256">cNzbGowA+LNeQ681yMm8ulHxXiGojHE8qAjI+M7bIxU=</pin> <!-- new *.gini.net public key, active from around June 2020 --> <pin digest="SHA-256">zEVdOCzXU8euGVuMJYPr3DUU/d1CaKevtr0dW0XzZNo=</pin> </pin-set> <domain-config> <trustkit-config disableDefaultReportUri="true" enforcePinning="true" /> <domain includeSubdomains="false">user.gini.net</domain> </domain-config> </domain-config> </network-security-config> |
Info |
---|
If you set different base urls when instantiating with the |
...
In your AndroidManifest.xml
you need to set the android:networkSecurityConfig
attribute on the <application>
tag to point to the XML:
Code Block | ||
---|---|---|
| ||
<?xml version="1.0" encoding="utf-8"?> <manifest ...> ... <application android:networkSecurityConfig="@xml/network_security_config"> ... </manifest> |
...
For the library to know about the XML, you need to set the XML resource id using the GiniBankAPIBuilder#setNetworkSecurityConfigResIdGiniCaptureDefaultNetworkService.Builder.setNetworkSecurityConfigResId()
method:
Code Block | ||
---|---|---|
| ||
val giniBankApiGiniCaptureNetworkService: GiniBankAPI = GiniBankAPIBuilderGiniCaptureDefaultNetworkService.builder(context,) .setClientCredentials("gini-client-id", "GiniClientSecret", "example.com") .setNetworkSecurityConfigResId(R.xml.network_security_config) .build(); |
...
Code Block | ||
---|---|---|
| ||
val giniBankApi: GiniBankAPIdefaultNetworkService = GiniBankAPIBuilderGiniCaptureDefaultNetworkService.builder(context, ) .setClientCredentials("gini-client-id", "GiniClientSecret", "example.com") .setTrustManager(yourTrustManager) .build(); |
...