public interface Extension
| java.security.cert.Extension |
该接口表示X.509扩展名。
扩展提供了将附加属性与用户或公钥相关联以及管理证书层次结构的方法。 扩展格式还允许社区定义专用扩展以携带这些社区独有的信息。
每个扩展包含一个对象标识符,一个关键性设置,指示它是临界还是非临界扩展,以及ASN.1 DER编码值。 其ASN.1定义是:
Extension ::= SEQUENCE {
extnId OBJECT IDENTIFIER,
critical BOOLEAN DEFAULT FALSE,
extnValue OCTET STRING
-- contains a DER encoding of a value
-- of the type registered for use with
-- the extnId object identifier value
}
该接口旨在提供对单个分机的访问,而不像 X509Extension更适合访问一组分机。
公共方法(Public methods) |
|
|---|---|
abstract void |
encode(OutputStream out) 生成扩展的DER编码并将其写入输出流。 |
abstract String |
getId() 获取扩展的对象标识符。 |
abstract byte[] |
getValue() 获取扩展的DER编码值。 |
abstract boolean |
isCritical() 获取扩展的关键设置。 |
void encode (OutputStream out)
生成扩展的DER编码并将其写入输出流。
| 参数(Parameters) | |
|---|---|
out |
OutputStream: the output stream |
| 抛出异常(Throws) | |
|---|---|
IOException |
on encoding or output error. |
NullPointerException |
if out is null. |
String getId ()
获取扩展的对象标识符。
| 返回(Returns) | |
|---|---|
String |
the object identifier as a String |
byte[] getValue ()
获取扩展的DER编码值。 请注意,这是编码为OCTET STRING的字节。 它不包含OCTET STRING标签和长度。
| 返回(Returns) | |
|---|---|
byte[] |
a copy of the extension's value, or null if no extension value is present. |
boolean isCritical ()
获取扩展的关键设置。
| 返回(Returns) | |
|---|---|
boolean |
true if this is a critical extension. |