Class SymmetricKey

java.lang.Object
org.gcube.common.encryption.SymmetricKey

public final class SymmetricKey extends Object
Author:
Roberto Cirillo (ISTI - CNR), Lucio Lelii (ISTI - CNR), Luca Frosini (ISTI - CNR)
  • Method Details

    • getKey

      public static Key getKey() throws InvalidKeyException
      Gets the key for encryption/decryption
      Returns:
      the key
      Throws:
      InvalidKeyException - if the key is not available or is invalid
    • loadKeyFromFile

      public static Key loadKeyFromFile(File keyFile, String keyAlgorithm) throws InvalidKeyException
      Loads a key from the specified file using the given algorithm
      Parameters:
      keyFile - the file containing the key
      keyAlgorithm - the algorithm of the key
      Returns:
      the loaded key
      Throws:
      InvalidKeyException - if the key cannot be loaded
    • getKeyFileName

      protected static String getKeyFileName(String context) throws InvalidKeyException
      Gets the key file name for the given context
      Parameters:
      context - the context to generate the key file name for
      Returns:
      the key file name
      Throws:
      InvalidKeyException - if the context is invalid