/** * This is a convenience method for calling {@link #decryptDataToList(EncryptedData, boolean)}, * with the <code>rootInNewDocument</code> parameter value supplied by {@link #isRootInNewDocument()}. * * @param encryptedData encrypted data element containing the data to be decrypted * @return the list decrypted top-level XMLObjects * @throws DecryptionException exception indicating a decryption error, possibly because the decrypted data * contained DOM nodes other than type of Element */ public List<XMLObject> decryptDataToList(EncryptedData encryptedData) throws DecryptionException { return decryptDataToList(encryptedData, isRootInNewDocument()); }
/** * This is a convenience method for calling {@link #decryptDataToList(EncryptedData, boolean)}, * with the <code>rootInNewDocument</code> parameter value supplied by {@link #isRootInNewDocument()}. * * @param encryptedData encrypted data element containing the data to be decrypted * @return the list decrypted top-level XMLObjects * @throws DecryptionException exception indicating a decryption error, possibly because the decrypted data * contained DOM nodes other than type of Element */ public List<XMLObject> decryptDataToList(EncryptedData encryptedData) throws DecryptionException { return decryptDataToList(encryptedData, isRootInNewDocument()); }
/** * Decrypts the supplied EncryptedData and returns the resulting XMLObject. * * This will only succeed if the decrypted EncryptedData contains exactly one DOM Node of type Element. * * @param encryptedData encrypted data element containing the data to be decrypted * @param rootInNewDocument if true, root the underlying Element of the returned XMLObject in a new Document as * described in {@link Decrypter} * @return the decrypted XMLObject * @throws DecryptionException exception indicating a decryption error, possibly because the decrypted data * contained more than one top-level Element, or some non-Element Node type. */ public XMLObject decryptData(EncryptedData encryptedData, boolean rootInNewDocument) throws DecryptionException { List<XMLObject> xmlObjects = decryptDataToList(encryptedData, rootInNewDocument); if (xmlObjects.size() != 1) { log.error("The decrypted data contained more than one top-level XMLObject child"); throw new DecryptionException("The decrypted data contained more than one XMLObject child"); } return xmlObjects.get(0); }
/** * Decrypts the supplied EncryptedData and returns the resulting XMLObject. * * This will only succeed if the decrypted EncryptedData contains exactly one DOM Node of type Element. * * @param encryptedData encrypted data element containing the data to be decrypted * @param rootInNewDocument if true, root the underlying Element of the returned XMLObject in a new Document as * described in {@link Decrypter} * @return the decrypted XMLObject * @throws DecryptionException exception indicating a decryption error, possibly because the decrypted data * contained more than one top-level Element, or some non-Element Node type. */ public XMLObject decryptData(EncryptedData encryptedData, boolean rootInNewDocument) throws DecryptionException { List<XMLObject> xmlObjects = decryptDataToList(encryptedData, rootInNewDocument); if (xmlObjects.size() != 1) { log.error("The decrypted data contained more than one top-level XMLObject child"); throw new DecryptionException("The decrypted data contained more than one XMLObject child"); } return xmlObjects.get(0); }