This sample code illustrates importing the certificate and setting up login credentials, as well as other APIs related to certificate handling:
/// End2EndDB is a generated RBS class
///First install certificates on your simulator, for example "Sybase101.p12"
//Test getting certificate from certificat store
CertificateStore myStore = CertificateStore.getDefault();
String filter1 = "Sybase";
StringList labels = myStore.certificateLabels(filter1, null);
String aLabel = labels.item(0);
LoginCertificate lc = myStore.getSignedCertificate(aLabel, "password");
// Save the login certificate to your synchronization profile
End2EndDB.getSynchronizationProfile().setCertificate(lc);
// Login to and synchronize with Unwired Server
End2EndDB.loginToSync();
End2EndDB.synchronize();
// Save the login certificate to your data vault
// The vault must be unlocked before saving
String vaultName = "myVault";
DataVault vault = null;
if(!DataVault.vaultExists(vaultName))
{
vault = DataVault.createVault(vaultName, "password", "salt");
}
else
{
vault = DataVault.getVault(vaultName);
}
vault.unlock("password", "salt");
lc.save("myLabel", vault);
//test loading and deleting certificate
LoginCertificate newLc = LoginCertificate.load("myLabel", vault);
LoginCertificate.delete("myLabel", vault);