Package net.shibboleth.shared.security.impl

# Class BasicKeystoreKeyStrategyTool

java.lang.Object
net.shibboleth.shared.security.impl.BasicKeystoreKeyStrategyTool

public class BasicKeystoreKeyStrategyTool extends Object
Implements a tool for managing secret keys in accordance with the `BasicKeystoreKeyStrategy`.

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`private static class`
`BasicKeystoreKeyStrategyTool.CommandLineArgs`
Manages command line parsing for application and the bean properties used by the tool.
`static class`
`BasicKeystoreKeyStrategyTool.FileConverter`
Command line option conversion from String to File.

## Field Summary

Fields
Modifier and Type
Field
Description
`private final BasicKeystoreKeyStrategyTool.CommandLineArgs`
`args`
Container for options that can be parsed from a command line.
`private org.slf4j.Logger`
`log`
Class logger.

## Constructor Summary

Constructors
Constructor
Description
`BasicKeystoreKeyStrategyTool()`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`void`
`changeKey()`
The main routine.
`static void`
`main(String[] args)`
Command line entry point.
`void`
`setKeyAlias(String alias)`
Set the encryption key alias base name.
`void`
`setKeyCount(int count)`
Set the number of keys to maintain.
`void`
`setKeySize(int size)`
Set the size of the generated key.
`void`
`setKeystoreFile(File file)`
Set the keystore file to create or modify.
`void`
`setKeystorePassword(String password)`
Set the password for the keystore.
`void`
`setKeystoreType(String type)`
Set the type of keystore to create.
`void`
`setKeyType(String type)`
Set the type of key that will be generated.
`void`
`setVersionFile(File file)`
Set the key versioning file to create or modify.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### log

@Nonnull private org.slf4j.Logger log
Class logger.

### args

@Nonnull private final BasicKeystoreKeyStrategyTool.CommandLineArgs args
Container for options that can be parsed from a command line.

## Constructor Details

### BasicKeystoreKeyStrategyTool

public BasicKeystoreKeyStrategyTool()
Constructor.

## Method Details

### setKeyType

public void setKeyType(@Nonnull @NotEmpty String type)
Set the type of key that will be generated. Defaults to AES.

Parameters:
  `type` - type of key that will be generated

### setKeySize

public void setKeySize(@Positive int size)
Set the size of the generated key. Defaults to 128

Parameters:
  `size` - size of the generated key

### setKeyAlias

public void setKeyAlias(@Nonnull @NotEmpty String alias)
Set the encryption key alias base name.

Parameters:
  `alias` - the encryption key alias base

### setKeyCount

public void setKeyCount(@Positive int count)
Set the number of keys to maintain. Defaults to 30.

Parameters:
  `count` - number of keys to maintain

### setKeystoreType

public void setKeystoreType(@Nonnull @NotEmpty String type)
Set the type of keystore to create. Defaults to JCEKS.

Parameters:
  `type` - keystore type

### setKeystoreFile

public void setKeystoreFile(@Nonnull File file)
Set the keystore file to create or modify.

Parameters:
  `file` - keystore file

### setKeystorePassword

public void setKeystorePassword(@Nullable String password)
Set the password for the keystore.

Parameters:
  `password` - password for the keystore

### setVersionFile

public void setVersionFile(@Nonnull File file)
Set the key versioning file to create or modify.

Parameters:
  `file` - key versioning file

### changeKey

public void changeKey() throws Exception
The main routine.

Throws:
  `Exception` - if an error occurs

### main

public static void main(@Nonnull String[] args) throws Exception
Command line entry point.

Parameters:
  `args` - command line arguments
Throws:
  `Exception` - if something goes wrong