equal
deleted
inserted
replaced
24 /* |
24 /* |
25 * @test |
25 * @test |
26 * @bug 7077646 |
26 * @bug 7077646 |
27 * @summary gssapi wrap for CFX per-message tokens always set FLAG_ACCEPTOR_SUBKEY |
27 * @summary gssapi wrap for CFX per-message tokens always set FLAG_ACCEPTOR_SUBKEY |
28 * @compile -XDignore.symbol.file AcceptorSubKey.java |
28 * @compile -XDignore.symbol.file AcceptorSubKey.java |
29 * @run main/othervm AcceptorSubKey |
29 * @run main/othervm AcceptorSubKey 0 |
|
30 * @run main/othervm AcceptorSubKey 4 |
30 */ |
31 */ |
31 |
32 |
32 import java.util.Arrays; |
|
33 import sun.security.jgss.GSSUtil; |
33 import sun.security.jgss.GSSUtil; |
34 |
34 |
35 // The basic krb5 test skeleton you can copy from |
35 // The basic krb5 test skeleton you can copy from |
36 public class AcceptorSubKey { |
36 public class AcceptorSubKey { |
37 |
37 |
38 public static void main(String[] args) throws Exception { |
38 public static void main(String[] args) throws Exception { |
39 |
39 |
|
40 int expected = Integer.parseInt(args[0]); |
|
41 |
40 new OneKDC(null).writeJAASConf(); |
42 new OneKDC(null).writeJAASConf(); |
|
43 |
|
44 if (expected != 0) { |
|
45 System.setProperty("sun.security.krb5.acceptor.subkey", "true"); |
|
46 } |
41 |
47 |
42 Context c, s; |
48 Context c, s; |
43 c = Context.fromJAAS("client"); |
49 c = Context.fromJAAS("client"); |
44 s = Context.fromJAAS("server"); |
50 s = Context.fromJAAS("server"); |
45 |
51 |
51 byte[] msg = "i say high --".getBytes(); |
57 byte[] msg = "i say high --".getBytes(); |
52 byte[] wrapped = s.wrap(msg, false); |
58 byte[] wrapped = s.wrap(msg, false); |
53 |
59 |
54 // FLAG_ACCEPTOR_SUBKEY is 4 |
60 // FLAG_ACCEPTOR_SUBKEY is 4 |
55 int flagOn = wrapped[2] & 4; |
61 int flagOn = wrapped[2] & 4; |
56 if (flagOn != 0) { |
62 if (flagOn != expected) { |
57 throw new Exception("Java GSS should not have set acceptor subkey"); |
63 throw new Exception("not expected"); |
58 } |
64 } |
59 |
65 |
60 s.dispose(); |
66 s.dispose(); |
61 c.dispose(); |
67 c.dispose(); |
62 } |
68 } |