diff --git a/pgpainless-core/src/main/java/org/pgpainless/decryption_verification/MessageInspector.java b/pgpainless-core/src/main/java/org/pgpainless/decryption_verification/MessageInspector.java index e8b04afb..5883163a 100644 --- a/pgpainless-core/src/main/java/org/pgpainless/decryption_verification/MessageInspector.java +++ b/pgpainless-core/src/main/java/org/pgpainless/decryption_verification/MessageInspector.java @@ -4,6 +4,7 @@ package org.pgpainless.decryption_verification; +import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; @@ -69,6 +70,18 @@ public final class MessageInspector { } + /** + * Parses parts of the provided OpenPGP message in order to determine which keys were used to encrypt it. + * + * @param message OpenPGP message + * @return encryption info + * @throws PGPException + * @throws IOException + */ + public static EncryptionInfo determineEncryptionInfoForMessage(String message) throws PGPException, IOException { + return determineEncryptionInfoForMessage(new ByteArrayInputStream(message.getBytes("UTF-8"))); + } + /** * Parses parts of the provided OpenPGP message in order to determine which keys were used to encrypt it. * Note: This method does not rewind the passed in Stream, so you might need to take care of that yourselves.