Skip to content

Commit 5218813

Browse files
committed
SecretKeyPacket: Rethrow IllegalArgumentException for unknown AEAD algorithm
1 parent bc6a827 commit 5218813

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

pg/src/main/java/org/bouncycastle/bcpg/SecretKeyPacket.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,14 @@ public class SecretKeyPacket
199199
}
200200
if (s2kUsage == USAGE_AEAD)
201201
{
202-
iv = new byte[AEADUtils.getIVLength(aeadAlgorithm)];
202+
try
203+
{
204+
iv = new byte[AEADUtils.getIVLength(aeadAlgorithm)];
205+
}
206+
catch (IllegalArgumentException e)
207+
{
208+
throw new MalformedPacketException("Unknown AEAD algorithm", e);
209+
}
203210
Streams.readFully(in, iv);
204211
}
205212
else

0 commit comments

Comments
 (0)