Some questions regarding generating RSA keys

Albin Otterhäll gnu at otterhall.com
Tue May 16 09:36:16 CEST 2017


Hi!

I'm currently doing a high school project by studying RSA keys for
better understanding them theoretically and practically. A part of the
project consist of an experiment, and I choose to test and see how big
the workload will be for the CPU when generating RSA keys of different
length. I would also like to save the time as a data point, if I need to
come to an conclusion.

The plan is to use GnuPG to generate RSA keys of different length (1024,
2048, and 4096) and GNU Time to get the CPU's workload and the time to
execute the process. The process will be automated with a python script.
The process will be in something like this:

1. For length in [1024, 2048, 4096]:
  1.1. For X times:
    1.1.1. Execute Gnu PG command and monitor system resources
    1.1.2. Write use of system resources to file

I will thereafter plot some graphs to see if my hypothesis is correct.

But I got some questions regarding the implementation of my GnuPG test.
An explanation of how my implementation will come after the questions.
My questions are:

* Does this settings do what I want to do?
* Can I someway disable the automatic creation of revoke certificates?
* Why does it take much longer to generate some keys?
* Why does GnuPG give the answer that the it took 0 CPU-seconds in
userspace for the creation of the keys? Is it done in another process?
* Why does the CPU workload parameter only show a value (0 < CPU) when
it took less than a second (wall clock > 1) for creating the keys?

Reading the manual it seems that the simplest way to generate the keys
is with the `--batch` option turned on. I've set the options in a file
with the following instructions:

========== Begin GnuPG Instruction File ==========
# Text syntax in this file
#%dry-run

%echo Generating RSA key...

# Don't ask after passphrase
%no-protection

Key-type: RSA
Key-Length: 1024
Name-Real: Real Name
Name-Email: user at localhost.se
Expire-Date: 0

# Generate RSA key
%commit

%echo Done!
========== End GnuPG Instruction File ==========

The command that executes this file has two parts, the Gnu Time part and
the GnuPG part. The GNU Time command is looking as follows:

$ time --format="Wall clock: %e[s], CPU (userspace): %U[s], CPU
(workload): %P%"

And the GnuPG command is the following.

$ gpg2 --gen-key --homedir=./rsa-keys --batch [filename]

The command that I execute in my shell (fish shell if it's important) is
the following (GNU Time + GnuPG):

$ time --format="Wall clock: %e[s], CPU (userspace): %U[s], CPU
(workload): %P%" gpg2 --gen-key --homedir=./rsa-keys --batch [filename]

Output from command:

Wall clock: 36.83[s], CPU (userspace): 0.00[s], CPU (workload): 0%%
Wall clock: 0.04[s], CPU (userspace): 0.00[s], CPU (workload): 8%%
Wall clock: 4.76[s], CPU (userspace): 0.00[s], CPU (workload): 0%%
Wall clock: 72.39[s], CPU (userspace): 0.00[s], CPU (workload): 0%%
Wall clock: 57.52[s], CPU (userspace): 0.00[s], CPU (workload): 0%%
Wall clock: 84.71[s], CPU (userspace): 0.00[s], CPU (workload): 0%%
Wall clock: 63.32[s], CPU (userspace): 0.00[s], CPU (workload): 0%%
Wall clock: 51.10[s], CPU (userspace): 0.00[s], CPU (workload): 0%%
Wall clock: 47.58[s], CPU (userspace): 0.00[s], CPU (workload): 0%%
Wall clock: 64.72[s], CPU (userspace): 0.00[s], CPU (workload): 0%%
Wall clock: 0.05[s], CPU (userspace): 0.00[s], CPU (workload): 6%%
Wall clock: 0.03[s], CPU (userspace): 0.00[s], CPU (workload): 11%%
Wall clock: 29.62[s], CPU (userspace): 0.00[s], CPU (workload): 0%%
Wall clock: 55.02[s], CPU (userspace): 0.00[s], CPU (workload): 0%%
Wall clock: 36.08[s], CPU (userspace): 0.00[s], CPU (workload): 0%%
Wall clock: 42.92[s], CPU (userspace): 0.00[s], CPU (workload): 0%%
Wall clock: 40.41[s], CPU (userspace): 0.00[s], CPU (workload): 0%%
Wall clock: 204.36[s], CPU (userspace): 0.00[s], CPU (workload): 0%%
Wall clock: 246.42[s], CPU (userspace): 0.00[s], CPU (workload): 0%%
Wall clock: 51.50[s], CPU (userspace): 0.00[s], CPU (workload): 0%%

Thanks in advance!

Regards,
Albin



More information about the Gnupg-users mailing list