/** {@inheritDoc} */ public EncryptedKey next() { EncryptedKey tempKey; if (nextKey != null) { tempKey = nextKey; nextKey = null; return tempKey; } tempKey = getNextKey(); if (tempKey != null) { return tempKey; } else { throw new NoSuchElementException("No more EncryptedKey elements are available"); } }
/** * Get the next encrypted key that will be returned by this iterator. * * @return the next encrypted key to return */ private EncryptedKey getNextKey() { EncryptedKey tempKey; if (keyIterator != null) { while (keyIterator.hasNext()) { tempKey = keyIterator.next(); if (parent.matchRecipient(tempKey.getRecipient())) { log.debug("Found matching encrypted key: {}", tempKey.toString()); return tempKey; } } } keyIterator = getNextKeyIterator(); while (keyIterator != null) { while (keyIterator.hasNext()) { tempKey = keyIterator.next(); if (parent.matchRecipient(tempKey.getRecipient())) { log.debug("Found matching encrypted key: {}", tempKey.toString()); return tempKey; } } keyIterator = getNextKeyIterator(); } return null; }
/** * Get the next encrypted key that will be returned by this iterator. * * @return the next encrypted key to return */ private EncryptedKey getNextKey() { EncryptedKey tempKey; if (keyIterator != null) { while (keyIterator.hasNext()) { tempKey = keyIterator.next(); if (parent.matchRecipient(tempKey.getRecipient())) { log.debug("Found matching encrypted key: {}", tempKey.toString()); return tempKey; } } } keyIterator = getNextKeyIterator(); while (keyIterator != null) { while (keyIterator.hasNext()) { tempKey = keyIterator.next(); if (parent.matchRecipient(tempKey.getRecipient())) { log.debug("Found matching encrypted key: {}", tempKey.toString()); return tempKey; } } keyIterator = getNextKeyIterator(); } return null; }
/** {@inheritDoc} */ public EncryptedKey next() { EncryptedKey tempKey; if (nextKey != null) { tempKey = nextKey; nextKey = null; return tempKey; } tempKey = getNextKey(); if (tempKey != null) { return tempKey; } else { throw new NoSuchElementException("No more EncryptedKey elements are available"); } }
/** {@inheritDoc} */ public Iterator<EncryptedKey> iterator() { return new ChainingIterator(parent, encryptedData); }
/** * Constructor. * * @param resolver the ChainingEncryptedKeyResolver parent * @param encData the EncryptedData context for resolution */ public ChainingIterator(ChainingEncryptedKeyResolver resolver, EncryptedData encData) { parent = resolver; encryptedData = encData; resolverIterator = parent.getResolverChain().iterator(); keyIterator = getNextKeyIterator(); nextKey = null; }
/** * Constructor. * * @param resolver the ChainingEncryptedKeyResolver parent * @param encData the EncryptedData context for resolution */ public ChainingIterator(ChainingEncryptedKeyResolver resolver, EncryptedData encData) { parent = resolver; encryptedData = encData; resolverIterator = parent.getResolverChain().iterator(); keyIterator = getNextKeyIterator(); nextKey = null; }
/** {@inheritDoc} */ public boolean hasNext() { if (nextKey != null) { return true; } nextKey = getNextKey(); if (nextKey != null) { return true; } return false; }
/** {@inheritDoc} */ public Iterator<EncryptedKey> iterator() { return new ChainingIterator(parent, encryptedData); }
/** {@inheritDoc} */ public boolean hasNext() { if (nextKey != null) { return true; } nextKey = getNextKey(); if (nextKey != null) { return true; } return false; }