Java安全:证书存储与加密解密技术详解
1. 证书存储相关
在处理证书存储时,类型参数代表存储库类型的名称,例如LDAP或Java集合的Collection。每个存储库类型都有特定的 CertStoreParameters
。可以使用以下方法检索用于初始化 CertStore
的参数:
public final CertStoreParameters getCertStoreParameters()
为了从 CertStore
中检索证书和证书撤销列表(CRLs),引入了选择器的概念。选择器定义了用于选择一组证书或CRLs的标准。以下方法用于选择并返回一组证书或CRLs:
public final Collection getCertificates(CertSelector selector)
throws CertStoreException
public final Collection getCRLs(CRLSelector selector)
throws CertStoreException
每个方法都返回其相应对象的集合。选择器接口都定义了一个名为 match
的方法,该方法接受一个证书或CRL,如果指定的对象符合某些标准,则返回 true
,否则返回 false
。安全库中提供了这些接口的具体实