com.yahoo.vespa.security.tool.crypto.KeygenTool Maven / Gradle / Ivy
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.security.tool.crypto;
import com.yahoo.security.KeyUtils;
import com.yahoo.vespa.security.tool.CliUtils;
import com.yahoo.vespa.security.tool.Tool;
import com.yahoo.vespa.security.tool.ToolDescription;
import com.yahoo.vespa.security.tool.ToolInvocation;
import org.apache.commons.cli.Option;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.attribute.PosixFilePermissions;
import java.security.interfaces.XECPrivateKey;
import java.security.interfaces.XECPublicKey;
import java.util.List;
/**
* Tooling to generate random X25519 key pairs.
*
* @author vekterli
*/
public class KeygenTool implements Tool {
static final String PRIVATE_OUT_FILE_OPTION = "private-out-file";
static final String PUBLIC_OUT_FILE_OPTION = "public-out-file";
static final String OVERWRITE_EXISTING_OPTION = "overwrite-existing";
private static final List