peass-ng/PEASS-ng · error · ArgumentException
invalid parameters passed to GCM
Error message
invalid parameters passed to GCM
What it means
A fallback branch in GcmBlockCipher.Init: the supplied cipher parameters object was neither AeadParameters nor ParametersWithIV, so the cipher cannot obtain a nonce or key. It fires when callers pass e.g. a raw KeyParameter instead of wrapping it in ParametersWithIV/AeadParameters.
Source
Thrown at winPEAS/winPEASexe/winPEAS/3rdParty/BouncyCastle/crypto/modes/GcmBlockCipher.cs:123
{
throw new ArgumentException("Invalid value for MAC size: " + macSizeBits);
}
macSize = macSizeBits / 8;
keyParam = param.Key;
}
else if (parameters is ParametersWithIV)
{
ParametersWithIV param = (ParametersWithIV)parameters;
newNonce = param.GetIV();
initialAssociatedText = null;
macSize = 16;
keyParam = (KeyParameter)param.Parameters;
}
else
{
throw new ArgumentException("invalid parameters passed to GCM");
}
int bufLength = forEncryption ? BlockSize : (BlockSize + macSize);
this.bufBlock = new byte[bufLength];
if (newNonce == null || newNonce.Length < 1)
{
throw new ArgumentException("IV must be at least 1 byte");
}
if (forEncryption)
{
if (nonce != null && Arrays.AreEqual(nonce, newNonce))
{
if (keyParam == null)
{
throw new ArgumentException("cannot reuse nonce for GCM encryption");
}View on GitHub (pinned to 53fb989abc)
Solutions
- Wrap the key: new ParametersWithIV(keyParameter, iv) or new AeadParameters(keyParameter, macSize, iv)
- Ensure the IV is generated/passed at Init time (GCM is stateful and requires a fresh nonce per encryption)
- Check for accidentally passing null or a KeyParameter directly to Init
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at winPEAS/winPEASexe/winPEAS/3rdParty/BouncyCastle/crypto/modes/GcmBlockCipher.cs:123 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of peass-ng/PEASS-ng@53fb989abc (2026-09-02).
Data as JSON: /api/errors/3f03305e868d166b.
Report an issue: GitHub.