5

We are new to using GPG and we have a very strange issue with decryption speed when using RSA keypairs, which are generated by using different tools (GPG for Windows, DidiSoft OpenPGP Library for .NET and SecureBlackbox).

So we have 3 RSA public/private key pairs that have the same properties (hash/compression algo, ciphers) and key size of 2048 bits and we got the following results:

100 decryption operations for each private/public keys:

  1. RSA keys generated by GPG for Windows:

    DidiSoft: 90 ms/1 decryption
    SecureBlackbox: ~420 ms/1 decryption

  2. RSA keys generated by DidiSoft lib:

    DidiSoft: 38 ms/1 decryption
    SecureBlackbox: 40 ms/1 decryption

  3. RSA keys generated by SecureBlackbox lib:

    DidiSoft: 39 ms/1 decryption
    SecureBlackbox: 39 ms/1 decryption

All the tests are using the same C# code with just the file name changed to switch public/private keys. Why is there so big difference in the execution time and what might be the cause?

Passphrase: qwerty

-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v2

mQENBFYP1skBCAC3CoaV+MiROdkvH6Ilcq/eXXV8ckteyp+urhKqCyyPRuKVcdb9
nIuC79b7xqrfx+SNWFiD2WVPtoD2NelPHe15mQjImKyYhBN9z79PiijtXHHB6hH6
Z6wkXyWUzLXAsySUKdFQc2lr+7vcVD/Oc4rUUuIYqpyTlZxiLlT3h73ta9S1wwJn
Q+6iPPd88Mc7cEUysghGmFDLmAIXSjwTxPSG234QDKyNFK4X8fP7BQ2Yp9v3yG81
zWeKFG0fOQgVa4ReWjq/OwC+WoirDFuwY610nrxjEO5HwSaniHEjSRcTbSGN8AmS
dOv9mjakQ1a0U/wFIUBOT9/DRQVgI8T56UW5ABEBAAG0KWdwZ3dpbmRvd3N0ZXN0
IDxncGd3aW5kb3dzdGVzdEBlbWFpbC5jb20+iQE5BBMBAgAjBQJWD9bJAhsDBwsJ
CAcDAgEGFQgCCQoLBBYCAwECHgECF4AACgkQT+WOTX/34l3ZzAf+LsiTeFHxdHDj
p+rokuitS6HL98gVAiLwx7wj901MGbvOJL6aUtt1KGffpqZuRisPB6ATK5qT+YUU
I2uu5az6ISDxLYbKGpoiWdLPK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yvWKZ6
E94ry9ZLQeMWgDeuIxG8U1roVVJ2fdiSfpsPtItM0Y1H9ARrRjiD4swXq2CgUua5
WF3v3ljR5CK9ELdrsMUjadMfTBdG2E0jkvkpUrFcBB1CiLeBSautc3b2XYMwpl1z
ZFMpkoyZBYA5d8585S8yHBtr0D/E+qXcvfUscXCj5wjmasJ/4eYyji3pmLKMjfub
bqJNCmk1GtY7ip82wElxqwzrkAlzNOYeZkNK7MPBlVimwpdXJ3GMg31xx616NSqz
eMNFdlBg/Uyvi6OV1wyqzYNfI6kbfj/TkKGM
=1WOu
-----END PGP PRIVATE KEY BLOCK-----
  • What was the data you tried to decrypt ? Was it constant or random ? Did you try generating other pairs of keys ? – Nate Sep 30 '15 at 18:39
  • For getting an idea what's going on, would you be fine with posting the private keys and an encrypted message for each of those? It seems you generated testing keys anyway. – Jens Erat Sep 30 '15 at 19:40
  • @FrancoisRenaud-Philippon the data was random 2048 bytes. Yes I tried different pairs of keys – Nikola Tesla Sep 30 '15 at 20:12
  • @FrancoisRenaud-Philippon I generated 100 random arrays of bytes, encrypted them and then tried decrypting the data by using those two C# libs and each pair of keys – Nikola Tesla Sep 30 '15 at 20:20
  • 1
    I suggest you contact Eldos support and ask them directly. In my experience, they are quite responsive. – Stephane Oct 1 '15 at 8:35
3

For those who are not familiar with OpenPGP, I have to first clarify that the RSA key (and algorithm) has a limited time performance impact over decryption speed, because the OpenPGP archive format looks like this:

session key-RSA encrypted || data encrypted with a symmetric algorithm (e.g. AES) by the session key

So, basically the speed depends (especially over large amounts of data) on which symmetric algorithm was used for encrypting the input data. Interesting part of OpenPGP is that the keys may contain symmetric algorithm preferences inside, and the encryption process may take them into account when the data was packed.

Having in mind the above paragraph, the data encrypted with the GPG RSA key may have been encrypted with different symmetric algorithm, than the key from DidiSoft OpenPGP Library for .NET and Eldos. In order to test keys equally, you will have to specify explicitly the symmetric encryption algorithm, or make sure that all keys have only one and the same preferred symmetric cipher key preference.

  • By the way, the key pair from your post has AES-256 as the default symmetric cipher. – Peter Kalef ' DidiSoft Oct 31 '15 at 20:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.