private void updateUserCredentials( TolvenPerson tolvenPerson, char[] userPassword, String base64UserPKCS12) { if (userPassword == null) { throw new RuntimeException( "A base64UserPKCS12 has been supplied without the accompanying user password"); } byte[] userPKCS12Bytes = null; try { userPKCS12Bytes = Base64.decodeBase64(base64UserPKCS12.getBytes("UTF-8")); } catch (Exception ex) { throw new RuntimeException("Could not convert base64UserPKCS12 to bytes", ex); } KeyStore userPKCS12KeyStore = CertificateHelper.getKeyStore(userPKCS12Bytes, userPassword); byte[] certBytes = CertificateHelper.getX509CertificateByteArray(userPKCS12KeyStore); tolvenPerson.setAttributeValue("userPKCS12", userPKCS12Bytes); tolvenPerson.setAttributeValue("userCertificate", certBytes); }