I'm working on Certificate Private key. I have a sample source code in Java. Can anyone help convert to VB.Net?
Java:
public static String signSignatureMessage(String input, String filePath, String password, String alias) throws Exception {
log.info("+signSignatureMessage(): Input[" +input+"], FilePath["+filePath+"]");
String signMessage =null;
char[] keypassword = password.toCharArray();
KeyStorekeyStore = KeyStore.getInstance("PKCS12");
keyStore.load(new FileInputStream(filePath), keypassword);
PrivateKey privKey = (PrivateKey)keyStore.getKey(alias, keypassword);
Signature rsa = Signature.getInstance("SHA512withRSA" );
rsa.initSign(privKey,new SecureRandom());
rsa.update(input.getBytes(SecurityWSConstants.ENCODING_UTF8));
signMessage =new String(Base64.encode(rsa.sign()));
// Remove eol
signMessage = signMessage.replaceAll("","");
log.info("-signSignatureMessage(): Result[" +signMessage+"]");
return signMessage;
}
Last edited by a moderator: