我有一个vba代码,其中包含一个使用DLL加密的代码
Public Declare PtrSafe Sub Encrypt Lib "aapSupport.dll" (ByVal As String, ByVal senhacript As String, ByRef TamSenhaCript As Integer)
Dim passcript As String
Dim buf_senha As String * 100
Dim as_password As Integer
Call Encrypt (login_password, buf_password, tam_password)
passcript = Left (buf_password, tam_password)
我用Java编写了代码。
public class Main {
public interface aapSupport extends Library {
aapSupport INSTANCE = (aapSupport) Native.loadLibrary (
(Platform.isWindows ()? "AapSupport": "simpleDLLLinuxPort"), aapSupport.class);
static char [] Encrypt (String password, char [] buf_password, int tamSenhaCrip) {
return buf_password;
}
}
public static void main (String [] args) {
// TODO Auto-generated method stub
System.out.println ("Loading Instance DLL");
aapSupport dsa = aapSupport.INSTANCE;
System.out.println ("Encrypting");
char [] chars = new char [100];
// String buf_senha = new String (chars);
char [] passwordEncrip = aapSupport.Encrypt ("Wng1607", chars, 0);
System.out.println ("Password:");
System.out.println (passwordEncrip);
}
}
但结果: