changeset 7924:eec956f1670c

8054019: Keytool Error publicKey's is not X.509, but X509 Reviewed-by: mullan, xuelei
author coffeys
date Tue, 02 Sep 2014 22:25:32 +0100
parents 43d918d51967
children b6d1b9081cb3
files src/share/classes/sun/security/x509/CertAndKeyGen.java
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/sun/security/x509/CertAndKeyGen.java	Tue Sep 02 15:56:40 2014 +0100
+++ b/src/share/classes/sun/security/x509/CertAndKeyGen.java	Tue Sep 02 22:25:32 2014 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -156,9 +156,11 @@
 
         // publicKey's format must be X.509 otherwise
         // the whole CertGen part of this class is broken.
-        if (!"X.509".equalsIgnoreCase(publicKey.getFormat())) {
-            throw new IllegalArgumentException("publicKey's is not X.509, but "
-                    + publicKey.getFormat());
+        // Allow "X509" in 7u for backwards compatibility.
+        if (!"X.509".equalsIgnoreCase(publicKey.getFormat()) &&
+            !"X509".equalsIgnoreCase(publicKey.getFormat())) {
+            throw new IllegalArgumentException("Public key format is " +
+                publicKey.getFormat() + ", must be X.509");
         }
     }