4152N/A/*
4152N/A * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
4152N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4152N/A *
4152N/A * This code is free software; you can redistribute it and/or modify it
4152N/A * under the terms of the GNU General Public License version 2 only, as
4152N/A * published by the Free Software Foundation.
4152N/A *
4152N/A * This code is distributed in the hope that it will be useful, but WITHOUT
4152N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4152N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
4152N/A * version 2 for more details (a copy is included in the LICENSE file that
4152N/A * accompanied this code).
4152N/A *
4152N/A * You should have received a copy of the GNU General Public License version
4152N/A * 2 along with this work; if not, write to the Free Software Foundation,
4152N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4152N/A *
4152N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4152N/A * or visit www.oracle.com if you need additional information or have any
4152N/A * questions.
4152N/A */
4152N/A
4152N/A/*
4152N/A * @test
4152N/A * @bug 7040151
4152N/A * @summary SPNEGO GSS code does not parse tokens in accordance to RFC 2478
4152N/A * @compile -XDignore.symbol.file NegTokenTargFields.java
4152N/A * @run main NegTokenTargFields nomech
4152N/A * @run main/fail NegTokenTargFields badorder
4152N/A */
4152N/A
4152N/Aimport sun.security.jgss.spnego.NegTokenTarg;
4152N/A
4152N/Apublic class NegTokenTargFields {
4152N/A
4152N/A // A hand-crafted NegTokenTarg with negResult and responseToken only
4152N/A public static byte[] nomech = {
4152N/A (byte)0xA1, (byte)0x0F, (byte)0x30, (byte)0x0D,
4152N/A (byte)0xA0, (byte)0x03, (byte)0x0A, (byte)0x01,
4152N/A (byte)0x02, (byte)0xA2, (byte)0x02, (byte)0x04,
4152N/A (byte)0x00, (byte)0xA3, (byte)0x02, (byte)0x04,
4152N/A (byte)0x00,
4152N/A };
4152N/A
4152N/A // A hand-crafted NegTokenTarg with negResult and supportedMech in wrong order
4152N/A public static byte[] badorder = {
4152N/A (byte)0xA1, (byte)0x1E, (byte)0x30, (byte)0x1C,
4152N/A (byte)0xA1, (byte)0x0B, (byte)0x06, (byte)0x09,
4152N/A (byte)0x2A, (byte)0x86, (byte)0x48, (byte)0x86,
4152N/A (byte)0xF7, (byte)0x12, (byte)0x01, (byte)0x02,
4152N/A (byte)0x02, (byte)0xA0, (byte)0x03, (byte)0x0A,
4152N/A (byte)0x01, (byte)0x00, (byte)0xA2, (byte)0x03,
4152N/A (byte)0x04, (byte)0x01, (byte)0x00, (byte)0xA3,
4152N/A (byte)0x03, (byte)0x04, (byte)0x01, (byte)0x00,
4152N/A };
4152N/A
4152N/A public static void main(String[] args) throws Exception {
4152N/A byte[] buf = (byte[])NegTokenTargFields.class.getField(args[0]).get(null);
4152N/A new NegTokenTarg(buf);
4152N/A }
4152N/A}