mirror of
https://github.com/pgpainless/pgpainless.git
synced 2025-12-10 22:31:09 +01:00
Add SignatureUtils.readSignatures(byte[])
This commit is contained in:
parent
1a274bf91b
commit
e19acb667c
2 changed files with 31 additions and 17 deletions
|
|
@ -217,14 +217,28 @@ public final class SignatureUtils {
|
|||
}
|
||||
|
||||
/**
|
||||
* Parse an ASCII encoded list of OpenPGP signatures into a {@link PGPSignatureList}.
|
||||
* Parse an ASCII encoded list of OpenPGP signatures into a {@link PGPSignatureList}
|
||||
* and return it as a {@link List}.
|
||||
*
|
||||
* @param encodedSignatures ASCII armored signature list
|
||||
* @return signature list
|
||||
* @throws IOException if the signatures cannot be read
|
||||
*/
|
||||
public static List<PGPSignature> readSignatures(String encodedSignatures) throws IOException, PGPException {
|
||||
InputStream inputStream = new ByteArrayInputStream(encodedSignatures.getBytes(Charset.forName("UTF8")));
|
||||
byte[] bytes = encodedSignatures.getBytes(Charset.forName("UTF8"));
|
||||
return readSignatures(bytes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read a single, or a list of {@link PGPSignature PGPSignatures} and return them as a {@link List}.
|
||||
*
|
||||
* @param encodedSignatures ASCII armored or binary signatures
|
||||
* @return signatures
|
||||
* @throws IOException if the signatures cannot be read
|
||||
* @throws PGPException in case of an OpenPGP error
|
||||
*/
|
||||
public static List<PGPSignature> readSignatures(byte[] encodedSignatures) throws IOException, PGPException {
|
||||
InputStream inputStream = new ByteArrayInputStream(encodedSignatures);
|
||||
return readSignatures(inputStream);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue