net.adamcin.httpsig.api
Class DefaultKeychain
java.lang.Object
net.adamcin.httpsig.api.DefaultKeychain
- All Implemented Interfaces:
- Iterable<Key>, Collection<Key>, Keychain
public class DefaultKeychain
- extends Object
- implements Keychain, Collection<Key>
Simple implementation of Keychain backed by a HashMap and
modified via Collection methods
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DefaultKeychain
public DefaultKeychain()
DefaultKeychain
public DefaultKeychain(Collection<? extends Key> identities)
getAlgorithms
public Set<Algorithm> getAlgorithms()
- Specified by:
getAlgorithms in interface Keychain
- Returns:
- a
Set containing the union of all algorithms supported by each Key in this Keychain
size
public int size()
- Specified by:
size in interface Collection<Key>
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty in interface Collection<Key>- Specified by:
isEmpty in interface Keychain
- Returns:
- true if this
Keychain has no more keys
contains
public boolean contains(Object o)
- Specified by:
contains in interface Collection<Key>
iterator
public Iterator<Key> iterator()
- Specified by:
iterator in interface Iterable<Key>- Specified by:
iterator in interface Collection<Key>
toArray
public Object[] toArray()
- Specified by:
toArray in interface Collection<Key>
toArray
public <T> T[] toArray(T[] a)
- Specified by:
toArray in interface Collection<Key>
add
public boolean add(Key key)
- Specified by:
add in interface Collection<Key>
remove
public boolean remove(Object o)
- Specified by:
remove in interface Collection<Key>
containsAll
public boolean containsAll(Collection<?> c)
- Specified by:
containsAll in interface Collection<Key>
addAll
public boolean addAll(Collection<? extends Key> c)
- Specified by:
addAll in interface Collection<Key>
removeAll
public boolean removeAll(Collection<?> c)
- Specified by:
removeAll in interface Collection<Key>
retainAll
public boolean retainAll(Collection<?> c)
- Specified by:
retainAll in interface Collection<Key>
clear
public void clear()
- Specified by:
clear in interface Collection<Key>
discard
public Keychain discard()
- Specified by:
discard in interface Keychain
- Returns:
- a reference to a
Keychain which excludes the current Key.
currentKey
public Key currentKey()
- Specified by:
currentKey in interface Keychain
- Returns:
-
- Throws:
NoSuchElementException - if the keychain is empty
filterAlgorithms
public Keychain filterAlgorithms(Collection<Algorithm> algorithms)
- Description copied from interface:
Keychain
- Filter this keychain by a
Collection of supported Algorithms
- Specified by:
filterAlgorithms in interface Keychain
- Returns:
- a new
Keychain containing only those keys which support at least one of the provided algorithms
toMap
public Map<String,Key> toMap(KeyId keyIdentifier)
- Specified by:
toMap in interface Keychain
- Returns:
- a
Map where the values are the Keys and the map entry keys are the keyId's generated by the KeyId, o
Copyright © 2013-2014. All Rights Reserved.