CryptoUtil cryptoUtil = CryptoUtil.getDefaultCryptoUtil();
Resource resource = registry.newResource();
resource.addProperty(SecurityConstants.PROP_PASSWORD, cryptoUtil
.encryptAndBase64Encode(password.getBytes()));
resource.addProperty(SecurityConstants.PROP_PROVIDER, provider);
resource.addProperty(SecurityConstants.PROP_TYPE, type);
if (pvtKeyAlias != null) {
resource.addProperty(SecurityConstants.PROP_PRIVATE_KEY_ALIAS, pvtKeyAlias);
resource.addProperty(SecurityConstants.PROP_PRIVATE_KEY_PASS, cryptoUtil