Class SecretKeyService
- java.lang.Object
-
- org.codehaus.mojo.keytool.services.SecretKeyService
-
@Named @Singleton public class SecretKeyService extends java.lang.ObjectService for secret key operations using Java KeyStore API.
-
-
Field Summary
Fields Modifier and Type Field Description private static org.slf4j.Loggerlog
-
Constructor Summary
Constructors Constructor Description SecretKeyService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidgenerateSecretKey(java.io.File keystore, java.lang.String storetype, java.lang.String storepass, java.lang.String alias, java.lang.String keyalg, java.lang.String keysize, java.lang.String keypass)Generates a secret key and stores it in the keystore.private java.security.KeyStoreloadOrCreateKeyStore(java.io.File keystoreFile, java.lang.String storeType, char[] storePassword)Loads an existing keystore or creates a new one.private voidsaveKeyStore(java.security.KeyStore ks, java.io.File keystoreFile, char[] storePassword)Saves the keystore to file.
-
-
-
Method Detail
-
generateSecretKey
public void generateSecretKey(java.io.File keystore, java.lang.String storetype, java.lang.String storepass, java.lang.String alias, java.lang.String keyalg, java.lang.String keysize, java.lang.String keypass) throws org.apache.maven.plugin.MojoExecutionExceptionGenerates a secret key and stores it in the keystore.- Parameters:
keystore- keystore locationstoretype- keystore type (defaults to KeyStore.getDefaultType() if null)storepass- keystore passwordalias- key aliaskeyalg- key algorithm (e.g., "AES", "DES", "DESede")keysize- key size in bits (e.g., "128", "256")keypass- key password (defaults to storepass if null)- Throws:
org.apache.maven.plugin.MojoExecutionException- if operation fails
-
loadOrCreateKeyStore
private java.security.KeyStore loadOrCreateKeyStore(java.io.File keystoreFile, java.lang.String storeType, char[] storePassword) throws java.lang.ExceptionLoads an existing keystore or creates a new one.- Throws:
java.lang.Exception
-
saveKeyStore
private void saveKeyStore(java.security.KeyStore ks, java.io.File keystoreFile, char[] storePassword) throws java.lang.ExceptionSaves the keystore to file.- Throws:
java.lang.Exception
-
-