sun.security.jgss.spnego.NegTokenTarg Java Examples
The following examples show how to use
sun.security.jgss.spnego.NegTokenTarg.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: NotPreferredMech.java From hottub with GNU General Public License v2.0 | 4 votes |
public static void main(String[] argv) throws Exception { // Generates a NegTokenInit mechTypes field, with an // unsupported mech as the preferred. DerOutputStream mech = new DerOutputStream(); mech.write(new Oid("1.2.3.4").getDER()); mech.write(GSSUtil.GSS_KRB5_MECH_OID.getDER()); DerOutputStream mechTypeList = new DerOutputStream(); mechTypeList.write(DerValue.tag_Sequence, mech); // Generates a NegTokenInit mechToken field for 1.2.3.4 mech GSSHeader h1 = new GSSHeader(new ObjectIdentifier("1.2.3.4"), 1); ByteArrayOutputStream bout = new ByteArrayOutputStream(); h1.encode(bout); bout.write(new byte[1]); // Generates the NegTokenInit token Constructor<NegTokenInit> ctor = NegTokenInit.class.getDeclaredConstructor( byte[].class, BitArray.class, byte[].class, byte[].class); ctor.setAccessible(true); NegTokenInit initToken = ctor.newInstance( mechTypeList.toByteArray(), new BitArray(0), bout.toByteArray(), null); Method m = Class.forName("sun.security.jgss.spnego.SpNegoToken") .getDeclaredMethod("getEncoded"); m.setAccessible(true); byte[] spnegoToken = (byte[])m.invoke(initToken); // and wraps it into a GSSToken GSSHeader h = new GSSHeader( new ObjectIdentifier(GSSUtil.GSS_SPNEGO_MECH_OID.toString()), spnegoToken.length); bout = new ByteArrayOutputStream(); h.encode(bout); bout.write(spnegoToken); byte[] token = bout.toByteArray(); // and feeds it to a GSS acceptor GSSManager man = GSSManager.getInstance(); GSSContext ctxt = man.createContext((GSSCredential) null); token = ctxt.acceptSecContext(token, 0, token.length); NegTokenTarg targ = new NegTokenTarg(token); // Make sure it's a GO-ON message Method m2 = NegTokenTarg.class.getDeclaredMethod("getNegotiatedResult"); m2.setAccessible(true); int negResult = (int)m2.invoke(targ); if (negResult != 1 /* ACCEPT_INCOMPLETE */) { throw new Exception("Not a continue"); } }
Example #2
Source File: NegTokenTargFields.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) throws Exception { byte[] buf = (byte[])NegTokenTargFields.class.getField(args[0]).get(null); new NegTokenTarg(buf); }
Example #3
Source File: NotPreferredMech.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
public static void main(String[] argv) throws Exception { // Generates a NegTokenInit mechTypes field, with an // unsupported mech as the preferred. DerOutputStream mech = new DerOutputStream(); mech.write(new Oid("1.2.3.4").getDER()); mech.write(GSSUtil.GSS_KRB5_MECH_OID.getDER()); DerOutputStream mechTypeList = new DerOutputStream(); mechTypeList.write(DerValue.tag_Sequence, mech); // Generates a NegTokenInit mechToken field for 1.2.3.4 mech GSSHeader h1 = new GSSHeader(new ObjectIdentifier("1.2.3.4"), 1); ByteArrayOutputStream bout = new ByteArrayOutputStream(); h1.encode(bout); bout.write(new byte[1]); // Generates the NegTokenInit token Constructor<NegTokenInit> ctor = NegTokenInit.class.getDeclaredConstructor( byte[].class, BitArray.class, byte[].class, byte[].class); ctor.setAccessible(true); NegTokenInit initToken = ctor.newInstance( mechTypeList.toByteArray(), new BitArray(0), bout.toByteArray(), null); Method m = Class.forName("sun.security.jgss.spnego.SpNegoToken") .getDeclaredMethod("getEncoded"); m.setAccessible(true); byte[] spnegoToken = (byte[])m.invoke(initToken); // and wraps it into a GSSToken GSSHeader h = new GSSHeader( new ObjectIdentifier(GSSUtil.GSS_SPNEGO_MECH_OID.toString()), spnegoToken.length); bout = new ByteArrayOutputStream(); h.encode(bout); bout.write(spnegoToken); byte[] token = bout.toByteArray(); // and feeds it to a GSS acceptor GSSManager man = GSSManager.getInstance(); GSSContext ctxt = man.createContext((GSSCredential) null); token = ctxt.acceptSecContext(token, 0, token.length); NegTokenTarg targ = new NegTokenTarg(token); // Make sure it's a GO-ON message Method m2 = NegTokenTarg.class.getDeclaredMethod("getNegotiatedResult"); m2.setAccessible(true); int negResult = (int)m2.invoke(targ); if (negResult != 1 /* ACCEPT_INCOMPLETE */) { throw new Exception("Not a continue"); } }
Example #4
Source File: NegTokenTargFields.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) throws Exception { byte[] buf = (byte[])NegTokenTargFields.class.getField(args[0]).get(null); new NegTokenTarg(buf); }
Example #5
Source File: NotPreferredMech.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
public static void main(String[] argv) throws Exception { // Generates a NegTokenInit mechTypes field, with an // unsupported mech as the preferred. DerOutputStream mech = new DerOutputStream(); mech.write(new Oid("1.2.3.4").getDER()); mech.write(GSSUtil.GSS_KRB5_MECH_OID.getDER()); DerOutputStream mechTypeList = new DerOutputStream(); mechTypeList.write(DerValue.tag_Sequence, mech); // Generates a NegTokenInit mechToken field for 1.2.3.4 mech GSSHeader h1 = new GSSHeader(new ObjectIdentifier("1.2.3.4"), 1); ByteArrayOutputStream bout = new ByteArrayOutputStream(); h1.encode(bout); bout.write(new byte[1]); // Generates the NegTokenInit token Constructor<NegTokenInit> ctor = NegTokenInit.class.getDeclaredConstructor( byte[].class, BitArray.class, byte[].class, byte[].class); ctor.setAccessible(true); NegTokenInit initToken = ctor.newInstance( mechTypeList.toByteArray(), new BitArray(0), bout.toByteArray(), null); Method m = Class.forName("sun.security.jgss.spnego.SpNegoToken") .getDeclaredMethod("getEncoded"); m.setAccessible(true); byte[] spnegoToken = (byte[])m.invoke(initToken); // and wraps it into a GSSToken GSSHeader h = new GSSHeader( new ObjectIdentifier(GSSUtil.GSS_SPNEGO_MECH_OID.toString()), spnegoToken.length); bout = new ByteArrayOutputStream(); h.encode(bout); bout.write(spnegoToken); byte[] token = bout.toByteArray(); // and feeds it to a GSS acceptor GSSManager man = GSSManager.getInstance(); GSSContext ctxt = man.createContext((GSSCredential) null); token = ctxt.acceptSecContext(token, 0, token.length); NegTokenTarg targ = new NegTokenTarg(token); // Make sure it's a GO-ON message Method m2 = NegTokenTarg.class.getDeclaredMethod("getNegotiatedResult"); m2.setAccessible(true); int negResult = (int)m2.invoke(targ); if (negResult != 1 /* ACCEPT_INCOMPLETE */) { throw new Exception("Not a continue"); } }
Example #6
Source File: NegTokenTargFields.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) throws Exception { byte[] buf = (byte[])NegTokenTargFields.class.getField(args[0]).get(null); new NegTokenTarg(buf); }
Example #7
Source File: NotPreferredMech.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
public static void main(String[] argv) throws Exception { // Generates a NegTokenInit mechTypes field, with an // unsupported mech as the preferred. DerOutputStream mech = new DerOutputStream(); mech.write(new Oid("1.2.3.4").getDER()); mech.write(GSSUtil.GSS_KRB5_MECH_OID.getDER()); DerOutputStream mechTypeList = new DerOutputStream(); mechTypeList.write(DerValue.tag_Sequence, mech); // Generates a NegTokenInit mechToken field for 1.2.3.4 mech GSSHeader h1 = new GSSHeader(new ObjectIdentifier("1.2.3.4"), 1); ByteArrayOutputStream bout = new ByteArrayOutputStream(); h1.encode(bout); bout.write(new byte[1]); // Generates the NegTokenInit token Constructor<NegTokenInit> ctor = NegTokenInit.class.getDeclaredConstructor( byte[].class, BitArray.class, byte[].class, byte[].class); ctor.setAccessible(true); NegTokenInit initToken = ctor.newInstance( mechTypeList.toByteArray(), new BitArray(0), bout.toByteArray(), null); Method m = Class.forName("sun.security.jgss.spnego.SpNegoToken") .getDeclaredMethod("getEncoded"); m.setAccessible(true); byte[] spnegoToken = (byte[])m.invoke(initToken); // and wraps it into a GSSToken GSSHeader h = new GSSHeader( new ObjectIdentifier(GSSUtil.GSS_SPNEGO_MECH_OID.toString()), spnegoToken.length); bout = new ByteArrayOutputStream(); h.encode(bout); bout.write(spnegoToken); byte[] token = bout.toByteArray(); // and feeds it to a GSS acceptor GSSManager man = GSSManager.getInstance(); GSSContext ctxt = man.createContext((GSSCredential) null); token = ctxt.acceptSecContext(token, 0, token.length); NegTokenTarg targ = new NegTokenTarg(token); // Make sure it's a GO-ON message Method m2 = NegTokenTarg.class.getDeclaredMethod("getNegotiatedResult"); m2.setAccessible(true); int negResult = (int)m2.invoke(targ); if (negResult != 1 /* ACCEPT_INCOMPLETE */) { throw new Exception("Not a continue"); } }
Example #8
Source File: NegTokenTargFields.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) throws Exception { byte[] buf = (byte[])NegTokenTargFields.class.getField(args[0]).get(null); new NegTokenTarg(buf); }
Example #9
Source File: NegTokenTargFields.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) throws Exception { byte[] buf = (byte[])NegTokenTargFields.class.getField(args[0]).get(null); new NegTokenTarg(buf); }
Example #10
Source File: NegTokenTargFields.java From hottub with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) throws Exception { byte[] buf = (byte[])NegTokenTargFields.class.getField(args[0]).get(null); new NegTokenTarg(buf); }
Example #11
Source File: NegTokenTargFields.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) throws Exception { byte[] buf = (byte[])NegTokenTargFields.class.getField(args[0]).get(null); new NegTokenTarg(buf); }
Example #12
Source File: NegTokenTargFields.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) throws Exception { byte[] buf = (byte[])NegTokenTargFields.class.getField(args[0]).get(null); new NegTokenTarg(buf); }
Example #13
Source File: NotPreferredMech.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
public static void main(String[] argv) throws Exception { // Generates a NegTokenInit mechTypes field, with an // unsupported mech as the preferred. DerOutputStream mech = new DerOutputStream(); mech.write(new Oid("1.2.3.4").getDER()); mech.write(GSSUtil.GSS_KRB5_MECH_OID.getDER()); DerOutputStream mechTypeList = new DerOutputStream(); mechTypeList.write(DerValue.tag_Sequence, mech); // Generates a NegTokenInit mechToken field for 1.2.3.4 mech GSSHeader h1 = new GSSHeader(new ObjectIdentifier("1.2.3.4"), 1); ByteArrayOutputStream bout = new ByteArrayOutputStream(); h1.encode(bout); bout.write(new byte[1]); // Generates the NegTokenInit token Constructor<NegTokenInit> ctor = NegTokenInit.class.getDeclaredConstructor( byte[].class, BitArray.class, byte[].class, byte[].class); ctor.setAccessible(true); NegTokenInit initToken = ctor.newInstance( mechTypeList.toByteArray(), new BitArray(0), bout.toByteArray(), null); Method m = Class.forName("sun.security.jgss.spnego.SpNegoToken") .getDeclaredMethod("getEncoded"); m.setAccessible(true); byte[] spnegoToken = (byte[])m.invoke(initToken); // and wraps it into a GSSToken GSSHeader h = new GSSHeader( new ObjectIdentifier(GSSUtil.GSS_SPNEGO_MECH_OID.toString()), spnegoToken.length); bout = new ByteArrayOutputStream(); h.encode(bout); bout.write(spnegoToken); byte[] token = bout.toByteArray(); // and feeds it to a GSS acceptor GSSManager man = GSSManager.getInstance(); GSSContext ctxt = man.createContext((GSSCredential) null); token = ctxt.acceptSecContext(token, 0, token.length); NegTokenTarg targ = new NegTokenTarg(token); // Make sure it's a GO-ON message Method m2 = NegTokenTarg.class.getDeclaredMethod("getNegotiatedResult"); m2.setAccessible(true); int negResult = (int)m2.invoke(targ); if (negResult != 1 /* ACCEPT_INCOMPLETE */) { throw new Exception("Not a continue"); } }
Example #14
Source File: NegTokenTargFields.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) throws Exception { byte[] buf = (byte[])NegTokenTargFields.class.getField(args[0]).get(null); new NegTokenTarg(buf); }
Example #15
Source File: NotPreferredMech.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
public static void main(String[] argv) throws Exception { // Generates a NegTokenInit mechTypes field, with an // unsupported mech as the preferred. DerOutputStream mech = new DerOutputStream(); mech.write(new Oid("1.2.3.4").getDER()); mech.write(GSSUtil.GSS_KRB5_MECH_OID.getDER()); DerOutputStream mechTypeList = new DerOutputStream(); mechTypeList.write(DerValue.tag_Sequence, mech); // Generates a NegTokenInit mechToken field for 1.2.3.4 mech GSSHeader h1 = new GSSHeader(new ObjectIdentifier("1.2.3.4"), 1); ByteArrayOutputStream bout = new ByteArrayOutputStream(); h1.encode(bout); bout.write(new byte[1]); // Generates the NegTokenInit token Constructor<NegTokenInit> ctor = NegTokenInit.class.getDeclaredConstructor( byte[].class, BitArray.class, byte[].class, byte[].class); ctor.setAccessible(true); NegTokenInit initToken = ctor.newInstance( mechTypeList.toByteArray(), new BitArray(0), bout.toByteArray(), null); Method m = Class.forName("sun.security.jgss.spnego.SpNegoToken") .getDeclaredMethod("getEncoded"); m.setAccessible(true); byte[] spnegoToken = (byte[])m.invoke(initToken); // and wraps it into a GSSToken GSSHeader h = new GSSHeader( new ObjectIdentifier(GSSUtil.GSS_SPNEGO_MECH_OID.toString()), spnegoToken.length); bout = new ByteArrayOutputStream(); h.encode(bout); bout.write(spnegoToken); byte[] token = bout.toByteArray(); // and feeds it to a GSS acceptor GSSManager man = GSSManager.getInstance(); GSSContext ctxt = man.createContext((GSSCredential) null); token = ctxt.acceptSecContext(token, 0, token.length); NegTokenTarg targ = new NegTokenTarg(token); // Make sure it's a GO-ON message Method m2 = NegTokenTarg.class.getDeclaredMethod("getNegotiatedResult"); m2.setAccessible(true); int negResult = (int)m2.invoke(targ); if (negResult != 1 /* ACCEPT_INCOMPLETE */) { throw new Exception("Not a continue"); } }
Example #16
Source File: NegTokenTargFields.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) throws Exception { byte[] buf = (byte[])NegTokenTargFields.class.getField(args[0]).get(null); new NegTokenTarg(buf); }
Example #17
Source File: NotPreferredMech.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
public static void main(String[] argv) throws Exception { // Generates a NegTokenInit mechTypes field, with an // unsupported mech as the preferred. DerOutputStream mech = new DerOutputStream(); mech.write(new Oid("1.2.3.4").getDER()); mech.write(GSSUtil.GSS_KRB5_MECH_OID.getDER()); DerOutputStream mechTypeList = new DerOutputStream(); mechTypeList.write(DerValue.tag_Sequence, mech); // Generates a NegTokenInit mechToken field for 1.2.3.4 mech GSSHeader h1 = new GSSHeader(new ObjectIdentifier("1.2.3.4"), 1); ByteArrayOutputStream bout = new ByteArrayOutputStream(); h1.encode(bout); bout.write(new byte[1]); // Generates the NegTokenInit token Constructor<NegTokenInit> ctor = NegTokenInit.class.getDeclaredConstructor( byte[].class, BitArray.class, byte[].class, byte[].class); ctor.setAccessible(true); NegTokenInit initToken = ctor.newInstance( mechTypeList.toByteArray(), new BitArray(0), bout.toByteArray(), null); Method m = Class.forName("sun.security.jgss.spnego.SpNegoToken") .getDeclaredMethod("getEncoded"); m.setAccessible(true); byte[] spnegoToken = (byte[])m.invoke(initToken); // and wraps it into a GSSToken GSSHeader h = new GSSHeader( new ObjectIdentifier(GSSUtil.GSS_SPNEGO_MECH_OID.toString()), spnegoToken.length); bout = new ByteArrayOutputStream(); h.encode(bout); bout.write(spnegoToken); byte[] token = bout.toByteArray(); // and feeds it to a GSS acceptor GSSManager man = GSSManager.getInstance(); GSSContext ctxt = man.createContext((GSSCredential) null); token = ctxt.acceptSecContext(token, 0, token.length); NegTokenTarg targ = new NegTokenTarg(token); // Make sure it's a GO-ON message Method m2 = NegTokenTarg.class.getDeclaredMethod("getNegotiatedResult"); m2.setAccessible(true); int negResult = (int)m2.invoke(targ); if (negResult != 1 /* ACCEPT_INCOMPLETE */) { throw new Exception("Not a continue"); } }
Example #18
Source File: NegTokenTargFields.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) throws Exception { byte[] buf = (byte[])NegTokenTargFields.class.getField(args[0]).get(null); new NegTokenTarg(buf); }
Example #19
Source File: NegTokenTargFields.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) throws Exception { byte[] buf = (byte[])NegTokenTargFields.class.getField(args[0]).get(null); new NegTokenTarg(buf); }
Example #20
Source File: NegTokenTargFields.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) throws Exception { byte[] buf = (byte[])NegTokenTargFields.class.getField(args[0]).get(null); new NegTokenTarg(buf); }