Search in sources :

Example 1 with InvalidCertRequestException

use of edu.uiuc.ncsa.security.core.exceptions.InvalidCertRequestException in project OA4MP by ncsa.

the class PKCS10_CSR_Test method testBadCSR.

@Test
public void testBadCSR() throws Exception {
    try {
        MyPKCS10CertRequest certReq = CertUtil.fromStringToCertReq(BAD_GLOBUS_CR);
        System.out.println(certReq.getPublicKey());
        assert false : "Was able to process a bad cert request.";
    } catch (InvalidCertRequestException iox) {
        assert true;
    }
    try {
        MyPKCS10CertRequest certReq = CertUtil.fromStringToCertReq(GOOD_GLOBUS_CR);
        assert certReq.getPublicKey() != null;
    } catch (InvalidCertRequestException iox) {
        iox.printStackTrace();
        assert false : "Good cert request failed to parse correctly.";
    }
}
Also used : InvalidCertRequestException(edu.uiuc.ncsa.security.core.exceptions.InvalidCertRequestException) MyPKCS10CertRequest(edu.uiuc.ncsa.security.util.pkcs.MyPKCS10CertRequest) Test(org.junit.Test)

Aggregations

InvalidCertRequestException (edu.uiuc.ncsa.security.core.exceptions.InvalidCertRequestException)1 MyPKCS10CertRequest (edu.uiuc.ncsa.security.util.pkcs.MyPKCS10CertRequest)1 Test (org.junit.Test)1