Search in sources :

Example 31 with PolicyRequiredException

use of org.nhindirect.policy.PolicyRequiredException in project nhin-d by DirectProject.

the class SubjectKeyIdentifierExtensionField_injectReferenceValueTest method testInjectRefereneValue_keyIdDoesNotExist_required_assertException.

public void testInjectRefereneValue_keyIdDoesNotExist_required_assertException() throws Exception {
    final X509Certificate cert = TestUtils.loadCertificate("cernerDemosCaCert.der");
    final SubjectKeyIdentifierExtensionField field = new SubjectKeyIdentifierExtensionField(true);
    boolean exceptionOccured = false;
    try {
        field.injectReferenceValue(cert);
    } catch (PolicyRequiredException e) {
        exceptionOccured = true;
    }
    assertTrue(exceptionOccured);
}
Also used : PolicyRequiredException(org.nhindirect.policy.PolicyRequiredException) SubjectKeyIdentifierExtensionField(org.nhindirect.policy.x509.SubjectKeyIdentifierExtensionField) X509Certificate(java.security.cert.X509Certificate)

Aggregations

PolicyRequiredException (org.nhindirect.policy.PolicyRequiredException)31 X509Certificate (java.security.cert.X509Certificate)19 DERObject (org.bouncycastle.asn1.DERObject)12 ArrayList (java.util.ArrayList)7 PolicyExpression (org.nhindirect.policy.PolicyExpression)4 PolicyFilter (org.nhindirect.policy.PolicyFilter)3 KeyUsageExtensionField (org.nhindirect.policy.x509.KeyUsageExtensionField)3 InternetAddress (javax.mail.internet.InternetAddress)2 ASN1Sequence (org.bouncycastle.asn1.ASN1Sequence)2 DEREncodable (org.bouncycastle.asn1.DEREncodable)2 DERObjectIdentifier (org.bouncycastle.asn1.DERObjectIdentifier)2 AccessDescription (org.bouncycastle.asn1.x509.AccessDescription)2 AuthorityInformationAccess (org.bouncycastle.asn1.x509.AuthorityInformationAccess)2 GeneralName (org.bouncycastle.asn1.x509.GeneralName)2 GeneralNames (org.bouncycastle.asn1.x509.GeneralNames)2 PolicyInformation (org.bouncycastle.asn1.x509.PolicyInformation)2 PolicyProcessException (org.nhindirect.policy.PolicyProcessException)2 PolicyResolver (org.nhindirect.stagent.policy.PolicyResolver)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 File (java.io.File)1