Class: CertificateFromFile

sap.AuthProxy# CertificateFromFile

new CertificateFromFile(Path, Password, CertificateKey)

Create certificate source description object for a certificate from a keystore file. The keystore file must be of type PKCS12 (usually a .p12 extention) since that is the only certificate file type that can contain a private key (a private key is needed to authenticate the client to the server). You might want to use this method if you know the desired certificate resides in a file on the filesystem.
Parameters:
Name Type Description
Path string The Path of the keystore file.
For iOS clients, it first tries to load the relative file path from the application's Documents folder. If it fails, it then tries to load the file path from application's main bundle. In addition, before trying to load the certificate from the file system, the iOS client first checks whether the specified certificate key already exists in the key store. If it does, it loads the existing certificate from key store, instead of loading the certificate from file system.
For Android clients, the filepath is first treated as an absolute path. If the certificate is not found, then the filepath is treated as relative to the root of the sdcard.
Password string The password of the keystore.
CertificateKey string A unique key (aka: alias) that is used to locate the certificate.
Example
// Create the certificate source description object.
var fileCert = new sap.AuthProxy.CertificateFromFile("directory/certificateName.p12", "certificatePassword", "certificateKey");
// callbacks
var successCB = function(serverResponse){
    alert("Status: " + JSON.stringify(serverResponse.status));
    alert("Headers: " + JSON.stringify(serverResponse.headers));
    alert("Response: " + JSON.stringify(serverResponse.response));
}
var errorCB = function(errorObject){
    alert("Error making request: " + JSON.stringify(errorObject));
}
// Make the request with the certificate source description object.
sap.AuthProxy.sendRequest("POST", "https://hostname", headers, "THIS IS THE BODY", successCB, errorCB, null, null, 0, fileCert);