public class CertStore extends Object
Certificate
s和
CRL
s类。
该类使用基于提供程序的架构。创建一个CertStore
,调用一个静态getInstance
方法,通过在CertStore
类型所需的任何适用的初始化参数的名称和可选的供应商的期望。
一旦CertStore
已经建立,它可以通过调用它的getCertificates
和getCRLs
方法检索Certificate
s和CRL
s。
不像KeyStore
,它提供了访问缓存的私钥和证书信任,一CertStore
旨在提供一个潜在的巨大的资源库不受信任的证书和CRL。例如,对CertStore
LDAP实现提供了访问存储在一个或多个目录的证书和CRL使用LDAP协议和架构在RFC服务属性定义。
java平台的每种实现都要求支持以下标准CertStore
型:
Collection
并发访问
CertStore
所有公共方法的对象必须是线程安全的。就是说,多个线程可以同时在一个单一的CertStore
对象调用这些方法(或多个)无不良影响。这允许一个CertPathBuilder
寻找CRL同时搜索进一步证明,例如。
这个类的静态方法也保证是线程安全的。多线程可以同时调用在这个类中定义的静态方法,没有任何不良影响。
Modifier | Constructor and Description |
---|---|
protected |
CertStore(CertStoreSpi storeSpi, Provider provider, String type, CertStoreParameters params)
创建一个
CertStore 给定类型的对象,并封装了提供程序实现(SPI对象)在这。
|
Modifier and Type | Method and Description |
---|---|
Collection<? extends Certificate> |
getCertificates(CertSelector selector)
返回一个
Collection ,指定选择器匹配
Certificate s。
|
CertStoreParameters |
getCertStoreParameters()
返回用于初始化这个
CertStore 参数。
|
Collection<? extends CRL> |
getCRLs(CRLSelector selector)
返回一个
Collection ,指定选择器匹配
CRL s。
|
static String |
getDefaultType()
返回默认
CertStore 型的
certstore.type 安全属性中指定,或字符串“LDAP”如果没有这种属性的存在。
|
static CertStore |
getInstance(String type, CertStoreParameters params)
返回一个实现指定
CertStore 类型与指定的参数初始化
CertStore 对象。
|
static CertStore |
getInstance(String type, CertStoreParameters params, Provider provider)
返回一个实现指定
CertStore 型
CertStore 对象。
|
static CertStore |
getInstance(String type, CertStoreParameters params, String provider)
返回一个实现指定
CertStore 型
CertStore 对象。
|
Provider |
getProvider()
返回该
CertStore 提供者。
|
String |
getType()
返回该
CertStore 类型。
|
protected CertStore(CertStoreSpi storeSpi, Provider provider, String type, CertStoreParameters params)
CertStore
给定类型的对象,并封装了提供程序实现(SPI对象)在这。
storeSpi
-提供程序实现
provider
-供应商
type
-类型
params
-初始化参数(可能是
null
)
public final Collection<? extends Certificate> getCertificates(CertSelector selector) throws CertStoreException
Collection
,指定选择器匹配
Certificate
s。如果没有
Certificate
s选择器匹配,将返回空
Collection
。
对于一些CertStore
类型,由此产生的Collection
可能不包含全部的的Certificate
s选择器匹配。例如,一个LDAP CertStore
可能不在目录中搜索所有条目。相反,它可能只是搜索条目可能包含Certificate
s是寻找。
一些CertStore
实现(尤其是LDAP CertStore
s)可以把一个CertStoreException
除非提供一个非空的CertSelector
包含特定的标准,可以用来寻找证书。发行人和/或主题的名称是特别有用的标准。
selector
-
CertSelector
用来选择
Certificate
s应该归还。指定返回所有
Certificate
s
null
(如果支持的话)。
Collection
,指定选择器匹配
Certificate
s(不
null
)
CertStoreException
-如果发生异常
public final Collection<? extends CRL> getCRLs(CRLSelector selector) throws CertStoreException
Collection
,指定选择器匹配
CRL
s。如果没有
CRL
s选择器匹配,将返回空
Collection
。
对于一些CertStore
类型,由此产生的Collection
可能不包含的CRL
s选择器匹配的全部的。例如,一个LDAP CertStore
可能不在目录中搜索所有条目。相反,它可能只是搜索条目可能包含CRL
s是寻找。
一些CertStore
实现(尤其是LDAP CertStore
s)可以把一个CertStoreException
除非非空CRLSelector
提供包括具体的标准,可以用来寻找CRL。发行人的名称和/或要检查的证书是特别有用的。
selector
-
CRLSelector
用来选择
CRL
s应该归还。指定返回所有
CRL
s
null
(如果支持的话)。
Collection
,指定选择器匹配
CRL
s(不
null
)
CertStoreException
-如果发生异常
public static CertStore getInstance(String type, CertStoreParameters params) throws InvalidAlgorithmParameterException, NoSuchAlgorithmException
CertStore
类型与指定的参数初始化
CertStore
对象。
该方法通过注册安全提供商列表,从最开始的首选供应商。一个新的certstore对象封装certstorespi实施支持指定类型的第一个提供程序返回。
注意,注册商的列表可以通过Security.getProviders()
检索方法。
的CertStore
,返回与指定的CertStoreParameters
初始化。所需的参数类型可能不同CertStore
s之间变化。注意,指定的CertStoreParameters
对象克隆。
type
-要求的
CertStore
类型的名称。看到有关标准类型的信息在
Java Cryptography Architecture Standard Algorithm Name Documentation的certstore节。
params
-初始化参数(可能是
null
)。
CertStore
型
CertStore
对象。
NoSuchAlgorithmException
-如果没有供应商的支持为指定的类型certstorespi实施。
InvalidAlgorithmParameterException
-如果指定初始化参数,这是不合适的
CertStore
。
Provider
public static CertStore getInstance(String type, CertStoreParameters params, String provider) throws InvalidAlgorithmParameterException, NoSuchAlgorithmException, NoSuchProviderException
CertStore
对象实现指定的
CertStore
型。
一个新的certstore对象封装certstorespi实现从指定的提供程序返回。指定的提供程序必须在安全提供程序列表中注册。
注意,注册商的列表可以通过Security.getProviders()
检索方法。
的CertStore
,返回与指定的CertStoreParameters
初始化。所需的参数类型可能不同CertStore
s之间变化。注意,指定的CertStoreParameters
对象克隆。
type
-要求的
CertStore
型。看到有关标准类型的信息在
Java Cryptography Architecture Standard Algorithm Name Documentation的certstore节。
params
-初始化参数(可能是
null
)。
provider
-提供者的名称。
CertStore
指定类型的对象。
NoSuchAlgorithmException
-如果一个指定类型的certstorespi执行不可从指定的供应商。
InvalidAlgorithmParameterException
-如果指定初始化参数,这是不合适的
CertStore
。
NoSuchProviderException
-如果指定的供应商不在安全提供商注册名单。
IllegalArgumentException
-如果
provider
是null或空。
Provider
public static CertStore getInstance(String type, CertStoreParameters params, Provider provider) throws NoSuchAlgorithmException, InvalidAlgorithmParameterException
CertStore
型
CertStore
对象。
一个新的certstore对象封装certstorespi实现从指定的提供程序对象返回。请注意,指定的提供程序对象不必在提供者列表中注册。
的CertStore
,返回与指定的CertStoreParameters
初始化。所需的参数类型可能不同CertStore
s之间变化。注意,指定的CertStoreParameters
对象克隆。
type
-要求的
CertStore
型。看到有关标准类型的信息在
Java Cryptography Architecture Standard Algorithm Name Documentation的certstore节。
params
-初始化参数(可能是
null
)。
provider
-供应商。
CertStore
指定类型的对象。
NoSuchAlgorithmException
-如果一个指定类型的certstorespi执行不可从指定的提供程序对象。
InvalidAlgorithmParameterException
-如果指定初始化参数,这是不合适的
CertStore
IllegalArgumentException
-如果
provider
是空的。
Provider
public final CertStoreParameters getCertStoreParameters()
CertStore
参数。注意,是克隆之前返回的
CertStoreParameters
对象。
CertStore
(可能
null
)
public final String getType()
CertStore
类型。
CertStore
类型
public final Provider getProvider()
CertStore
提供者。
CertStore
提供者
public static final String getDefaultType()
CertStore
型的
certstore.type
安全属性中指定,或字符串“LDAP”如果没有这种属性的存在。
默认CertStore
型可以用,不想用一个硬编码的类型时,调用的getInstance
方法应用的使用,并要提供一个默认CertStore
型如果用户不指定自己的。
默认CertStore
型可以通过设置的certstore.type
安全属性的值为所需类型的改变。
CertStore
型的
certstore.type
安全属性中指定,或字符串“LDAP”如果没有这种属性的存在。
security properties
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.