It is a choice of the designers of PGP to stick to Fermat test. There are some nice talk since 1994
The quote from the last;
The Carmichael Numbers
Unfortunately, there are some numbers which are not prime and which do satisfy the equation $b^{n-1} \bmod n$. These integers are known as the Carmichael Numbers, and they are quite rare. The reason for this is that a Carmichael Number must not be divisable by the square of any prime and must be the product of at least three primes). The first three Carmichael Numbers are: 561, 1105, and 1729. They are so rare, in fact, there are only 255 of them less than $10^9$. The chance of PGP generating a Carmichael Number is less than 1 in $10^{50}$.
So, even there are other alternatives to Fermat Test, they still use it.
Here the oeis/A002997 for the Carmichael numbers;
- 561, 1105, 1729, 2465, 2821, 6601, 8911, 10585, 15841, 29341, 41041, 46657, 52633, 62745, 63973, 75361, 101101, 115921, 126217, 162401, 172081, 188461, 252601, 278545, 294409, 314821, 334153, 340561, 399001, 410041, 449065, 488881, 512461
If it hits a Carmichael number then it will factor into smaller primes like $512461 =31 \cdot 61 \cdot 271$. But it can still work as a normal RSA and fool us.
Once a fast probable prime obtained then one can use proof methods instead of AKS. We may consider this as modern sieving.
If you want to use the AKS then use the faster variant of AKS test. And note that AKS is a slow and deterministic primality-proving algorithm. Here a quote from DanaJ's great answer in Math.SE Fastest way to find if a given number is prime
Anyone who suggests actually using AKS in practice has never actually run it on numbers larger than 10,000 and should be ignored.
do a faster Fermat test
, but when that test passes it's further performed a Miller-Rabin test. That logic also applies in libgcrypt-1.9.2 possibly used by some version of GPG 2. $\endgroup$