summaryrefslogtreecommitdiffstats
path: root/luni/src/main/java/org
diff options
context:
space:
mode:
authorKenny Root <kroot@google.com>2014-05-07 19:37:08 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-05-07 19:37:08 +0000
commit982fb06853ed14a38dbf300f633b8a5c9ef6a722 (patch)
treef80f19271000bdad38aebed04a390ca33ee7f373 /luni/src/main/java/org
parent91a37e34633fd33dc342724bcfcf2dcd76c4a511 (diff)
parent14f4875cedd807a57aacad981ec083cfa3326f03 (diff)
downloadlibcore-982fb06853ed14a38dbf300f633b8a5c9ef6a722.zip
libcore-982fb06853ed14a38dbf300f633b8a5c9ef6a722.tar.gz
libcore-982fb06853ed14a38dbf300f633b8a5c9ef6a722.tar.bz2
am 14f4875c: am db3cbbc3: Merge "Add java.security.cert.Extension interface"
* commit '14f4875cedd807a57aacad981ec083cfa3326f03': Add java.security.cert.Extension interface
Diffstat (limited to 'luni/src/main/java/org')
-rw-r--r--luni/src/main/java/org/apache/harmony/security/x509/Extension.java19
-rw-r--r--luni/src/main/java/org/apache/harmony/security/x509/Extensions.java8
2 files changed, 18 insertions, 9 deletions
diff --git a/luni/src/main/java/org/apache/harmony/security/x509/Extension.java b/luni/src/main/java/org/apache/harmony/security/x509/Extension.java
index d9b02f9..d5d8015 100644
--- a/luni/src/main/java/org/apache/harmony/security/x509/Extension.java
+++ b/luni/src/main/java/org/apache/harmony/security/x509/Extension.java
@@ -23,6 +23,7 @@
package org.apache.harmony.security.x509;
import java.io.IOException;
+import java.io.OutputStream;
import java.util.Arrays;
import org.apache.harmony.security.asn1.ASN1Boolean;
import org.apache.harmony.security.asn1.ASN1OctetString;
@@ -49,7 +50,7 @@ import org.apache.harmony.security.utils.Array;
* }
* </pre>
*/
-public final class Extension {
+public final class Extension implements java.security.cert.Extension {
// critical constants
public static final boolean CRITICAL = true;
public static final boolean NON_CRITICAL = false;
@@ -145,7 +146,8 @@ public final class Extension {
/**
* Returns the value of extnID field of the structure.
*/
- public String getExtnID() {
+ @Override
+ public String getId() {
if (extnID_str == null) {
extnID_str = ObjectIdentifier.toString(extnID);
}
@@ -155,14 +157,16 @@ public final class Extension {
/**
* Returns the value of critical field of the structure.
*/
- public boolean getCritical() {
+ @Override
+ public boolean isCritical() {
return critical;
}
/**
* Returns the value of extnValue field of the structure.
*/
- public byte[] getExtnValue() {
+ @Override
+ public byte[] getValue() {
return extnValue;
}
@@ -187,6 +191,11 @@ public final class Extension {
return encoding;
}
+ @Override
+ public void encode(OutputStream out) throws IOException {
+ out.write(getEncoded());
+ }
+
@Override public boolean equals(Object ext) {
if (!(ext instanceof Extension)) {
return false;
@@ -287,7 +296,7 @@ public final class Extension {
}
public void dumpValue(StringBuilder sb, String prefix) {
- sb.append("OID: ").append(getExtnID()).append(", Critical: ").append(critical).append('\n');
+ sb.append("OID: ").append(getId()).append(", Critical: ").append(critical).append('\n');
if (!valueDecoded) {
try {
decodeExtensionValue();
diff --git a/luni/src/main/java/org/apache/harmony/security/x509/Extensions.java b/luni/src/main/java/org/apache/harmony/security/x509/Extensions.java
index 92ff3a9..7a10ebc 100644
--- a/luni/src/main/java/org/apache/harmony/security/x509/Extensions.java
+++ b/luni/src/main/java/org/apache/harmony/security/x509/Extensions.java
@@ -136,8 +136,8 @@ public final class Extensions {
Set<String> localNoncritical = new HashSet<String>(size);
Boolean localHasUnsupported = Boolean.FALSE;
for (Extension extension : extensions) {
- String oid = extension.getExtnID();
- if (extension.getCritical()) {
+ String oid = extension.getId();
+ if (extension.isCritical()) {
if (!SUPPORTED_CRITICAL.contains(oid)) {
localHasUnsupported = Boolean.TRUE;
}
@@ -162,7 +162,7 @@ public final class Extensions {
if (localOidMap == null) {
localOidMap = new HashMap<String, Extension>();
for (Extension extension : extensions) {
- localOidMap.put(extension.getExtnID(), extension);
+ localOidMap.put(extension.getId(), extension);
}
this.oidMap = localOidMap;
}
@@ -311,7 +311,7 @@ public final class Extensions {
}
Collection<List<?>> collection = ((GeneralNames) GeneralNames.ASN1.decode(extension
- .getExtnValue())).getPairsList();
+ .getValue())).getPairsList();
/*
* If the extension had any invalid entries, we may have an empty