mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-11-17 18:02:05 +01:00
Add SignatureSubpacketsUtil.getRegularExpressions()
This commit is contained in:
parent
82cea93e7b
commit
90626a8a76
1 changed files with 18 additions and 0 deletions
|
@ -23,6 +23,7 @@ import org.bouncycastle.bcpg.sig.KeyFlags;
|
|||
import org.bouncycastle.bcpg.sig.NotationData;
|
||||
import org.bouncycastle.bcpg.sig.PreferredAlgorithms;
|
||||
import org.bouncycastle.bcpg.sig.PrimaryUserID;
|
||||
import org.bouncycastle.bcpg.sig.RegularExpression;
|
||||
import org.bouncycastle.bcpg.sig.Revocable;
|
||||
import org.bouncycastle.bcpg.sig.RevocationKey;
|
||||
import org.bouncycastle.bcpg.sig.RevocationReason;
|
||||
|
@ -540,6 +541,23 @@ public final class SignatureSubpacketsUtil {
|
|||
return hashed(signature, SignatureSubpacket.trustSignature);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all regular expression subpackets from the hashed area of the given signature.
|
||||
*
|
||||
* @param signature signature
|
||||
* @return list of regular expressions
|
||||
*/
|
||||
public static List<RegularExpression> getRegularExpressions(PGPSignature signature) {
|
||||
org.bouncycastle.bcpg.SignatureSubpacket[] subpackets = signature.getHashedSubPackets()
|
||||
.getSubpackets(SignatureSubpacket.regularExpression.getCode());
|
||||
List<RegularExpression> regularExpressions = new ArrayList<>(subpackets.length);
|
||||
for (org.bouncycastle.bcpg.SignatureSubpacket subpacket : subpackets) {
|
||||
regularExpressions.add((RegularExpression) subpacket);
|
||||
}
|
||||
return regularExpressions;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Select a list of all signature subpackets of the given type, which are present in the hashed area of
|
||||
* the given signature.
|
||||
|
|
Loading…
Reference in a new issue