RSAKeyPairGenerator.primeDistanceOk

private bool primeDistanceOk(BigInt p, BigInt q, int bitLength) static

Validates the distance between the two primes.

Implements the FIPS 186-5 guard against Fermat factorization: the primes must differ and their absolute difference must exceed 2^(bitLength/2 - 100), so the modulus cannot be split by searching near its square root.

Parameters

bitLengthThe requested modulus length in bits.

Returns

True when the pair is safe to use.