The libgcrypt rsa code is mostly visible at [1]https://dev.gnupg.org/source/libgcrypt/browse/master/cipher/rsa.c . (I had to work around some network issues reaching [2]git.gnupg.org, and found [3]dev.gnupg.org which works for me.) The operations of use start around line 909. Here's a link to that line: [4]https://dev.gnupg.org/source/libgcrypt/browse/master/cipher/rs a.c$909 This source can also be cloned at [5]https://dev.gnupg.org/source/libgcrypt.git . I've cloned it locally. The basic operations of use are public() and secret(). They basically just call out to mpi_powm, which is a wrapper for gcry_mpi_powm(). There's a #define in gcrypt.h, which is a different file generated from [6]gcrypt.h.in . Before moving off rsa.c, it's notable that: - public() basically just wraps mpi_powm, using the same structures - secret() has an additional step to remove leading zeros - secret() has a special form that might be used when p and q are known called secret_core_crt() - there's something else called secret_blinded() that is likely documented in a header file or elsewhere Basically, everything of interest is likely in mpi_powm. I'm taking it slower now, because complexity will increase as we get deeper. mpi_powm could look frighteningly new. References 1. https://dev.gnupg.org/source/libgcrypt/browse/master/cipher/rsa.c 2. http://git.gnupg.org/ 3. http://dev.gnupg.org/ 4. https://dev.gnupg.org/source/libgcrypt/browse/master/cipher/rsa.c$909 5. https://dev.gnupg.org/source/libgcrypt.git 6. http://gcrypt.h.in/