registerRequestType.setId("806");
UseKeyWithType useKeyWithType = xKMSObjectFactory.createUseKeyWithType();
useKeyWithType.setApplication(XKMSConstants.USEKEYWITH_PKIX);
useKeyWithType.setIdentifier("CN=" + username);
registerRequestType.getRespondWith().add(XKMSConstants.RESPONDWITH_X509CERT);
PrototypeKeyBindingType prototypeKeyBindingType = xKMSObjectFactory.createPrototypeKeyBindingType();
prototypeKeyBindingType.getUseKeyWith().add(useKeyWithType);
prototypeKeyBindingType.setId("424242");
registerRequestType.setPrototypeKeyBinding(prototypeKeyBindingType);
byte[] first = XKMSUtil.getSecretKeyFromPassphrase("foo123", true, 20, XKMSUtil.KEY_REVOCATIONCODEIDENTIFIER_PASS1).getEncoded();
byte[] second = XKMSUtil.getSecretKeyFromPassphrase(new String(first, "ISO8859-1"), false, 20, XKMSUtil.KEY_REVOCATIONCODEIDENTIFIER_PASS2)
.getEncoded();
prototypeKeyBindingType.setRevocationCodeIdentifier(second);
RegisterResultType registerResultType = xKMSInvoker.register(registerRequestType, null, null, "foo123", null, prototypeKeyBindingType.getId());
assertTrue(registerResultType.getResultMajor().equals(XKMSConstants.RESULTMAJOR_SUCCESS));
// Get user's certificate
Collection<Certificate> userCerts = certificateStoreSession.findCertificatesByUsername(administrator, username);
assertTrue(userCerts.size() == 1);
Certificate cert = userCerts.iterator().next();