changeset 7833:5005d6915c93

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 79384ebd10fe
children cbb3b5a7a1fb
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	Fri Nov 07 17:13:40 2014 +0300
+++ 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");
         }
     }