mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 23:34:52 +02:00
8296072: CertAttrSet::encode and DerEncoder::derEncode should write into DerOutputStream
Reviewed-by: xuelei, mullan
This commit is contained in:
parent
37107fc157
commit
0d0bd7bd40
50 changed files with 209 additions and 314 deletions
|
@ -30,7 +30,6 @@ import java.io.OutputStream;
|
|||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.security.cert.CRLException;
|
||||
import java.security.cert.CertificateException;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
|
@ -145,16 +144,8 @@ public class CRLExtensions {
|
|||
throws CRLException {
|
||||
try {
|
||||
DerOutputStream extOut = new DerOutputStream();
|
||||
Collection<Extension> allExts = map.values();
|
||||
Object[] objs = allExts.toArray();
|
||||
|
||||
for (int i = 0; i < objs.length; i++) {
|
||||
if (objs[i] instanceof CertAttrSet)
|
||||
((CertAttrSet)objs[i]).encode(extOut);
|
||||
else if (objs[i] instanceof Extension)
|
||||
((Extension)objs[i]).encode(extOut);
|
||||
else
|
||||
throw new CRLException("Illegal extension object");
|
||||
for (Extension ext : map.values()) {
|
||||
ext.encode(extOut);
|
||||
}
|
||||
|
||||
DerOutputStream seq = new DerOutputStream();
|
||||
|
@ -168,7 +159,7 @@ public class CRLExtensions {
|
|||
tmp = seq;
|
||||
|
||||
out.write(tmp.toByteArray());
|
||||
} catch (IOException | CertificateException e) {
|
||||
} catch (IOException e) {
|
||||
throw new CRLException("Encoding error: " + e.toString());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue