Class ProductKeyChain

java.lang.Object
gov.usgs.earthquake.distribution.ProductKeyChain

public class ProductKeyChain extends Object
A group of keys that can be used to verify product signatures.
  • Constructor Details

    • ProductKeyChain

      public ProductKeyChain()
      Empty constructor
    • ProductKeyChain

      public ProductKeyChain(String keys, Config config) throws Exception
      Constructor for a string of keys
      Parameters:
      keys - String of keys, separated by commas
      config - Config file
      Throws:
      Exception - if error occurs
    • ProductKeyChain

      public ProductKeyChain(List<String> keys, Config config) throws Exception
      Constructor for list of keys
      Parameters:
      keys - String list of keys
      config - Config file
      Throws:
      Exception - if error occurs
  • Method Details

    • fromFile

      public static ProductKeyChain fromFile(File keychainFile, String propertyStart) throws Exception
      Static constructor to create from a file
      Parameters:
      keychainFile - File to use
      propertyStart - The property to look for the keychain from
      Throws:
      Exception - if error occurs
    • fromIniFile

      protected static ProductKeyChain fromIniFile(File keychainFile, String propertyStart) throws Exception
      Static constructor create from an ini file
      Parameters:
      keychainFile - File to use
      propertyStart - The property to look for the keychain from
      Throws:
      IOException - if the file does not exist
      Exception - if error occurs
    • fromYmlFile

      protected static ProductKeyChain fromYmlFile(File keychainFile, String propertyStart) throws Exception
      Static constructor create from an yml file
      Parameters:
      keychainFile - File to use
      propertyStart - The property to look for the keychain from
      Throws:
      IOException - if the file does not exist
      Exception - if error occurs
    • getKeychain

      public List<ProductKey> getKeychain()
      Returns:
      the keys
    • getProductKeys

      public PublicKey[] getProductKeys(ProductId id)
      Find public keys based on configured Keys.
      Parameters:
      id - ID of product
      Returns:
      an array of candidate keys used to verify a signature.