Java
Java
Workaround for the deprecated Crypt2.VerifyBytesENC method
Shows how to replace the deprecated VerifyBytesENC method. (Chilkat is moving away from the use of CkByteData.)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[])
{
CkCrypt2 crypt = new CkCrypt2();
// Encoding mode property must match the encoding of the detached signature.
crypt.put_EncodingMode("base64");
String originalDataPath = "c:/someDir/example.dat";
String base64_detached_signature = "....";
// ------------------------------------------------------------------------
// The VerifyBytesENC method is deprecated:
CkByteData originalDataBytes = new CkByteData();
originalDataBytes.loadFile(originalDataPath);
boolean verified = crypt.VerifyBytesENC(originalDataBytes,base64_detached_signature);
// ------------------------------------------------------------------------
// Workaround.
// (Chilkat is moving away from using CkByteData)
CkBinData bdOrigData = new CkBinData();
bdOrigData.LoadFile(originalDataPath);
verified = crypt.VerifyBdENC(bdOrigData,base64_detached_signature);
}
}