From cc1d76b1618c3b48318a27f852c64f4020e1329d Mon Sep 17 00:00:00 2001 From: Tamas Cservenak Date: Sat, 23 Mar 2024 19:53:39 +0100 Subject: [PATCH] [MGPG-114] Allow max key size of 16KB This insanely huge key size is mentioned as some extreme example on page https://wiki.gnupg.org/LargeKeys --- https://issues.apache.org/jira/browse/MGPG-114 --- src/main/java/org/apache/maven/plugins/gpg/BcSigner.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/apache/maven/plugins/gpg/BcSigner.java b/src/main/java/org/apache/maven/plugins/gpg/BcSigner.java index 6a0fc2a..f53ad09 100644 --- a/src/main/java/org/apache/maven/plugins/gpg/BcSigner.java +++ b/src/main/java/org/apache/maven/plugins/gpg/BcSigner.java @@ -123,7 +123,7 @@ public final class GpgConfLoader implements Loader { /** * Maximum key size, see Large Keys. */ - private static final long MAX_SIZE = 5 * 1024 + 1L; + private static final long MAX_SIZE = 16 * 1024 + 1L; @Override public byte[] loadKeyRingMaterial(RepositorySystemSession session) throws IOException { @@ -137,7 +137,7 @@ public byte[] loadKeyRingMaterial(RepositorySystemSession session) throws IOExce if (Files.size(keyPath) < MAX_SIZE) { return Files.readAllBytes(keyPath); } else { - throw new IOException("Refusing to load key " + keyPath + "; is larger than 5KB"); + throw new IOException("Refusing to load key " + keyPath + "; is larger than 16KB"); } } return null;