1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2024-11-23 04:42:06 +01:00

Add MessageInspector.determineEncryptionInfo(String)

This commit is contained in:
Paul Schaub 2021-10-27 15:54:34 +02:00
parent abdc5c8fdd
commit aed06fc832
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311

View file

@ -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.