summaryrefslogtreecommitdiffstats
path: root/luni
diff options
context:
space:
mode:
authorBrian Carlstrom <bdc@google.com>2011-05-21 21:10:10 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-05-21 21:10:10 -0700
commitb72345a0a1981312729921ed5da9cb4218685a5b (patch)
tree26fb21c4b8c2ee73d0c88b437771cd4b1c835b3e /luni
parent5f8b0e8811187fb67b29268c6bf97e42cd5a3897 (diff)
parent4280237a545e7482b6ea954fd862878867b8f896 (diff)
downloadlibcore-b72345a0a1981312729921ed5da9cb4218685a5b.zip
libcore-b72345a0a1981312729921ed5da9cb4218685a5b.tar.gz
libcore-b72345a0a1981312729921ed5da9cb4218685a5b.tar.bz2
Merge "Ensure signature verification fast path is used with alternatively formatted signature algorithm names" into dalvik-dev
Diffstat (limited to 'luni')
-rw-r--r--luni/src/main/java/org/apache/harmony/security/provider/cert/X509CertImpl.java49
1 files changed, 16 insertions, 33 deletions
diff --git a/luni/src/main/java/org/apache/harmony/security/provider/cert/X509CertImpl.java b/luni/src/main/java/org/apache/harmony/security/provider/cert/X509CertImpl.java
index a144727..35bcb39 100644
--- a/luni/src/main/java/org/apache/harmony/security/provider/cert/X509CertImpl.java
+++ b/luni/src/main/java/org/apache/harmony/security/provider/cert/X509CertImpl.java
@@ -90,10 +90,6 @@ public final class X509CertImpl extends X509Certificate {
// encoding of the certificate
private volatile byte[] encoding;
- //
- // ---------------------- Constructors -------------------------------
- //
-
/**
* Constructs the instance on the base of ASN.1 encoded
* form of X.509 certificate provided via stream parameter.
@@ -133,10 +129,6 @@ public final class X509CertImpl extends X509Certificate {
this((Certificate) Certificate.ASN1.decode(encoding));
}
- //
- // ----------------- Public methods implementations ------------------
- //
-
public void checkValidity()
throws CertificateExpiredException, CertificateNotYetValidException {
checkValidity(System.currentTimeMillis());
@@ -351,11 +343,7 @@ public final class X509CertImpl extends X509Certificate {
}
}
- //
- // ----- java.security.cert.Certificate methods implementations ------
- //
-
- public byte[] getEncoded() throws CertificateEncodingException {
+ @Override public byte[] getEncoded() throws CertificateEncodingException {
return getEncodedInternal().clone();
}
private byte[] getEncodedInternal() throws CertificateEncodingException {
@@ -366,7 +354,7 @@ public final class X509CertImpl extends X509Certificate {
return result;
}
- public PublicKey getPublicKey() {
+ @Override public PublicKey getPublicKey() {
PublicKey result = publicKey;
if (result == null) {
publicKey = result = tbsCert.getSubjectPublicKeyInfo().getPublicKey();
@@ -374,15 +362,14 @@ public final class X509CertImpl extends X509Certificate {
return result;
}
- public String toString() {
+ @Override public String toString() {
return certificate.toString();
}
- public void verify(PublicKey key)
- throws CertificateException, NoSuchAlgorithmException,
- InvalidKeyException, NoSuchProviderException,
- SignatureException {
- if (getSigAlgName().endsWith("withRSA")) {
+ @Override public void verify(PublicKey key)
+ throws CertificateException, NoSuchAlgorithmException, InvalidKeyException,
+ NoSuchProviderException, SignatureException {
+ if (getSigAlgName().endsWith("withRSA") || getSigAlgName().endsWith("WithRSAEncryption")) {
fastVerify(key);
return;
}
@@ -398,11 +385,11 @@ public final class X509CertImpl extends X509Certificate {
}
}
- public void verify(PublicKey key, String sigProvider)
- throws CertificateException, NoSuchAlgorithmException,
- InvalidKeyException, NoSuchProviderException,
- SignatureException {
- if (getSigAlgName().endsWith("withRSA") && sigProvider == null) {
+ @Override public void verify(PublicKey key, String sigProvider)
+ throws CertificateException, NoSuchAlgorithmException, InvalidKeyException,
+ NoSuchProviderException, SignatureException {
+ if ((getSigAlgName().endsWith("withRSA") || getSigAlgName().endsWith("WithRSAEncryption"))
+ && sigProvider == null) {
fastVerify(key);
return;
}
@@ -457,11 +444,7 @@ public final class X509CertImpl extends X509Certificate {
}
}
- //
- // ----- java.security.cert.X509Extension methods implementations ----
- //
-
- public Set<String> getNonCriticalExtensionOIDs() {
+ @Override public Set<String> getNonCriticalExtensionOIDs() {
if (extensions == null) {
return null;
}
@@ -469,7 +452,7 @@ public final class X509CertImpl extends X509Certificate {
return extensions.getNonCriticalExtensions();
}
- public Set<String> getCriticalExtensionOIDs() {
+ @Override public Set<String> getCriticalExtensionOIDs() {
if (extensions == null) {
return null;
}
@@ -477,7 +460,7 @@ public final class X509CertImpl extends X509Certificate {
return extensions.getCriticalExtensions();
}
- public byte[] getExtensionValue(String oid) {
+ @Override public byte[] getExtensionValue(String oid) {
if (extensions == null) {
return null;
}
@@ -486,7 +469,7 @@ public final class X509CertImpl extends X509Certificate {
return (ext == null) ? null : ext.getRawExtnValue();
}
- public boolean hasUnsupportedCriticalExtension() {
+ @Override public boolean hasUnsupportedCriticalExtension() {
if (extensions == null) {
return false;
}