Class KeyStoreGenerator


  • public final class KeyStoreGenerator
    extends java.lang.Object
    Generates a keystore file that has a SecretKey in it. It is not possible to use keytool to achieve this. This is a simple way to generate a JCEKS format keystore and SecretKey. Usage is --alg ALGNAME --size ALGSIZE --storeName FILENAME --storePass PASSWORD --alias KEYALIAS Any of args are optional and will default to
    • ALGNAME = Blowfish
    • ALGSIZE = 56
    • FILENAME = defaultStore.keystore
    • PASSWORD = changeit
    • ALIAS = mykey
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) static java.lang.String alias  
      (package private) static int keySize  
      (package private) static java.lang.String keyStoreName  
      (package private) static java.lang.String storePass  
      (package private) static java.lang.String storeType  
      (package private) static java.lang.String symAlg  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private KeyStoreGenerator()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static javax.crypto.SecretKey createSecretKey()  
      static javax.crypto.SecretKey createSecretKey​(java.lang.String sym_alg, int key_size)  
      private static java.lang.String getAlgorithm​(java.lang.String s)  
      protected static void help()  
      static void main​(java.lang.String[] args)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • symAlg

        static java.lang.String symAlg
      • keySize

        static int keySize
      • keyStoreName

        static java.lang.String keyStoreName
      • storePass

        static java.lang.String storePass
      • alias

        static java.lang.String alias
      • storeType

        static java.lang.String storeType
    • Constructor Detail

      • KeyStoreGenerator

        private KeyStoreGenerator()
    • Method Detail

      • main

        public static void main​(java.lang.String[] args)
      • help

        protected static void help()
      • createSecretKey

        public static javax.crypto.SecretKey createSecretKey()
                                                      throws java.lang.Exception
        Throws:
        java.lang.Exception
      • createSecretKey

        public static javax.crypto.SecretKey createSecretKey​(java.lang.String sym_alg,
                                                             int key_size)
                                                      throws java.security.NoSuchAlgorithmException
        Throws:
        java.security.NoSuchAlgorithmException
      • getAlgorithm

        private static java.lang.String getAlgorithm​(java.lang.String s)