use of io.kamax.mxisd.exception.BadRequestException in project mxisd by kamax-io.
the class KeyController method getKey.
@RequestMapping(value = "/pubkey/{keyType}:{keyId}", method = GET)
public String getKey(@PathVariable String keyType, @PathVariable int keyId) {
if (!"ed25519".contentEquals(keyType)) {
throw new BadRequestException("Invalid algorithm: " + keyType);
}
log.info("Key {}:{} was requested", keyType, keyId);
JsonObject obj = new JsonObject();
obj.addProperty("public_key", keyMgr.getPublicKeyBase64(keyId));
return gson.toJson(obj);
}
Aggregations