Search in sources :

Example 1 with AuthorityKeyIdentifierKeyIdExtensionField

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

the class AuthorityKeyIdentifierKeyIdExtensionField_injectReferenceValueTest method testInjectRefereneValue_keyIdDoesNotExist_notRequired_assertValue0.

public void testInjectRefereneValue_keyIdDoesNotExist_notRequired_assertValue0() throws Exception {
    final X509Certificate cert = TestUtils.loadCertificate("cernerDemosCaCert.der");
    final AuthorityKeyIdentifierKeyIdExtensionField field = new AuthorityKeyIdentifierKeyIdExtensionField(false);
    field.injectReferenceValue(cert);
    assertEquals("", field.getPolicyValue().getPolicyValue());
}
Also used : AuthorityKeyIdentifierKeyIdExtensionField(org.nhindirect.policy.x509.AuthorityKeyIdentifierKeyIdExtensionField) X509Certificate(java.security.cert.X509Certificate)

Example 2 with AuthorityKeyIdentifierKeyIdExtensionField

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

the class AuthorityKeyIdentifierKeyIdExtensionField_injectReferenceValueTest method testInjectRefereneValue_keyIdDoesNotExist_required_assertException.

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

Example 3 with AuthorityKeyIdentifierKeyIdExtensionField

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

the class AuthorityKeyIdentifierKeyIdExtensionField_injectReferenceValueTest method testInjectRefereneValue_keyIdExists_assertValue.

public void testInjectRefereneValue_keyIdExists_assertValue() throws Exception {
    final X509Certificate cert = TestUtils.loadCertificate("AlAnderson@hospitalA.direct.visionshareinc.com.der");
    final AuthorityKeyIdentifierKeyIdExtensionField field = new AuthorityKeyIdentifierKeyIdExtensionField(false);
    field.injectReferenceValue(cert);
    assertEquals("3aa0074b77b2493efb447de5ce6cd055085de3f0", field.getPolicyValue().getPolicyValue());
}
Also used : AuthorityKeyIdentifierKeyIdExtensionField(org.nhindirect.policy.x509.AuthorityKeyIdentifierKeyIdExtensionField) X509Certificate(java.security.cert.X509Certificate)

Example 4 with AuthorityKeyIdentifierKeyIdExtensionField

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

the class AuthorityKeyIdentifierKeyIdExtensionField_injectReferenceValueTest method testInjectRefereneValue_noInjection_getPolicyValue_assertException.

public void testInjectRefereneValue_noInjection_getPolicyValue_assertException() throws Exception {
    final AuthorityKeyIdentifierKeyIdExtensionField field = new AuthorityKeyIdentifierKeyIdExtensionField(true);
    boolean exceptionOccured = false;
    try {
        field.getPolicyValue();
    } catch (IllegalStateException e) {
        exceptionOccured = true;
    }
    assertTrue(exceptionOccured);
}
Also used : AuthorityKeyIdentifierKeyIdExtensionField(org.nhindirect.policy.x509.AuthorityKeyIdentifierKeyIdExtensionField)

Aggregations

AuthorityKeyIdentifierKeyIdExtensionField (org.nhindirect.policy.x509.AuthorityKeyIdentifierKeyIdExtensionField)4 X509Certificate (java.security.cert.X509Certificate)3 PolicyRequiredException (org.nhindirect.policy.PolicyRequiredException)1