mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-11-14 00:12:06 +01:00
Remove superfluous states
This commit is contained in:
parent
4533e419f1
commit
585f693545
2 changed files with 3 additions and 27 deletions
|
@ -67,7 +67,7 @@ public class PDA {
|
|||
|
||||
case Signature:
|
||||
if (stackItem == ops) {
|
||||
return CorrespondingSignature;
|
||||
return LiteralMessage;
|
||||
} else {
|
||||
throw new MalformedOpenPgpMessageException(this, input, stackItem);
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ public class PDA {
|
|||
switch (input) {
|
||||
case Signature:
|
||||
if (stackItem == ops) {
|
||||
return CorrespondingSignature;
|
||||
return CompressedMessage;
|
||||
} else {
|
||||
throw new MalformedOpenPgpMessageException(this, input, stackItem);
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ public class PDA {
|
|||
switch (input) {
|
||||
case Signature:
|
||||
if (stackItem == ops) {
|
||||
return CorrespondingSignature;
|
||||
return EncryptedMessage;
|
||||
} else {
|
||||
throw new MalformedOpenPgpMessageException(this, input, stackItem);
|
||||
}
|
||||
|
@ -147,26 +147,6 @@ public class PDA {
|
|||
}
|
||||
},
|
||||
|
||||
CorrespondingSignature {
|
||||
@Override
|
||||
State transition(InputAlphabet input, PDA automaton) throws MalformedOpenPgpMessageException {
|
||||
StackAlphabet stackItem = automaton.popStack();
|
||||
if (input == InputAlphabet.EndOfSequence) {
|
||||
if (stackItem == terminus && automaton.stack.isEmpty()) {
|
||||
return Valid;
|
||||
} else {
|
||||
// premature end of stream
|
||||
throw new MalformedOpenPgpMessageException(this, input, stackItem);
|
||||
}
|
||||
} else if (input == InputAlphabet.Signature) {
|
||||
if (stackItem == ops) {
|
||||
return CorrespondingSignature;
|
||||
}
|
||||
}
|
||||
throw new MalformedOpenPgpMessageException(this, input, stackItem);
|
||||
}
|
||||
},
|
||||
|
||||
Valid {
|
||||
@Override
|
||||
State transition(InputAlphabet input, PDA automaton) throws MalformedOpenPgpMessageException {
|
||||
|
|
|
@ -13,10 +13,6 @@ public enum StackAlphabet {
|
|||
* OnePassSignature (in case of BC this represents a OnePassSignatureList).
|
||||
*/
|
||||
ops,
|
||||
/**
|
||||
* ESK. Not used, as BC combines encrypted data with their encrypted session keys.
|
||||
*/
|
||||
esk,
|
||||
/**
|
||||
* Special symbol representing the end of the message.
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue