Java 类com.sun.jna.platform.win32.Sspi.CredHandle 实例源码

项目:jntlm    文件:NTLMSchemeProvider.java   
@Override
public String generateType1Msg(String domain, String workstation) throws NTLMEngineException {
    CredHandle credentials = acquireCredentialsHandle();
    try {
        byte[] token = nextToken(credentials, null);
        return Base64.encodeBase64String(token);
    } finally {
        dispose(credentials);
    }
}
项目:jntlm    文件:NTLMSchemeProvider.java   
private CredHandle acquireCredentialsHandle() {
    CredHandle handle = new CredHandle();
    int rc = Secur32.INSTANCE.AcquireCredentialsHandle(null, "NTLM", SECPKG_CRED_OUTBOUND, null, null, null, null, handle, new TimeStamp());
    if (SEC_E_OK != rc) {
        throw new Win32Exception(rc);
    }
    return handle;
}
项目:jntlm    文件:NTLMSchemeProvider.java   
public void dispose(CredHandle credentials) {
    int rc = Secur32.INSTANCE.FreeCredentialsHandle(credentials);
    if (SEC_E_OK != rc) {
        throw new Win32Exception(rc);
    }
}