Examples of CtxtHandle


Examples of com.sun.jna.platform.win32.Sspi.CtxtHandle

      // acquire a credentials handle
      assertEquals(W32Errors.SEC_E_OK, Secur32.INSTANCE.AcquireCredentialsHandle(
          null, "Negotiate", Sspi.SECPKG_CRED_OUTBOUND, null, null, null,
          null, phCredential, ptsExpiry));
      // initialize security context
      CtxtHandle phNewContext = new CtxtHandle();
      SecBufferDesc pbToken = new SecBufferDesc(Sspi.SECBUFFER_TOKEN, Sspi.MAX_TOKEN_SIZE);
      IntByReference pfContextAttr = new IntByReference();
      int rc = Secur32.INSTANCE.InitializeSecurityContext(phCredential, null,
          Advapi32Util.getUserName(), Sspi.ISC_REQ_CONNECTION, 0,
          Sspi.SECURITY_NATIVE_DREP, null, 0, phNewContext, pbToken,
View Full Code Here

Examples of com.sun.jna.platform.win32.Sspi.CtxtHandle

      TimeStamp ptsClientExpiry = new TimeStamp();
      assertEquals(W32Errors.SEC_E_OK, Secur32.INSTANCE.AcquireCredentialsHandle(
          null, "Negotiate", Sspi.SECPKG_CRED_OUTBOUND, null, null, null,
          null, phClientCredential, ptsClientExpiry));
      // client ----------- security context
      CtxtHandle phClientContext = new CtxtHandle();
      IntByReference pfClientContextAttr = new IntByReference();
    // server ----------- acquire inbound credential handle
      CredHandle phServerCredential = new CredHandle();
      TimeStamp ptsServerExpiry = new TimeStamp();
      assertEquals(W32Errors.SEC_E_OK, Secur32.INSTANCE.AcquireCredentialsHandle(
          null, "Negotiate", Sspi.SECPKG_CRED_INBOUND, null, null, null,
          null, phServerCredential, ptsServerExpiry));
      // server ----------- security context
    CtxtHandle phServerContext = new CtxtHandle();
      SecBufferDesc pbServerToken = null;
      IntByReference pfServerContextAttr = new IntByReference();
      int clientRc = W32Errors.SEC_I_CONTINUE_NEEDED;
      int serverRc = W32Errors.SEC_I_CONTINUE_NEEDED;
      do {
          // client ----------- initialize security context, produce a client token
        // client token returned is always new
          SecBufferDesc pbClientToken = new SecBufferDesc(Sspi.SECBUFFER_TOKEN, Sspi.MAX_TOKEN_SIZE);
          if (clientRc == W32Errors.SEC_I_CONTINUE_NEEDED) {
            // server token is empty the first time
            SecBufferDesc pbServerTokenCopy = pbServerToken == null
              ? null : new SecBufferDesc(Sspi.SECBUFFER_TOKEN, pbServerToken.getBytes());
            clientRc = Secur32.INSTANCE.InitializeSecurityContext(
              phClientCredential,
              phClientContext.isNull() ? null : phClientContext,
                Advapi32Util.getUserName(),
                Sspi.ISC_REQ_CONNECTION,
                0,
                Sspi.SECURITY_NATIVE_DREP,
                pbServerTokenCopy,
                0,
                phClientContext,
                pbClientToken,
                pfClientContextAttr,
                null);       
          assertTrue(clientRc == W32Errors.SEC_I_CONTINUE_NEEDED || clientRc == W32Errors.SEC_E_OK);
          }
          // server ----------- accept security context, produce a server token
        if (serverRc == W32Errors.SEC_I_CONTINUE_NEEDED) {
          pbServerToken = new SecBufferDesc(Sspi.SECBUFFER_TOKEN, Sspi.MAX_TOKEN_SIZE);
          SecBufferDesc pbClientTokenByValue = new SecBufferDesc(Sspi.SECBUFFER_TOKEN, pbClientToken.getBytes());
          serverRc = Secur32.INSTANCE.AcceptSecurityContext(phServerCredential,
              phServerContext.isNull() ? null : phServerContext,
              pbClientTokenByValue,
              Sspi.ISC_REQ_CONNECTION,
              Sspi.SECURITY_NATIVE_DREP,
              phServerContext,
              pbServerToken,
View Full Code Here

Examples of com.sun.jna.platform.win32.Sspi.CtxtHandle

      TimeStamp ptsClientExpiry = new TimeStamp();
      assertEquals(W32Errors.SEC_E_OK, Secur32.INSTANCE.AcquireCredentialsHandle(
          null, "Negotiate", Sspi.SECPKG_CRED_OUTBOUND, null, null, null,
          null, phClientCredential, ptsClientExpiry));
      // client ----------- security context
      CtxtHandle phClientContext = new CtxtHandle();
      IntByReference pfClientContextAttr = new IntByReference();
    // server ----------- acquire inbound credential handle
      CredHandle phServerCredential = new CredHandle();
      TimeStamp ptsServerExpiry = new TimeStamp();
      assertEquals(W32Errors.SEC_E_OK, Secur32.INSTANCE.AcquireCredentialsHandle(
          null, "Negotiate", Sspi.SECPKG_CRED_INBOUND, null, null, null,
          null, phServerCredential, ptsServerExpiry));
      // server ----------- security context
    CtxtHandle phServerContext = new CtxtHandle();
      SecBufferDesc pbServerToken = null;
      IntByReference pfServerContextAttr = new IntByReference();
      int clientRc = W32Errors.SEC_I_CONTINUE_NEEDED;
      int serverRc = W32Errors.SEC_I_CONTINUE_NEEDED;
      do {
          // client ----------- initialize security context, produce a client token
        // client token returned is always new
          SecBufferDesc pbClientToken = new SecBufferDesc(Sspi.SECBUFFER_TOKEN, Sspi.MAX_TOKEN_SIZE);
          if (clientRc == W32Errors.SEC_I_CONTINUE_NEEDED) {
            // server token is empty the first time
            SecBufferDesc pbServerTokenCopy = pbServerToken == null
              ? null : new SecBufferDesc(Sspi.SECBUFFER_TOKEN, pbServerToken.getBytes());
            clientRc = Secur32.INSTANCE.InitializeSecurityContext(
              phClientCredential,
              phClientContext.isNull() ? null : phClientContext,
                Advapi32Util.getUserName(),
                Sspi.ISC_REQ_CONNECTION,
                0,
                Sspi.SECURITY_NATIVE_DREP,
                pbServerTokenCopy,
                0,
                phClientContext,
                pbClientToken,
                pfClientContextAttr,
                null);       
          assertTrue(clientRc == W32Errors.SEC_I_CONTINUE_NEEDED || clientRc == W32Errors.SEC_E_OK);
          }
          // server ----------- accept security context, produce a server token
        if (serverRc == W32Errors.SEC_I_CONTINUE_NEEDED) {
          pbServerToken = new SecBufferDesc(Sspi.SECBUFFER_TOKEN, Sspi.MAX_TOKEN_SIZE);
          SecBufferDesc pbClientTokenByValue = new SecBufferDesc(Sspi.SECBUFFER_TOKEN, pbClientToken.getBytes());
          serverRc = Secur32.INSTANCE.AcceptSecurityContext(phServerCredential,
              phServerContext.isNull() ? null : phServerContext,
              pbClientTokenByValue,
              Sspi.ISC_REQ_CONNECTION,
              Sspi.SECURITY_NATIVE_DREP,
              phServerContext,
              pbServerToken,
View Full Code Here

Examples of com.sun.jna.platform.win32.Sspi.CtxtHandle

      TimeStamp ptsClientExpiry = new TimeStamp();
      assertEquals(W32Errors.SEC_E_OK, Secur32.INSTANCE.AcquireCredentialsHandle(
          null, "Negotiate", Sspi.SECPKG_CRED_OUTBOUND, null, null, null,
          null, phClientCredential, ptsClientExpiry));
      // client ----------- security context
      CtxtHandle phClientContext = new CtxtHandle();
      IntByReference pfClientContextAttr = new IntByReference();
    // server ----------- acquire inbound credential handle
      CredHandle phServerCredential = new CredHandle();
      TimeStamp ptsServerExpiry = new TimeStamp();
      assertEquals(W32Errors.SEC_E_OK, Secur32.INSTANCE.AcquireCredentialsHandle(
          null, "Negotiate", Sspi.SECPKG_CRED_INBOUND, null, null, null,
          null, phServerCredential, ptsServerExpiry));
      // server ----------- security context
    CtxtHandle phServerContext = new CtxtHandle();
      SecBufferDesc pbServerToken = new SecBufferDesc(Sspi.SECBUFFER_TOKEN, Sspi.MAX_TOKEN_SIZE);
      IntByReference pfServerContextAttr = new IntByReference();
      int clientRc = W32Errors.SEC_I_CONTINUE_NEEDED;
      int serverRc = W32Errors.SEC_I_CONTINUE_NEEDED;
      do {
        // client token returned is always new
          SecBufferDesc pbClientToken = new SecBufferDesc(Sspi.SECBUFFER_TOKEN, Sspi.MAX_TOKEN_SIZE);
          // client ----------- initialize security context, produce a client token
        if (clientRc == W32Errors.SEC_I_CONTINUE_NEEDED) {
            // server token is empty the first time
          clientRc = Secur32.INSTANCE.InitializeSecurityContext(
              phClientCredential,
              phClientContext.isNull() ? null : phClientContext,
                Advapi32Util.getUserName(),
                Sspi.ISC_REQ_CONNECTION,
                0,
                Sspi.SECURITY_NATIVE_DREP,
                pbServerToken,
                0,
                phClientContext,
                pbClientToken,
                pfClientContextAttr,
                null);       
          assertTrue(clientRc == W32Errors.SEC_I_CONTINUE_NEEDED || clientRc == W32Errors.SEC_E_OK);       
        }       
          // server ----------- accept security context, produce a server token
        if (serverRc == W32Errors.SEC_I_CONTINUE_NEEDED) {
          serverRc = Secur32.INSTANCE.AcceptSecurityContext(phServerCredential,
              phServerContext.isNull() ? null : phServerContext,
              pbClientToken,
              Sspi.ISC_REQ_CONNECTION,
              Sspi.SECURITY_NATIVE_DREP,
              phServerContext,
              pbServerToken,
View Full Code Here

Examples of com.sun.jna.platform.win32.Sspi.CtxtHandle

            final String targetName) {
        final IntByReference attr = new IntByReference();
        final SecBufferDesc token = new SecBufferDesc(
                Sspi.SECBUFFER_TOKEN, Sspi.MAX_TOKEN_SIZE);

        sspiContext = new CtxtHandle();
        final int rc = Secur32.INSTANCE.InitializeSecurityContext(clientCred,
                continueCtx, targetName, Sspi.ISC_REQ_CONNECTION | Sspi.ISC_REQ_DELEGATE, 0,
                Sspi.SECURITY_NATIVE_DREP, continueToken, 0, sspiContext, token,
                attr, null);
        switch (rc) {
View Full Code Here

Examples of com.sun.jna.platform.win32.Sspi.CtxtHandle

            final String targetName) {
        final IntByReference attr = new IntByReference();
        final SecBufferDesc token = new SecBufferDesc(
                Sspi.SECBUFFER_TOKEN, Sspi.MAX_TOKEN_SIZE);

        sppicontext = new CtxtHandle();
        final int rc = Secur32.INSTANCE.InitializeSecurityContext(clientCred,
                continueCtx, targetName, Sspi.ISC_REQ_CONNECTION, 0,
                Sspi.SECURITY_NATIVE_DREP, continueToken, 0, sppicontext, token,
                attr, null);
        switch (rc) {
View Full Code Here

Examples of com.sun.jna.platform.win32.Sspi.CtxtHandle

            final String targetName) {
        final IntByReference attr = new IntByReference();
        final SecBufferDesc token = new SecBufferDesc(
                Sspi.SECBUFFER_TOKEN, Sspi.MAX_TOKEN_SIZE);

        sppicontext = new CtxtHandle();
        final int rc = Secur32.INSTANCE.InitializeSecurityContext(clientCred,
                continueCtx, targetName, Sspi.ISC_REQ_CONNECTION, 0,
                Sspi.SECURITY_NATIVE_DREP, continueToken, 0, sppicontext, token,
                attr, null);
        switch (rc) {
View Full Code Here

Examples of com.sun.jna.platform.win32.Sspi.CtxtHandle

      // acquire a credentials handle
      assertEquals(W32Errors.SEC_E_OK, Secur32.INSTANCE.AcquireCredentialsHandle(
          null, "Negotiate", new NativeLong(Sspi.SECPKG_CRED_OUTBOUND), null, null, null,
          null, phCredential, ptsExpiry));
      // initialize security context
      CtxtHandle phNewContext = new CtxtHandle();
      SecBufferDesc pbToken = new SecBufferDesc(Sspi.SECBUFFER_TOKEN, Sspi.MAX_TOKEN_SIZE);
      NativeLongByReference pfContextAttr = new NativeLongByReference();
      int rc = Secur32.INSTANCE.InitializeSecurityContext(phCredential, null,
          Advapi32Util.getUserName(), new NativeLong(Sspi.ISC_REQ_CONNECTION), new NativeLong(0),
          new NativeLong(Sspi.SECURITY_NATIVE_DREP), null, new NativeLong(0), phNewContext, pbToken,
View Full Code Here

Examples of com.sun.jna.platform.win32.Sspi.CtxtHandle

      TimeStamp ptsClientExpiry = new TimeStamp();
      assertEquals(W32Errors.SEC_E_OK, Secur32.INSTANCE.AcquireCredentialsHandle(
          null, "Negotiate", new NativeLong(Sspi.SECPKG_CRED_OUTBOUND), null, null, null,
          null, phClientCredential, ptsClientExpiry));
      // client ----------- security context
      CtxtHandle phClientContext = new CtxtHandle();
      NativeLongByReference pfClientContextAttr = new NativeLongByReference();
    // server ----------- acquire inbound credential handle
      CredHandle phServerCredential = new CredHandle();
      TimeStamp ptsServerExpiry = new TimeStamp();
      assertEquals(W32Errors.SEC_E_OK, Secur32.INSTANCE.AcquireCredentialsHandle(
          null, "Negotiate", new NativeLong(Sspi.SECPKG_CRED_INBOUND), null, null, null,
          null, phServerCredential, ptsServerExpiry));
      // server ----------- security context
    CtxtHandle phServerContext = new CtxtHandle();
      SecBufferDesc pbServerToken = null;
      NativeLongByReference pfServerContextAttr = new NativeLongByReference();
      int clientRc = W32Errors.SEC_I_CONTINUE_NEEDED;
      int serverRc = W32Errors.SEC_I_CONTINUE_NEEDED;
      do {
          // client ----------- initialize security context, produce a client token
        // client token returned is always new
          SecBufferDesc pbClientToken = new SecBufferDesc(Sspi.SECBUFFER_TOKEN, Sspi.MAX_TOKEN_SIZE);
          if (clientRc == W32Errors.SEC_I_CONTINUE_NEEDED) {
            // server token is empty the first time
            SecBufferDesc pbServerTokenCopy = pbServerToken == null
              ? null : new SecBufferDesc(Sspi.SECBUFFER_TOKEN, pbServerToken.getBytes());
            clientRc = Secur32.INSTANCE.InitializeSecurityContext(
              phClientCredential,
              phClientContext.isNull() ? null : phClientContext,
                Advapi32Util.getUserName(),
                new NativeLong(Sspi.ISC_REQ_CONNECTION),
                new NativeLong(0),
                new NativeLong(Sspi.SECURITY_NATIVE_DREP),
                pbServerTokenCopy,
                new NativeLong(0),
                phClientContext,
                pbClientToken,
                pfClientContextAttr,
                null);       
          assertTrue(clientRc == W32Errors.SEC_I_CONTINUE_NEEDED || clientRc == W32Errors.SEC_E_OK);
          }
          // server ----------- accept security context, produce a server token
        if (serverRc == W32Errors.SEC_I_CONTINUE_NEEDED) {
          pbServerToken = new SecBufferDesc(Sspi.SECBUFFER_TOKEN, Sspi.MAX_TOKEN_SIZE);
          SecBufferDesc pbClientTokenByValue = new SecBufferDesc(Sspi.SECBUFFER_TOKEN, pbClientToken.getBytes());
          serverRc = Secur32.INSTANCE.AcceptSecurityContext(phServerCredential,
              phServerContext.isNull() ? null : phServerContext,
              pbClientTokenByValue,
              new NativeLong(Sspi.ISC_REQ_CONNECTION),
              new NativeLong(Sspi.SECURITY_NATIVE_DREP),
              phServerContext,
              pbServerToken,
View Full Code Here

Examples of com.sun.jna.platform.win32.Sspi.CtxtHandle

      TimeStamp ptsClientExpiry = new TimeStamp();
      assertEquals(W32Errors.SEC_E_OK, Secur32.INSTANCE.AcquireCredentialsHandle(
          null, "Negotiate", new NativeLong(Sspi.SECPKG_CRED_OUTBOUND), null, null, null,
          null, phClientCredential, ptsClientExpiry));
      // client ----------- security context
      CtxtHandle phClientContext = new CtxtHandle();
      NativeLongByReference pfClientContextAttr = new NativeLongByReference();
    // server ----------- acquire inbound credential handle
      CredHandle phServerCredential = new CredHandle();
      TimeStamp ptsServerExpiry = new TimeStamp();
      assertEquals(W32Errors.SEC_E_OK, Secur32.INSTANCE.AcquireCredentialsHandle(
          null, "Negotiate", new NativeLong(Sspi.SECPKG_CRED_INBOUND), null, null, null,
          null, phServerCredential, ptsServerExpiry));
      // server ----------- security context
    CtxtHandle phServerContext = new CtxtHandle();
      SecBufferDesc pbServerToken = null;
      NativeLongByReference pfServerContextAttr = new NativeLongByReference();
      int clientRc = W32Errors.SEC_I_CONTINUE_NEEDED;
      int serverRc = W32Errors.SEC_I_CONTINUE_NEEDED;
      do {
          // client ----------- initialize security context, produce a client token
        // client token returned is always new
          SecBufferDesc pbClientToken = new SecBufferDesc(Sspi.SECBUFFER_TOKEN, Sspi.MAX_TOKEN_SIZE);
          if (clientRc == W32Errors.SEC_I_CONTINUE_NEEDED) {
            // server token is empty the first time
            SecBufferDesc pbServerTokenCopy = pbServerToken == null
              ? null : new SecBufferDesc(Sspi.SECBUFFER_TOKEN, pbServerToken.getBytes());
            clientRc = Secur32.INSTANCE.InitializeSecurityContext(
              phClientCredential,
              phClientContext.isNull() ? null : phClientContext,
                Advapi32Util.getUserName(),
                new NativeLong(Sspi.ISC_REQ_CONNECTION),
                new NativeLong(0),
                new NativeLong(Sspi.SECURITY_NATIVE_DREP),
                pbServerTokenCopy,
                new NativeLong(0),
                phClientContext,
                pbClientToken,
                pfClientContextAttr,
                null);       
          assertTrue(clientRc == W32Errors.SEC_I_CONTINUE_NEEDED || clientRc == W32Errors.SEC_E_OK);
          }
          // server ----------- accept security context, produce a server token
        if (serverRc == W32Errors.SEC_I_CONTINUE_NEEDED) {
          pbServerToken = new SecBufferDesc(Sspi.SECBUFFER_TOKEN, Sspi.MAX_TOKEN_SIZE);
          SecBufferDesc pbClientTokenByValue = new SecBufferDesc(Sspi.SECBUFFER_TOKEN, pbClientToken.getBytes());
          serverRc = Secur32.INSTANCE.AcceptSecurityContext(phServerCredential,
              phServerContext.isNull() ? null : phServerContext,
              pbClientTokenByValue,
              new NativeLong(Sspi.ISC_REQ_CONNECTION),
              new NativeLong(Sspi.SECURITY_NATIVE_DREP),
              phServerContext,
              pbServerToken,
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.