mirror of
https://github.com/pgpainless/pgpainless.git
synced 2025-09-09 18:29:39 +02:00
Replace consumeAsBytes(XXX) with consumeRemainingAsBytes()
This commit is contained in:
parent
adf9fc4639
commit
5939b747b0
6 changed files with 7 additions and 6 deletions
|
@ -22,7 +22,7 @@ public class AsciiArmorFuzzTest {
|
||||||
maxDuration = "60s"
|
maxDuration = "60s"
|
||||||
)
|
)
|
||||||
public void armorAndDearmorData(FuzzedDataProvider data) throws IOException {
|
public void armorAndDearmorData(FuzzedDataProvider data) throws IOException {
|
||||||
byte[] bytes = data.consumeBytes(1024);
|
byte[] bytes = data.consumeRemainingAsBytes();
|
||||||
|
|
||||||
byte[] armored = sop.armor().data(bytes).getBytes();
|
byte[] armored = sop.armor().data(bytes).getBytes();
|
||||||
if (Arrays.areEqual(bytes, armored)) {
|
if (Arrays.areEqual(bytes, armored)) {
|
||||||
|
|
|
@ -10,6 +10,7 @@ import org.bouncycastle.util.encoders.Hex;
|
||||||
import org.bouncycastle.util.io.Streams;
|
import org.bouncycastle.util.io.Streams;
|
||||||
import org.junit.jupiter.api.BeforeAll;
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.pgpainless.exception.MissingDecryptionMethodException;
|
||||||
import org.pgpainless.exception.ModificationDetectionException;
|
import org.pgpainless.exception.ModificationDetectionException;
|
||||||
import org.pgpainless.sop.SOPImpl;
|
import org.pgpainless.sop.SOPImpl;
|
||||||
import sop.SOP;
|
import sop.SOP;
|
||||||
|
@ -75,7 +76,7 @@ public class EncryptedMessageFuzzingTest {
|
||||||
maxDuration = "60s"
|
maxDuration = "60s"
|
||||||
)
|
)
|
||||||
public void decryptFuzzedMessage(FuzzedDataProvider provider) {
|
public void decryptFuzzedMessage(FuzzedDataProvider provider) {
|
||||||
byte[] ciphertext = provider.consumeBytes(8192);
|
byte[] ciphertext = provider.consumeRemainingAsBytes();
|
||||||
if (ciphertext.length == 0) {
|
if (ciphertext.length == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ public class ParseCertFuzzTest {
|
||||||
|
|
||||||
@FuzzTest(maxDuration = "30s")
|
@FuzzTest(maxDuration = "30s")
|
||||||
public void parseOpenPGPCert(FuzzedDataProvider data) throws IOException {
|
public void parseOpenPGPCert(FuzzedDataProvider data) throws IOException {
|
||||||
byte[] certEncoding = data.consumeBytes(8192);
|
byte[] certEncoding = data.consumeRemainingAsBytes();
|
||||||
if (certEncoding.length == 0) {
|
if (certEncoding.length == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ public class PublicKeyPacketFuzzTest {
|
||||||
@FuzzTest(maxDuration = "30m")
|
@FuzzTest(maxDuration = "30m")
|
||||||
public void parsePublicKeyPacket(FuzzedDataProvider provider)
|
public void parsePublicKeyPacket(FuzzedDataProvider provider)
|
||||||
{
|
{
|
||||||
byte[] encoding = provider.consumeBytes(8192);
|
byte[] encoding = provider.consumeRemainingAsBytes();
|
||||||
if (encoding.length == 0) {
|
if (encoding.length == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ public class SecretKeyPacketFuzzTest {
|
||||||
@FuzzTest(maxDuration = "30m")
|
@FuzzTest(maxDuration = "30m")
|
||||||
public void parseSecretKeyPacket(FuzzedDataProvider provider)
|
public void parseSecretKeyPacket(FuzzedDataProvider provider)
|
||||||
{
|
{
|
||||||
byte[] encoding = provider.consumeBytes(8192);
|
byte[] encoding = provider.consumeRemainingAsBytes();
|
||||||
if (encoding.length == 0) {
|
if (encoding.length == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -273,7 +273,7 @@ public class SignatureFuzzTest {
|
||||||
maxDuration = "60s"
|
maxDuration = "60s"
|
||||||
)
|
)
|
||||||
public void verifyFuzzedSig(FuzzedDataProvider provider) throws IOException {
|
public void verifyFuzzedSig(FuzzedDataProvider provider) throws IOException {
|
||||||
byte[] sig = provider.consumeBytes(1024);
|
byte[] sig = provider.consumeRemainingAsBytes();
|
||||||
if (sig.length == 0) {
|
if (sig.length == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue