Android Application Security Testing Part-20: Certificate pinning
Certificate
pinning
·
Certificate pinning is the process of
associating a host with its expected public key. Because you own both the
server-side code and the client-side code, you can configure your client code
to accept only a specific certificate for your domain name, instead of any
certificate that corresponds to a trusted CA root
certificate recognized by the operating system or browser.
·
Android Specific Best Practices to
Prevent Insecure Communication
o
Remove all code after the development
cycle that may allow the application to accept all certificates such as
org.apache.http.conn.ssl.AllowAllHostnameVerifier or
SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER. These are equivalent to trusting
all certificates.
o
If using a class which extends
SSLSocketFactory, make sure checkServerTrusted method is properly implemented
so that server certificate is correctly checked
No comments