public String createCredential(String gatewayId, String tokenId,
String username) throws RegistryException {
credentialWriter = new SSHCredentialWriter(getDBConnector());
credentialGenerator = new SSHCredentialGenerator();
try {
SSHCredential credential = credentialGenerator.generateCredential(tokenId);
if (credential!=null) {
credential.setGateway(gatewayId);
credential.setToken(tokenId);
credential.setPortalUserName(username);
credentialWriter.writeCredentials(credential);
return new String(credential.getPublicKey());
}
} catch (CredentialStoreException e) {
return null;
}
return null;