All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.ncredinburgh.tomcat.command.ListKeyGeneratorsCommand Maven / Gradle / Ivy

The newest version!
package com.github.ncredinburgh.tomcat.command;

import java.security.Provider;
import java.security.Security;
import java.util.Queue;

class ListKeyGeneratorsCommand implements Command {
	private static final String COMMAND_KEY = "listKeyGenerators";
	private static final String COMMAND_USAGE= COMMAND_KEY;

	@Override
	public String getCommandKey() {
		return COMMAND_KEY;
	}

	@Override
	public void doCommand(Options options, Queue arguments) {
		// No arguments to process
		listKeyGenerators();
	}

	@Override
	public String getUsage() {
		return COMMAND_USAGE;
	}

	private void listKeyGenerators() {
		for (Provider provider : Security.getProviders()) {
			for (Provider.Service service : provider.getServices()) {
				if (service.getType().equals("KeyGenerator")) {
					System.out.println("Provider: " + provider.getName() + "  Algorithm: " + service.getAlgorithm());
				}
			}
		}
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy