Java
Java
Transition from Cert.ExportPublicKey to Cert.GetPublicKey
Provides instructions for replacing deprecated ExportPublicKey method calls with GetPublicKey.Chilkat Java Downloads
import com.chilkatsoft.*;
public class ChilkatExample {
static {
try {
System.loadLibrary("chilkat");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load.\n" + e);
System.exit(1);
}
}
public static void main(String argv[])
{
boolean success = false;
CkCert cert = new CkCert();
// ------------------------------------------------------------------------
// The ExportPublicKey method is deprecated:
CkPublicKey publickeyObj = cert.ExportPublicKey();
if (cert.get_LastMethodSuccess() == false) {
System.out.println(cert.lastErrorText());
return;
}
// ...
// ...
// ------------------------------------------------------------------------
// Do the equivalent using GetPublicKey.
// Your application creates a new, empty PublicKey object which is passed
// in the last argument and filled upon success.
CkPublicKey publickeyOut = new CkPublicKey();
success = cert.GetPublicKey(publickeyOut);
if (success == false) {
System.out.println(cert.lastErrorText());
return;
}
}
}