Interface KeyLocator

All Superinterfaces:
Iterable<Key>
All Known Implementing Classes:
CompositeKeyLocator, HardcodedKeyLocator

public interface KeyLocator extends Iterable<Key>
This interface defines a method for obtaining a security key by ID.

If the KeyLocator implementor wants to make all its keys available for iteration, it should implement Iterable<T extends Key> interface. The base KeyLocator does not extend this interface to enable KeyLocators that do not support listing their keys.

Author:
Hynek Mlnařík
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static class 
    Helper class that facilitates the hash of a Key to be located easier.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns a key with a particular ID.
    default Key
    getKey(Key key)
    Method that checks if the key passed is inside the locator.
    default Key
    Returns the key in the locator that is represented by the KeyInfo dsig structure.
    void
    If this key locator caches keys in any way, forces this cache cleanup and refreshing the keys.

    Methods inherited from interface java.lang.Iterable

    forEach, iterator, spliterator
  • Method Details

    • getKey

      Key getKey(String kid) throws KeyManagementException
      Returns a key with a particular ID.
      Parameters:
      kid - Key ID
      Returns:
      key, which should be used for verify signature on given "input"
      Throws:
      KeyManagementException
    • getKey

      default Key getKey(Key key) throws KeyManagementException
      Method that checks if the key passed is inside the locator.
      Parameters:
      key - The key to search
      Returns:
      The same key or null if it's not in the locator
      Throws:
      KeyManagementException
    • getKey

      default Key getKey(KeyInfo info) throws KeyManagementException
      Returns the key in the locator that is represented by the KeyInfo dsig structure. The default implementation just iterates and returns the first KeyName, X509Data or PublicKey that is in the locator.
      Parameters:
      info - The KeyInfo to search
      Returns:
      The key found or null
      Throws:
      KeyManagementException
    • refreshKeyCache

      void refreshKeyCache()
      If this key locator caches keys in any way, forces this cache cleanup and refreshing the keys.