use of com.walmartlabs.concord.server.org.secret.SecretManager.DecryptedKeyPair in project concord by walmartlabs.
the class SecretResource method createKeyPair.
private PublicKeyResponse createKeyPair(UUID orgId, UUID projectId, String name, String storePassword, SecretVisibility visibility, MultipartInput input, String storeType) throws IOException {
DecryptedKeyPair k;
InputStream publicKey = MultipartUtils.getStream(input, Constants.Multipart.PUBLIC);
if (publicKey != null) {
InputStream privateKey = MultipartUtils.assertStream(input, Constants.Multipart.PRIVATE);
try {
k = secretManager.createKeyPair(orgId, projectId, name, storePassword, publicKey, privateKey, visibility, storeType);
} catch (IllegalArgumentException e) {
throw new ValidationErrorsException(e.getMessage());
}
} else {
k = secretManager.createKeyPair(orgId, projectId, name, storePassword, visibility, storeType);
}
return new PublicKeyResponse(k.getId(), OperationResult.CREATED, storePassword, new String(k.getData()));
}
Aggregations