Illustrates importing the certificate and setting up login credentials, as well as other APIs related to certificate handling:
// SUP101DB is a generated database class
// First install certificates on your emulator, for example "Sybase101.p12"
//Getting certificate from certificate 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
SUP101DB.GetSynchronizationProfile().Certificate = lc;
//Perform synchronization
SUP101DB.Synchronize();
// Save the login certificate to your data vault
DataVault vault = null;
if (!DataVault.VaultExists("myVault"))
{
vault = DataVault.CreateVault("myVault", "password", "salt");
}
else
{
vault = DataVault.GetVault("myVault");
}
vault.Unlock("password", "salt");
lc.Save("myLabel", vault);
// Get certificate that was previously loaded from the data vault
LoginCertificate newLc = LoginCertificate.Load("myLabel", vault);
// Delete the certificate from the data vault
LoginCertificate.Delete("myLabel", vault);