< prev index next >

test/sun/security/util/Oid/OidFormat.java

Print this page




  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @author Weijun Wang
  27  * @bug 6418422
  28  * @bug 6418425
  29  * @bug 6418433
  30  * @summary ObjectIdentifier should reject 1.2.3.-4 and throw IOException on all format errors


  31  */
  32 
  33 import java.io.IOException;
  34 import java.security.NoSuchAlgorithmException;
  35 import org.ietf.jgss.GSSException;
  36 import org.ietf.jgss.Oid;
  37 import javax.crypto.EncryptedPrivateKeyInfo;
  38 import sun.security.util.*;
  39 import java.util.Arrays;
  40 
  41 public class OidFormat {
  42     public static void main(String[] args) throws Exception {
  43         String[] badOids = {
  44             // number problems
  45             "0", "1", "2",
  46             "3.1.1", "3", "4",
  47             "1.40", "1.111.1",
  48             "-1.2", "0,-2", "1.-2", "2.-2",
  49             "1.2.-3.4", "1.2.3.-4",
  50             // format problems




  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @author Weijun Wang
  27  * @bug 6418422
  28  * @bug 6418425
  29  * @bug 6418433
  30  * @summary ObjectIdentifier should reject 1.2.3.-4 and throw IOException on all format errors
  31  * @modules java.base/sun.security.util
  32  *          java.security.jgss
  33  */
  34 
  35 import java.io.IOException;
  36 import java.security.NoSuchAlgorithmException;
  37 import org.ietf.jgss.GSSException;
  38 import org.ietf.jgss.Oid;
  39 import javax.crypto.EncryptedPrivateKeyInfo;
  40 import sun.security.util.*;
  41 import java.util.Arrays;
  42 
  43 public class OidFormat {
  44     public static void main(String[] args) throws Exception {
  45         String[] badOids = {
  46             // number problems
  47             "0", "1", "2",
  48             "3.1.1", "3", "4",
  49             "1.40", "1.111.1",
  50             "-1.2", "0,-2", "1.-2", "2.-2",
  51             "1.2.-3.4", "1.2.3.-4",
  52             // format problems


< prev index next >