diff options
author | Adam Young <ayoung@redhat.com> | 2011-11-10 22:12:52 -0500 |
---|---|---|
committer | Adam Young <ayoung@redhat.com> | 2011-12-06 11:20:03 -0500 |
commit | 6119a0222dee4953d51311489d8863daa62d9b14 (patch) | |
tree | dc30408d3be499e1f84c1c49d41bbc109731fb7a /pki/base/util | |
parent | 3c1a4af339dc1761b3a68abe9b0f26bd3cb389cf (diff) | |
download | pki-6119a0222dee4953d51311489d8863daa62d9b14.tar.gz pki-6119a0222dee4953d51311489d8863daa62d9b14.tar.xz pki-6119a0222dee4953d51311489d8863daa62d9b14.zip |
call statics statically
https://bugzilla.redhat.com/show_bug.cgi?id=728303
Updated with changes from code review
Leaving in the warning in GenericASN1Extension, ans that is an indication of a real problem, which will get addressed in a separate patch.
Diffstat (limited to 'pki/base/util')
5 files changed, 15 insertions, 16 deletions
diff --git a/pki/base/util/src/com/netscape/cmsutil/crypto/CryptoUtil.java b/pki/base/util/src/com/netscape/cmsutil/crypto/CryptoUtil.java index 2cd13111..e659da9b 100644 --- a/pki/base/util/src/com/netscape/cmsutil/crypto/CryptoUtil.java +++ b/pki/base/util/src/com/netscape/cmsutil/crypto/CryptoUtil.java @@ -661,10 +661,8 @@ public class CryptoUtil { CertificateSubjectName(new X500Name(subjname))); info.set(X509CertInfo.VALIDITY, new CertificateValidity(notBefore, notAfter)); - AlgorithmId sigAlgId = new AlgorithmId(); - info.set(X509CertInfo.ALGORITHM_ID, new - CertificateAlgorithmId(sigAlgId.get(alg))); + CertificateAlgorithmId(AlgorithmId.get(alg))); info.set(X509CertInfo.KEY, new CertificateX509Key(x509key)); info.set(X509CertInfo.EXTENSIONS, new CertificateExtensions()); return info; diff --git a/pki/base/util/src/com/netscape/cmsutil/http/JssSSLSocketFactory.java b/pki/base/util/src/com/netscape/cmsutil/http/JssSSLSocketFactory.java index ed4e9518..501886b5 100644 --- a/pki/base/util/src/com/netscape/cmsutil/http/JssSSLSocketFactory.java +++ b/pki/base/util/src/com/netscape/cmsutil/http/JssSSLSocketFactory.java @@ -121,7 +121,8 @@ public class JssSSLSocketFactory implements ISocketFactory { s.setUseClientMode(true); s.enableSSL2(false); - s.enableSSL2Default(false); + //TODO Do we rally want to set the default each time? + SSLSocket.enableSSL2Default(false); s.enableV2CompatibleHello(false); SSLHandshakeCompletedListener listener = null; diff --git a/pki/base/util/src/netscape/security/pkcs/PKCS8Key.java b/pki/base/util/src/netscape/security/pkcs/PKCS8Key.java index dfa5a728..20a788fc 100644 --- a/pki/base/util/src/netscape/security/pkcs/PKCS8Key.java +++ b/pki/base/util/src/netscape/security/pkcs/PKCS8Key.java @@ -60,7 +60,7 @@ public class PKCS8Key implements PrivateKey { protected byte[] encodedKey; /* The version for this key */ - public static final BigInteger version = BigInteger.valueOf(0); + public static final BigInteger VERSION = BigInteger.valueOf(0); /** * Default constructor. The key constructed must have its key @@ -104,9 +104,9 @@ public class PKCS8Key implements PrivateKey { throw new IOException ("corrupt private key"); BigInteger parsedVersion = in.data.getInteger().toBigInteger(); - if (!version.equals(parsedVersion)) { + if (!VERSION.equals(parsedVersion)) { throw new IOException("version mismatch: (supported: " + - version + ", parsed: " + + VERSION + ", parsed: " + parsedVersion); } @@ -324,9 +324,9 @@ public class PKCS8Key implements PrivateKey { BigInteger version = val.data.getInteger().toBigInteger(); - if (!version.equals(this.version)) { + if (!version.equals(PKCS8Key.VERSION)) { throw new IOException("version mismatch: (supported: " + - this.version + ", parsed: " + + PKCS8Key.VERSION + ", parsed: " + version); } algid = AlgorithmId.parse (val.data.getDerValue ()); @@ -389,7 +389,7 @@ public class PKCS8Key implements PrivateKey { static void encode(DerOutputStream out, AlgorithmId algid, byte[] key) throws IOException { DerOutputStream tmp = new DerOutputStream(); - tmp.putInteger(new BigInt(version.toByteArray())); + tmp.putInteger(new BigInt(VERSION.toByteArray())); algid.encode(tmp); tmp.putOctetString(key); out.write(DerValue.tag_Sequence, tmp); diff --git a/pki/base/util/src/netscape/security/x509/CRLDistributionPoint.java b/pki/base/util/src/netscape/security/x509/CRLDistributionPoint.java index 532e313a..5207e319 100644 --- a/pki/base/util/src/netscape/security/x509/CRLDistributionPoint.java +++ b/pki/base/util/src/netscape/security/x509/CRLDistributionPoint.java @@ -405,7 +405,7 @@ public static class Template implements ASN1Template { try { DerValue dv = new DerValue(distPoint.getEncoded()); //toFile("encodedFullName", distPoint.getEncoded()); - dv.resetTag(dv.tag_Sequence); + dv.resetTag(DerValue.tag_Sequence); cdp.setFullName( new GeneralNames(dv) ); } catch(GeneralNamesException e) { throw new InvalidBERException( "fullName: " + e.toString()); @@ -435,7 +435,7 @@ public static class Template implements ASN1Template { : } : } */ - dv.resetTag(dv.tag_Set); + dv.resetTag(DerValue.tag_Set); cdp.setRelativeName( new RDN(dv) ); } catch(IOException e) { throw new InvalidBERException( "relativeName " + @@ -464,7 +464,7 @@ public static class Template implements ASN1Template { } try { DerValue dv = new DerValue( issuer.getEncoded() ); - dv.resetTag(dv.tag_Sequence); + dv.resetTag(DerValue.tag_Sequence); cdp.setCRLIssuer( new GeneralNames(dv) ); } catch(GeneralNamesException e) { throw new InvalidBERException( "cRLIssuer " + e.toString() ); diff --git a/pki/base/util/src/netscape/security/x509/IssuingDistributionPointExtension.java b/pki/base/util/src/netscape/security/x509/IssuingDistributionPointExtension.java index 36cce030..d6afd54c 100644 --- a/pki/base/util/src/netscape/security/x509/IssuingDistributionPointExtension.java +++ b/pki/base/util/src/netscape/security/x509/IssuingDistributionPointExtension.java @@ -393,14 +393,14 @@ public class IssuingDistributionPointExtension extends Extension generalNames = new GeneralNames(); generalNames.addElement(dn); idp.setFullName(generalNames); - idpExt.set(idpExt.ISSUING_DISTRIBUTION_POINT, idp); + idpExt.set(IssuingDistributionPointExtension.ISSUING_DISTRIBUTION_POINT, idp); // DN + reason BitArray ba = new BitArray(5, new byte[] {(byte)0x28} ); idp = new IssuingDistributionPoint(); idp.setFullName(generalNames); idp.setOnlySomeReasons(ba); - idpExt.set(idpExt.ISSUING_DISTRIBUTION_POINT, idp); + idpExt.set(IssuingDistributionPointExtension.ISSUING_DISTRIBUTION_POINT, idp); // relative DN + reason + crlIssuer @@ -411,7 +411,7 @@ public class IssuingDistributionPointExtension extends Extension idp.setOnlyContainsCACerts(true); idp.setOnlyContainsUserCerts(true); idp.setIndirectCRL(true); - idpExt.set(idpExt.ISSUING_DISTRIBUTION_POINT, idp); + idpExt.set(IssuingDistributionPointExtension.ISSUING_DISTRIBUTION_POINT, idp); idpExt.setCritical(false); idpExt.encode(bos); |