本文整理汇总了Java中java.security.cert.X509CRLSelector类的典型用法代码示例。如果您正苦于以下问题:Java X509CRLSelector类的具体用法?Java X509CRLSelector怎么用?Java X509CRLSelector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
X509CRLSelector类属于java.security.cert包,在下文中一共展示了X509CRLSelector类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getInstance
import java.security.cert.X509CRLSelector; //导入依赖的package包/类
/**
* Returns an instance of this from a <code>X509CRLSelector</code>.
*
* @param selector A <code>X509CRLSelector</code> instance.
* @return An instance of an <code>X509CRLStoreSelector</code>.
* @exception IllegalArgumentException if selector is null or creation
* fails.
*/
public static X509CRLStoreSelector getInstance(X509CRLSelector selector)
{
if (selector == null)
{
throw new IllegalArgumentException(
"cannot create from null selector");
}
X509CRLStoreSelector cs = new X509CRLStoreSelector();
cs.setCertificateChecking(selector.getCertificateChecking());
cs.setDateAndTime(selector.getDateAndTime());
try
{
cs.setIssuerNames(selector.getIssuerNames());
}
catch (IOException e)
{
// cannot happen
throw new IllegalArgumentException(e.getMessage());
}
cs.setIssuers(selector.getIssuers());
cs.setMaxCRLNumber(selector.getMaxCRL());
cs.setMinCRLNumber(selector.getMinCRL());
return cs;
}
示例2: test_addIssuerLjavax_security_auth_x500_X500Principal01
import java.security.cert.X509CRLSelector; //导入依赖的package包/类
/**
* @tests java.security.cert.X509CRLSelector#addIssuer(javax.security.auth.x500.X500Principal)
*/
@TestTargetNew(
level = TestLevel.PARTIAL_COMPLETE,
notes = "",
method = "addIssuer",
args = {javax.security.auth.x500.X500Principal.class}
)
public void test_addIssuerLjavax_security_auth_x500_X500Principal01()
throws Exception {
//Regression for HARMONY-465
X509CRLSelector obj = new X509CRLSelector();
try {
obj.addIssuer((X500Principal) null);
fail("NullPointerException expected");
} catch (NullPointerException e) {
// expected
}
}
示例3: X509CRLSelector
import java.security.cert.X509CRLSelector; //导入依赖的package包/类
/**
* @tests java.security.cert.X509CRLSelector#addIssuerName(byte[])
*/
@TestTargetNew(
level = TestLevel.PARTIAL_COMPLETE,
notes = "Verifies IOException.",
method = "addIssuerName",
args = {byte[].class}
)
public void test_addIssuerName$B_3() throws Exception {
//Regression for HARMONY-465
X509CRLSelector obj = new X509CRLSelector();
try {
obj.addIssuerName(new byte[] { (byte) 2, (byte) 3, (byte) 4 });
fail("IOException expected");
} catch (IOException e) {
// expected
}
}
示例4: test_setIssuerNamesLjava_util_Collection01
import java.security.cert.X509CRLSelector; //导入依赖的package包/类
/**
* @tests setIssuerNames(Collection <?> names)
*/
@TestTargetNew(
level = TestLevel.PARTIAL,
notes = "Regression test.",
method = "setIssuerNames",
args = {java.util.Collection.class}
)
public void test_setIssuerNamesLjava_util_Collection01() throws IOException {
// Regression for HARMONY-737
X509CRLSelector selector = new X509CRLSelector();
selector.setIssuerNames(new TreeSet<Comparable>() {
private static final long serialVersionUID = 6009545505321092498L;
public Iterator<Comparable> iterator() {
return null;
}
});
}
示例5: testX509CRLSelector
import java.security.cert.X509CRLSelector; //导入依赖的package包/类
/**
* constructor testing.
*
*/
@TestTargetNew(
level = TestLevel.COMPLETE,
notes = "",
method = "X509CRLSelector",
args = {}
)
public void testX509CRLSelector() {
X509CRLSelector selector = new X509CRLSelector();
assertNull(selector.getDateAndTime());
assertNull(selector.getCertificateChecking());
assertNull(selector.getIssuerNames());
assertNull(selector.getIssuers());
assertNull(selector.getMaxCRL());
assertNull(selector.getMinCRL());
}
示例6: testSetMinCRLNumberLjava_math_BigInteger
import java.security.cert.X509CRLSelector; //导入依赖的package包/类
/**
* setMinCRLNumber(BigInteger minCRL) method testing. Tests if CRLs with any
* crl number value match the selector in the case of null crlNumber
* criteria, if specified minCRL value matches the selector, and if CRL with
* inappropriate crlNumber value does not match the selector.
*/
@TestTargetNew(
level = TestLevel.COMPLETE,
notes = "",
method = "setMinCRLNumber",
args = {java.math.BigInteger.class}
)
@AndroidOnly("Uses specific class: " +
"org.apache.harmony.security.asn1.ASN1OctetString.")
public void testSetMinCRLNumberLjava_math_BigInteger() {
X509CRLSelector selector = new X509CRLSelector();
BigInteger minCRL = new BigInteger("10000");
CRL crl = new TestCRL(minCRL);
selector.setMinCRLNumber(null);
assertTrue("Any CRL should match in the case of null minCRLNumber.",
selector.match(crl));
selector.setMinCRLNumber(minCRL);
assertTrue("The CRL should match the selection criteria.", selector
.match(crl));
selector.setMinCRLNumber(new BigInteger("10001"));
assertFalse("The CRL should not match the selection criteria.",
selector.match(crl));
}
示例7: testSetMaxCRLNumberLjava_math_BigInteger
import java.security.cert.X509CRLSelector; //导入依赖的package包/类
/**
* setMaxCRLNumber(BigInteger maxCRL) method testing. Tests if CRLs with any
* crl number value match the selector in the case of null crlNumber
* criteria, if specified maxCRL value matches the selector, and if CRL with
* inappropriate crlNumber value does not match the selector.
*/
@TestTargetNew(
level = TestLevel.COMPLETE,
notes = "",
method = "setMaxCRLNumber",
args = {java.math.BigInteger.class}
)
@AndroidOnly("Uses specific class: " +
"org.apache.harmony.security.asn1.ASN1OctetString.")
public void testSetMaxCRLNumberLjava_math_BigInteger() {
X509CRLSelector selector = new X509CRLSelector();
BigInteger maxCRL = new BigInteger("10000");
TestCRL crl = new TestCRL(maxCRL);
selector.setMaxCRLNumber(null);
assertTrue("Any CRL should match in the case of null minCRLNumber.",
selector.match(crl));
selector.setMaxCRLNumber(maxCRL);
assertTrue("The CRL should match the selection criteria.", selector
.match(crl));
selector.setMaxCRLNumber(new BigInteger("9999"));
assertFalse("The CRL should not match the selection criteria.",
selector.match(crl));
}
示例8: testGetIssuers
import java.security.cert.X509CRLSelector; //导入依赖的package包/类
/**
* getIssuers() method testing. Tests if the method return null in the case
* of not specified issuers, if the returned collection corresponds to the
* specified issuers and this collection is unmodifiable.
*/
@TestTargetNew(
level = TestLevel.COMPLETE,
notes = "",
method = "getIssuers",
args = {}
)
public void testGetIssuers() {
X509CRLSelector selector = new X509CRLSelector();
X500Principal iss1 = new X500Principal("O=First Org.");
X500Principal iss2 = new X500Principal("O=Second Org.");
X500Principal iss3 = new X500Principal("O=Third Org.");
assertNull("The collection should be null.", selector.getIssuers());
selector.addIssuer(iss1);
selector.addIssuer(iss2);
Collection<X500Principal> result = selector.getIssuers();
try {
result.add(iss3);
fail("The returned collection should be unmodifiable.");
} catch (UnsupportedOperationException e) {
}
assertTrue("The collection should contain the specified DN.", result
.contains(iss2));
}
示例9: testGetDateAndTime
import java.security.cert.X509CRLSelector; //导入依赖的package包/类
/**
* getDateAndTime() method testing. Tests if the method return null in the
* case of not specified dateAndTime criteria, and if the returned value
* corresponds to the specified one.
*/
@TestTargetNew(
level = TestLevel.COMPLETE,
notes = "",
method = "getDateAndTime",
args = {}
)
public void testGetDateAndTime() {
X509CRLSelector selector = new X509CRLSelector();
assertNull("Initially the dateAndTime criteria should be null.",
selector.getDateAndTime());
Date date = new Date(200);
selector.setDateAndTime(date);
assertTrue("The result should be equal to specified.", date
.equals(selector.getDateAndTime()));
}
示例10: testGetCertificateCheckingLjava_X509Certificate
import java.security.cert.X509CRLSelector; //导入依赖的package包/类
/**
* getCertificateChecking() method testing.
*/
@TestTargetNew(
level = TestLevel.COMPLETE,
notes = "",
method = "getCertificateChecking",
args = {}
)
public void testGetCertificateCheckingLjava_X509Certificate()
throws CertificateException {
X509CRLSelector selector = new X509CRLSelector();
CertificateFactory certFact = CertificateFactory.getInstance("X509");
X509Certificate cert = (X509Certificate) certFact
.generateCertificate(new ByteArrayInputStream(TestUtils
.getX509Certificate_v3()));
selector.setCertificateChecking(cert);
assertEquals(cert, selector.getCertificateChecking());
selector.setCertificateChecking(null);
assertNull(selector.getCertificateChecking());
}
示例11: testToString
import java.security.cert.X509CRLSelector; //导入依赖的package包/类
@TestTargetNew(
level = TestLevel.COMPLETE,
notes = "",
method = "toString",
args = {}
)
public void testToString() {
X509CRLSelector selector = new X509CRLSelector();
X500Principal iss1 = new X500Principal("O=First Org.");
X500Principal iss2 = new X500Principal("O=Second Org.");
BigInteger minCRL = new BigInteger("10000");
BigInteger maxCRL = new BigInteger("10000");
Date date = new Date(200);
selector.addIssuer(iss1);
selector.addIssuer(iss2);
selector.setMinCRLNumber(minCRL);
selector.setMaxCRLNumber(maxCRL);
selector.setDateAndTime(date);
assertNotNull("The result should not be null.", selector.toString());
}
示例12: getInstance
import java.security.cert.X509CRLSelector; //导入依赖的package包/类
/**
* Returns an instance of this from a <code>X509CRLSelector</code>.
*
* @param selector A <code>X509CRLSelector</code> instance.
* @return An instance of an <code>X509CRLStoreSelector</code>.
* @exception IllegalArgumentException if selector is null or creation
* fails.
*/
public static X509CRLStoreSelector getInstance(X509CRLSelector selector)
{
if (selector == null)
{
throw new IllegalArgumentException(
"cannot create from null selector");
}
X509CRLStoreSelector cs = new X509CRLStoreSelector();
cs.setCertificateChecking(selector.getCertificateChecking());
cs.setDateAndTime(selector.getDateAndTime());
try
{
cs.setIssuerNames(selector.getIssuerNames());
}
catch (IOException e)
{
// cannot happen
throw new IllegalArgumentException(e.getMessage());
}
//cs.setIssuers(selector.getIssuers());
cs.setMaxCRLNumber(selector.getMaxCRL());
cs.setMinCRLNumber(selector.getMinCRL());
return cs;
}
示例13: findCRLs
import java.security.cert.X509CRLSelector; //导入依赖的package包/类
/**
* Return a Collection of all CRLs found in the
* CertStore's that are matching the crlSelect criteriums.
*
* @param certSelector a {@link CertSelector CertSelector}
* object that will be used to select the certificates
* @param certStores a List containing only {@link CertStore
* CertStore} objects. These are used to search for
* CRLs
*
* @return a Collection of all found {@link CRL CRL}
* objects. May be empty but never <code>null</code>.
*/
private Collection findCRLs(
X509CRLSelector crlSelect,
List crlStores)
throws AnnotatedException
{
Set crls = new HashSet();
Iterator iter = crlStores.iterator();
while (iter.hasNext())
{
CertStore certStore = (CertStore)iter.next();
try
{
crls.addAll(certStore.getCRLs(crlSelect));
}
catch (CertStoreException e)
{
throw new AnnotatedException("cannot extract crl: " + e, e);
}
}
return crls;
}
示例14: wrap
import java.security.cert.X509CRLSelector; //导入依赖的package包/类
@Override
public X509CRLSelector wrap(X509CRLSelector selector,
Collection<X500Principal> certIssuers,
String ldapDN)
throws IOException
{
throw new UnsupportedOperationException();
}
示例15: wrap
import java.security.cert.X509CRLSelector; //导入依赖的package包/类
@Override
public X509CRLSelector wrap(X509CRLSelector selector,
Collection<X500Principal> certIssuers,
String ldapDN)
throws IOException
{
return new LDAPCertStore.LDAPCRLSelector(selector, certIssuers, ldapDN);
}