如何解决给予DerValue构造函数的额外数据"?

时间:2017-08-30 14:23:01

标签: java certificate

编写以下代码( sun.security )以将权限信息访问添加到证书中。

`ObjectIdentifier objectIdentifier15=new ObjectIdentifier("1.2.3");
byte[] byte15=new byte[]{1,2,5};
DerValue derValue15=new DerValue(byte15);
GeneralName generalName15=new GeneralName(derValue15);
AccessDescription accessDescription1=new AccessDescription(objectIdentifier15, generalName15);
ArrayList<AccessDescription> accessDescriptions=new ArrayList<AccessDescription>();
accessDescriptions.add(accessDescription1);
certificateExtensions.set(AuthorityInfoAccessExtension.NAME, new AuthorityInfoAccessExtension(accessDescriptions));`

但是发生了IOException:

`java.io.IOException: extra data given to DerValue constructor
    at sun.security.util.DerValue.init(DerValue.java:384)
    at sun.security.util.DerValue.<init>(DerValue.java:294)`

如何解决这个问题?

0 个答案:

没有答案