Interface KeyIdentityProvider

    • Method Detail

      • loadKeys

        java.lang.Iterable<java.security.KeyPair> loadKeys​(SessionContext session)
                                                    throws java.io.IOException,
                                                           java.security.GeneralSecurityException
        Load available keys.
        Parameters:
        session - The SessionContext for invoking this load command - may be null if not invoked within a session context (e.g., offline tool or session unknown).
        Returns:
        an Iterable instance of available keys - ignored if null
        Throws:
        java.io.IOException - If failed to read/parse the keys data
        java.security.GeneralSecurityException - If failed to generate the keys
      • resolveKeyIdentityProvider

        static KeyIdentityProvider resolveKeyIdentityProvider​(KeyIdentityProvider identities,
                                                              KeyIdentityProvider keys)

        Creates a "unified" KeyIdentityProvider out of 2 possible ones as follows:


        • If both are null then return null.
        • If either one is null/empty then use the non-null one.
        • If both are the same instance then use the instance.
        • Otherwise, returns a wrapper that groups both providers.
        Parameters:
        identities - The registered key pair identities
        keys - The extra available key pairs
        Returns:
        The resolved provider
        See Also:
        multiProvider(KeyIdentityProvider...)
      • iterableOf

        static java.lang.Iterable<java.security.KeyPair> iterableOf​(SessionContext session,
                                                                    java.util.Collection<? extends KeyIdentityProvider> providers)
        Wraps a group of KeyIdentityProvider into an Iterable of KeyPairs
        Parameters:
        session - The SessionContext for invoking this load command - may be null if not invoked within a session context (e.g., offline tool or session unknown).
        providers - The group of providers - ignored if null/empty (i.e., returns an empty iterable instance)
        Returns:
        The wrapping iterable
      • wrapKeyPairs

        static KeyIdentityProvider wrapKeyPairs​(java.lang.Iterable<java.security.KeyPair> pairs)
        Wraps a group of KeyPairs into a KeyIdentityProvider
        Parameters:
        pairs - The key pairs Iterable - ignored if null (i.e., returns EMPTY_KEYS_PROVIDER).
        Returns:
        The provider wrapper
      • exhaustCurrentIdentities

        static java.security.KeyPair exhaustCurrentIdentities​(java.util.Iterator<java.security.KeyPair> ids)
        Attempts to find the first non-null KeyPair
        Parameters:
        ids - The Iterator - ignored if null or no next element available
        Returns:
        The first non-null key pair found in the iterator - null if all elements exhausted without such an entry