mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-12-27 05:17:59 +01:00
Add support for RegularExpression subpackets (fixes #246)
This commit is contained in:
parent
7710845454
commit
e4bccaf58d
3 changed files with 35 additions and 1 deletions
|
@ -17,6 +17,7 @@ import org.bouncycastle.bcpg.sig.IssuerFingerprint;
|
|||
import org.bouncycastle.bcpg.sig.IssuerKeyID;
|
||||
import org.bouncycastle.bcpg.sig.NotationData;
|
||||
import org.bouncycastle.bcpg.sig.PolicyURI;
|
||||
import org.bouncycastle.bcpg.sig.RegularExpression;
|
||||
import org.bouncycastle.bcpg.sig.Revocable;
|
||||
import org.bouncycastle.bcpg.sig.SignatureCreationTime;
|
||||
import org.bouncycastle.bcpg.sig.SignatureExpirationTime;
|
||||
|
@ -96,6 +97,12 @@ public interface BaseSignatureSubpackets {
|
|||
|
||||
BaseSignatureSubpackets setPolicyUrl(@Nullable PolicyURI policyUrl);
|
||||
|
||||
BaseSignatureSubpackets setRegularExpression(@Nonnull String regex);
|
||||
|
||||
BaseSignatureSubpackets setRegularExpression(boolean isCritical, @Nonnull String regex);
|
||||
|
||||
BaseSignatureSubpackets setRegularExpression(@Nullable RegularExpression regex);
|
||||
|
||||
BaseSignatureSubpackets setRevocable(boolean revocable);
|
||||
|
||||
BaseSignatureSubpackets setRevocable(boolean isCritical, boolean isRevocable);
|
||||
|
|
|
@ -30,6 +30,7 @@ import org.bouncycastle.bcpg.sig.NotationData;
|
|||
import org.bouncycastle.bcpg.sig.PolicyURI;
|
||||
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;
|
||||
|
@ -72,6 +73,7 @@ public class SignatureSubpackets
|
|||
private KeyExpirationTime keyExpirationTime;
|
||||
private PolicyURI policyURI;
|
||||
private PrimaryUserID primaryUserId;
|
||||
private RegularExpression regularExpression;
|
||||
private Revocable revocable;
|
||||
private RevocationReason revocationReason;
|
||||
private final List<SignatureSubpacket> residualSubpackets = new ArrayList<>();
|
||||
|
@ -508,6 +510,26 @@ public class SignatureSubpackets
|
|||
return policyURI;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseSignatureSubpackets setRegularExpression(@Nonnull String regex) {
|
||||
return setRegularExpression(false, regex);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseSignatureSubpackets setRegularExpression(boolean isCritical, @Nonnull String regex) {
|
||||
return setRegularExpression(new RegularExpression(isCritical, regex));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseSignatureSubpackets setRegularExpression(@Nullable RegularExpression regex) {
|
||||
this.regularExpression = regex;
|
||||
return this;
|
||||
}
|
||||
|
||||
public RegularExpression getRegularExpression() {
|
||||
return regularExpression;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SignatureSubpackets setRevocable(boolean revocable) {
|
||||
return setRevocable(true, revocable);
|
||||
|
|
|
@ -15,6 +15,7 @@ import org.bouncycastle.bcpg.sig.NotationData;
|
|||
import org.bouncycastle.bcpg.sig.PolicyURI;
|
||||
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;
|
||||
|
@ -119,8 +120,11 @@ public class SignatureSubpacketsHelper {
|
|||
PolicyURI policyURI = (PolicyURI) subpacket;
|
||||
subpackets.setPolicyUrl(policyURI);
|
||||
break;
|
||||
|
||||
case regularExpression:
|
||||
RegularExpression regex = (RegularExpression) subpacket;
|
||||
subpackets.setRegularExpression(regex);
|
||||
break;
|
||||
|
||||
case keyServerPreferences:
|
||||
case preferredKeyServers:
|
||||
case placeholder:
|
||||
|
@ -140,6 +144,7 @@ public class SignatureSubpacketsHelper {
|
|||
addSubpacket(generator, subpackets.getSignatureExpirationTimeSubpacket());
|
||||
addSubpacket(generator, subpackets.getExportableSubpacket());
|
||||
addSubpacket(generator, subpackets.getPolicyURI());
|
||||
addSubpacket(generator, subpackets.getRegularExpression());
|
||||
for (NotationData notationData : subpackets.getNotationDataSubpackets()) {
|
||||
addSubpacket(generator, notationData);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue