mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-23 20:44:41 +02:00
8022461: Fix lint warnings in sun.security.{provider,rsa,x509}
Reviewed-by: darcy, weijun, xuelei, mullan
This commit is contained in:
parent
dca36c08f3
commit
ea03f7c91f
5 changed files with 18 additions and 12 deletions
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -37,6 +37,7 @@ import java.security.interfaces.DSAParams;
|
||||||
|
|
||||||
import sun.security.x509.X509Key;
|
import sun.security.x509.X509Key;
|
||||||
import sun.security.x509.AlgIdDSA;
|
import sun.security.x509.AlgIdDSA;
|
||||||
|
import sun.security.util.BitArray;
|
||||||
import sun.security.util.Debug;
|
import sun.security.util.Debug;
|
||||||
import sun.security.util.DerValue;
|
import sun.security.util.DerValue;
|
||||||
import sun.security.util.DerInputStream;
|
import sun.security.util.DerInputStream;
|
||||||
|
@ -88,8 +89,9 @@ implements java.security.interfaces.DSAPublicKey, Serializable {
|
||||||
algid = new AlgIdDSA(p, q, g);
|
algid = new AlgIdDSA(p, q, g);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
key = new DerValue(DerValue.tag_Integer,
|
byte[] keyArray = new DerValue(DerValue.tag_Integer,
|
||||||
y.toByteArray()).toByteArray();
|
y.toByteArray()).toByteArray();
|
||||||
|
setKey(new BitArray(keyArray.length*8, keyArray));
|
||||||
encode();
|
encode();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new InvalidKeyException("could not DER encode y: " +
|
throw new InvalidKeyException("could not DER encode y: " +
|
||||||
|
@ -142,7 +144,7 @@ implements java.security.interfaces.DSAPublicKey, Serializable {
|
||||||
|
|
||||||
protected void parseKeyBits() throws InvalidKeyException {
|
protected void parseKeyBits() throws InvalidKeyException {
|
||||||
try {
|
try {
|
||||||
DerInputStream in = new DerInputStream(key);
|
DerInputStream in = new DerInputStream(getKey().toByteArray());
|
||||||
y = in.getBigInteger();
|
y = in.getBigInteger();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new InvalidKeyException("Invalid key: y value\n" +
|
throw new InvalidKeyException("Invalid key: y value\n" +
|
||||||
|
|
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -67,9 +67,10 @@ public final class RSAPublicKeyImpl extends X509Key implements RSAPublicKey {
|
||||||
DerOutputStream out = new DerOutputStream();
|
DerOutputStream out = new DerOutputStream();
|
||||||
out.putInteger(n);
|
out.putInteger(n);
|
||||||
out.putInteger(e);
|
out.putInteger(e);
|
||||||
DerValue val =
|
byte[] keyArray =
|
||||||
new DerValue(DerValue.tag_Sequence, out.toByteArray());
|
new DerValue(DerValue.tag_Sequence,
|
||||||
key = val.toByteArray();
|
out.toByteArray()).toByteArray();
|
||||||
|
setKey(new BitArray(keyArray.length*8, keyArray));
|
||||||
} catch (IOException exc) {
|
} catch (IOException exc) {
|
||||||
// should never occur
|
// should never occur
|
||||||
throw new InvalidKeyException(exc);
|
throw new InvalidKeyException(exc);
|
||||||
|
@ -104,7 +105,7 @@ public final class RSAPublicKeyImpl extends X509Key implements RSAPublicKey {
|
||||||
*/
|
*/
|
||||||
protected void parseKeyBits() throws InvalidKeyException {
|
protected void parseKeyBits() throws InvalidKeyException {
|
||||||
try {
|
try {
|
||||||
DerInputStream in = new DerInputStream(key);
|
DerInputStream in = new DerInputStream(getKey().toByteArray());
|
||||||
DerValue derValue = in.getDerValue();
|
DerValue derValue = in.getDerValue();
|
||||||
if (derValue.tag != DerValue.tag_Sequence) {
|
if (derValue.tag != DerValue.tag_Sequence) {
|
||||||
throw new IOException("Not a SEQUENCE");
|
throw new IOException("Not a SEQUENCE");
|
||||||
|
|
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -244,12 +244,14 @@ public abstract class RSASignature extends SignatureSpi {
|
||||||
}
|
}
|
||||||
|
|
||||||
// set parameter, not supported. See JCA doc
|
// set parameter, not supported. See JCA doc
|
||||||
|
@Deprecated
|
||||||
protected void engineSetParameter(String param, Object value)
|
protected void engineSetParameter(String param, Object value)
|
||||||
throws InvalidParameterException {
|
throws InvalidParameterException {
|
||||||
throw new UnsupportedOperationException("setParameter() not supported");
|
throw new UnsupportedOperationException("setParameter() not supported");
|
||||||
}
|
}
|
||||||
|
|
||||||
// get parameter, not supported. See JCA doc
|
// get parameter, not supported. See JCA doc
|
||||||
|
@Deprecated
|
||||||
protected Object engineGetParameter(String param)
|
protected Object engineGetParameter(String param)
|
||||||
throws InvalidParameterException {
|
throws InvalidParameterException {
|
||||||
throw new UnsupportedOperationException("getParameter() not supported");
|
throw new UnsupportedOperationException("getParameter() not supported");
|
||||||
|
|
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -96,7 +96,7 @@ class AlgIdDSA extends AlgorithmId implements DSAParams
|
||||||
* Default constructor. The OID and parameters must be
|
* Default constructor. The OID and parameters must be
|
||||||
* deserialized before this algorithm ID is used.
|
* deserialized before this algorithm ID is used.
|
||||||
*/
|
*/
|
||||||
// XXX deprecated for general use
|
@Deprecated
|
||||||
public AlgIdDSA () {}
|
public AlgIdDSA () {}
|
||||||
|
|
||||||
AlgIdDSA (DerValue val) throws IOException
|
AlgIdDSA (DerValue val) throws IOException
|
||||||
|
|
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -79,6 +79,7 @@ public class X509Key implements PublicKey {
|
||||||
* Added to keep the byte[] key form consistent with the BitArray
|
* Added to keep the byte[] key form consistent with the BitArray
|
||||||
* form. Can de deleted when byte[] key is deleted.
|
* form. Can de deleted when byte[] key is deleted.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
private int unusedBits = 0;
|
private int unusedBits = 0;
|
||||||
|
|
||||||
/* BitArray form of key */
|
/* BitArray form of key */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue