8022461: Fix lint warnings in sun.security.{provider,rsa,x509}
authorjuh
Thu, 08 Aug 2013 17:06:40 -0700
changeset 19375 cdfdb9c0590e
parent 19374 6773349693eb
child 19376 b8743dfc5d00
8022461: Fix lint warnings in sun.security.{provider,rsa,x509} Reviewed-by: darcy, weijun, xuelei, mullan
jdk/src/share/classes/sun/security/provider/DSAPublicKey.java
jdk/src/share/classes/sun/security/rsa/RSAPublicKeyImpl.java
jdk/src/share/classes/sun/security/rsa/RSASignature.java
jdk/src/share/classes/sun/security/x509/AlgIdDSA.java
jdk/src/share/classes/sun/security/x509/X509Key.java
--- a/jdk/src/share/classes/sun/security/provider/DSAPublicKey.java	Thu Aug 08 12:03:04 2013 -0700
+++ b/jdk/src/share/classes/sun/security/provider/DSAPublicKey.java	Thu Aug 08 17:06:40 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, 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
@@ -37,6 +37,7 @@
 
 import sun.security.x509.X509Key;
 import sun.security.x509.AlgIdDSA;
+import sun.security.util.BitArray;
 import sun.security.util.Debug;
 import sun.security.util.DerValue;
 import sun.security.util.DerInputStream;
@@ -88,8 +89,9 @@
         algid = new AlgIdDSA(p, q, g);
 
         try {
-            key = new DerValue(DerValue.tag_Integer,
+            byte[] keyArray = new DerValue(DerValue.tag_Integer,
                                y.toByteArray()).toByteArray();
+            setKey(new BitArray(keyArray.length*8, keyArray));
             encode();
         } catch (IOException e) {
             throw new InvalidKeyException("could not DER encode y: " +
@@ -142,7 +144,7 @@
 
     protected void parseKeyBits() throws InvalidKeyException {
         try {
-            DerInputStream in = new DerInputStream(key);
+            DerInputStream in = new DerInputStream(getKey().toByteArray());
             y = in.getBigInteger();
         } catch (IOException e) {
             throw new InvalidKeyException("Invalid key: y value\n" +
--- a/jdk/src/share/classes/sun/security/rsa/RSAPublicKeyImpl.java	Thu Aug 08 12:03:04 2013 -0700
+++ b/jdk/src/share/classes/sun/security/rsa/RSAPublicKeyImpl.java	Thu Aug 08 17:06:40 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, 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
@@ -67,9 +67,10 @@
             DerOutputStream out = new DerOutputStream();
             out.putInteger(n);
             out.putInteger(e);
-            DerValue val =
-                new DerValue(DerValue.tag_Sequence, out.toByteArray());
-            key = val.toByteArray();
+            byte[] keyArray =
+                new DerValue(DerValue.tag_Sequence,
+                             out.toByteArray()).toByteArray();
+            setKey(new BitArray(keyArray.length*8, keyArray));
         } catch (IOException exc) {
             // should never occur
             throw new InvalidKeyException(exc);
@@ -104,7 +105,7 @@
      */
     protected void parseKeyBits() throws InvalidKeyException {
         try {
-            DerInputStream in = new DerInputStream(key);
+            DerInputStream in = new DerInputStream(getKey().toByteArray());
             DerValue derValue = in.getDerValue();
             if (derValue.tag != DerValue.tag_Sequence) {
                 throw new IOException("Not a SEQUENCE");
--- a/jdk/src/share/classes/sun/security/rsa/RSASignature.java	Thu Aug 08 12:03:04 2013 -0700
+++ b/jdk/src/share/classes/sun/security/rsa/RSASignature.java	Thu Aug 08 17:06:40 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, 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
@@ -244,12 +244,14 @@
     }
 
     // set parameter, not supported. See JCA doc
+    @Deprecated
     protected void engineSetParameter(String param, Object value)
             throws InvalidParameterException {
         throw new UnsupportedOperationException("setParameter() not supported");
     }
 
     // get parameter, not supported. See JCA doc
+    @Deprecated
     protected Object engineGetParameter(String param)
             throws InvalidParameterException {
         throw new UnsupportedOperationException("getParameter() not supported");
--- a/jdk/src/share/classes/sun/security/x509/AlgIdDSA.java	Thu Aug 08 12:03:04 2013 -0700
+++ b/jdk/src/share/classes/sun/security/x509/AlgIdDSA.java	Thu Aug 08 17:06:40 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, 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
@@ -96,7 +96,7 @@
      * Default constructor.  The OID and parameters must be
      * deserialized before this algorithm ID is used.
      */
-    // XXX deprecated for general use
+    @Deprecated
     public AlgIdDSA () {}
 
     AlgIdDSA (DerValue val) throws IOException
--- a/jdk/src/share/classes/sun/security/x509/X509Key.java	Thu Aug 08 12:03:04 2013 -0700
+++ b/jdk/src/share/classes/sun/security/x509/X509Key.java	Thu Aug 08 17:06:40 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, 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
@@ -79,6 +79,7 @@
      * Added to keep the byte[] key form consistent with the BitArray
      * form. Can de deleted when byte[] key is deleted.
      */
+    @Deprecated
     private int unusedBits = 0;
 
     /* BitArray form of key */