public CreateKeyPairResponseType createKeyPair(CreateKeyPairType createKeyPairRequestMsg)
throws RemoteException {
final String keyName = createKeyPairRequestMsg.getKeyName();
final KeyPair keyPair;
try {
keyPair = keyManager.generateKey(keyName, containerInterface.getCaller());
} catch (AuthorizationException e) {
logger.error("Error generating keypair",e);
throw new RemoteException("You do not have authorization to generate a keypair");
} catch (OperationDisabledException e) {
logger.error("Error generating keypair",e);
throw new RemoteException("Key generation is not supported");
} catch (KeyExistsException e) {
logger.error("Error generating keypair",e);
throw new RemoteException("A keypair named '"+keyName+"' already exists");
}
return new CreateKeyPairResponseType(
keyPair.getFingerprint(),
keyPair.getPrivateKey(),
keyName, ""); // TODO do something real with requestId
}