Java
Chilkat2 Java
Example: Crypt2.SetSigningCert method
Demonstrates how to call the SetSigningCert method.Chilkat Java Downloads
import com.chilkatsoft.chilkat2.Cert;
import com.chilkatsoft.chilkat2.Crypt2;
public class ChilkatExample {
public static void main(String[] args) {
// Signing certificates can be obtained from many different sources..
// Load from a PFX
Crypt2 cryptA = new Crypt2();
Cert certA = new Cert();
certA.loadPfxFile("c:/someDir/pfx_files/a.pfx", "pfx_file_password");
cryptA.setSigningCert(certA);
// ...
// Load from a smart card or USB token.
Crypt2 cryptB = new Crypt2();
Cert certB = new Cert();
certB.setSmartCardPin("123456");
certB.loadFromSmartcard("");
cryptB.setSigningCert(certB);
// ...
// Load from a the Windows certificate store or macOS keychain
Crypt2 cryptC = new Crypt2();
Cert certC = new Cert();
certC.loadByCommonName("Xyz 123");
cryptC.setSigningCert(certC);
// ...
}
}