Webservices integration, using certificates to increase security (SSL).
|
What are SSL Certificates and how to use them? How to use SSL certificates to communicate to external secure webservices?
|
Types of certificates:
|
There are two types of certificates. In a two-way SSL connection, both certificates must exist:
|
Server Certificate:
|
|
Client Certificate:
|
|
Importing and using the client certificates
|
Client Certificate created in customer's web server (Legacy):
|
This sample was taken from Apex Code Developer's Guide (Invoking Callouts Using Apex > Using Certificates > Using Certificates with SOAP Services): |
docSample.DocSamplePort stub = new docSample.DocSamplePort(); stub.clientCert_x = 'MIIGlgIBAzCCBlAGCSqGSIb3DQEHAaCCBkEEggY9MIIGOTCCAe4GCSqGSIb3DQEHAaCCAd8EggHb' + 'MIIB1zCCAdMGCyqGSIb3DQEMCgECoIIBgjCCAX4wKAYKKoZIhvcNAQwBAzAaBBSaUMlXnxjzpfdu' + '6YFwZgJFMklDWFyvCnQeuZpN2E+Rb4rf9MkJ6FsmPDA9MCEwCQYFKw4DAhoFAAQU4ZKBfaXcN45w' + '9hYm215CcA4n4d0EFJL8jr68wwKwFsVckbjyBz/zYHO6AgIEAA==' ; stub.clientCertPasswd_x = 'passwd' ; // <<< Password for the keystore String output = stub.InvokeWebservice(); |
|
Client Certificate created in your Salesforce ORG (preferred way):
|
|
docSample.DocSamplePort stub = new docSample.DocSamplePort(); stub.clientCertName_x = 'Certificate Name' ; // <<< Salesforce’s certificate name String output = stub.InvokeWebservice(); |
Who can sign Server Certificates?
|
When performing callouts from Salesforce over HTTPS, it is required that the remote server have an SSL certificate signed by a root certification authority (CA) trusted by the default keystore in Sun's JDK 6 and approved by Salesforce. A complete list is found here: http://wiki.developerforce.com/index.php/Outbound_Messaging_SSL_CA_Certificates.
For security purposes, Salesforce will not add any additional certificates to the trusted list. If the server certificate is not signed directly by a root CA, the server must also return any intermediate certificates to complete the trust chain to the root CA. The server or certificate vendor can assist with instructions to install local and intermediate certificates. |
What certificate to use?
|
Basically, Both ;-)
|
How it works?
|
When SFDC makes a call to a secured server, it first tries to see if the server has a Server Certificate. If it does, then it sends the Client Certificate (and possibly a password, see samples above). If this Client Certificate is accepted by the web server, then the communication is valid and the data is sent ack and forth between SFDC and the web server.
|
Other information
|
|
openssl s_client -showcerts -connect <host>:<port> |
0 comments:
Post a Comment