PKCS10CertificationRequest pkcs10 = null;
ErrorCode errorCode = null;
// ///// Check Error.LOGIN_ERROR ///////
keys = KeyTools.genKeys("1024", AlgorithmConstants.KEYALGORITHM_RSA);
pkcs10 = new PKCS10CertificationRequest("SHA1WithRSA", CertTools.stringToBcX509Name("CN=WSTESTUSER30"), keys.getPublic(), new DERSet(), keys
.getPrivate());
try {
ejbcaraws.pkcs10Request("WSTESTUSER30", "foo123", new String(Base64.encode(pkcs10.getEncoded())), null, CertificateHelper.RESPONSETYPE_CERTIFICATE);
} catch (EjbcaException_Exception e) {
errorCode = e.getFaultInfo().getErrorCode();
}
assertNotNull("error code should not be null", errorCode);
assertEquals(errorCode.getInternalErrorCode(), org.ejbca.core.ErrorCode.LOGIN_ERROR.getInternalErrorCode());
errorCode = null;
// ///// Check Error.USER_WRONG_STATUS ///////
user1.setStatus(UserDataConstants.STATUS_REVOKED);
ejbcaraws.editUser(user1);
keys = KeyTools.genKeys("1024", AlgorithmConstants.KEYALGORITHM_RSA);
pkcs10 = new PKCS10CertificationRequest("SHA1WithRSA", CertTools.stringToBcX509Name("CN=WSTESTUSER30"), keys.getPublic(), new DERSet(), keys
.getPrivate());
try {
ejbcaraws
.pkcs10Request("WSTESTUSER30", "foo1234", new String(Base64.encode(pkcs10.getEncoded())), null, CertificateHelper.RESPONSETYPE_CERTIFICATE);