3
$\begingroup$

From my understanding of PGP keys they use the RSA algorithms to encrypt/decrypt messages. So, I know that the RSA algorithms use a semi-prime number to encrypt/decrypt messages. So, what I was wondering is: is the PGP key that you see the semi-prime number, and if so, how do you convert it back to the number.

This is my public key (I think):

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAABAgAGBQJXUCB7AAoJEKOAQvYH1iPaycIP/0e77u0QaquZD/J5njjnnwSk
+Y9byw0a3S9h556DZPBfF37Cn1vC5LEJSYK2u9nZyeUpWP8a/+P8f0eE7ViQNAJ4
leUq5k6+OS2luWylyTKzLQnBHHxlI+HS080eRV8Yo5izE8HOXHby1sgy4J70ne/3
zPrCMn0OyiCJGuGwIqlp72y1v5NscsCJkB87pKmcwVBx5sGNXqTneKHg2rfYgQrM
9JCCO9F5/Li0bWTmfYifxom1l39VdZcioCCZgCi9YV5+c1gOBWlAfqtDsKVEUv4L
z97PPSaelD2FbSlHTRV2+jkB4feSEACjCGFSMh/AIYJlZX/d2N/Z33q2AdnV6+Ud
t7STYjxmz3W+jiRjQsm3vwm8uCjpjujpPvDDw51SmqARqAzuuZg8NCK69R4jxg4T
DPEHpYWbscwIWl1F+vXD5IxAXtJNVCcOH7fzoh23faGhpX8gRAMsFbpAQAn0arbY
idaRkVE4pfBGieN0w1md5GaARYY8pUU+39D4OsXjXajcMTklhs3hYtbsATV4Z7WT
YD+0T2XXT9XAfGA/X6j7oqzZe35L2HYrVy/yOJrcvSho+gpn5V7HPhkGYGCYZQvr
VfA7iArY3OTVSJ2GNpMm9qaQVcoInV9aYaEYB7J2e8pkZjtMFr4lCe2aXCbhGMYk
ZHOMYG21JbwhtdPJdd/U =Y2jy
-----END PGP SIGNATURE-----

Sorry, if I am totally confused and actually know nothing.

$\endgroup$
2
$\begingroup$

The OpenPGP message you posted is a signature, not a key. As it was issued by GnuPG, I assume you're using GnuPG anyway. To export your public key, run gpg --armor --export [key-id]. --armor wraps the output in a base64-like encoding (like the signature block you provided in your question), otherwise you'll get binary output. If you don't know your key-id, you can look it up through gpg --list-keys, possibly followed by a search pattern on a user ID you added -- for example your mail address.

The public key also contains user IDs, certifications, subkeys, ... and can be rather lengthy. The beginning of my own public key export:

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

mQQNBFDaK/sBIADm2gjnw7aPoNIoCy7gj85btwZU+zGkvtGonznlLrXELdU6zR3u
VHNCn9vAl6OoU32r+suFvGdX+7MjiPbGKwJFOvICpAVh6bV55+hdqJbS02cpPmJH
1BrrUAmm6ZVEybGd+II1pTI6Mt/SAI1E/59VIBdC/1AwsxQtCTFeyaLqTdyd1FhQ
chkjcvdRHLb4cEqldAGqBL7SbiSNOP3p+vX8iwRN6PQ/erAGseawHnunuNIna+tA
t4te/MkI2uxT0KjsfF/NWHCB2aXt++egP8jGSaHRsVOlfHRVA3hHcUDlnW9DZRvG
QabHFcZvfcXAlNIRYKUzDIHEwpavAmHeGNhc2GNmDcDRF56741grVLNQT58vxK5o
dBLlC8ANckvE5ymdIKVPm+t5q10kFOAATcnmDV0oBt+15vzI3f+88yCoY904UWdY
[...]

If you want to dump the RSA primes, use the pgpdump tool (not included with GnuPG and has to be installed separately, but should be available readily packaged for all relevant distributions). To print the primes, you can directly pipe GnuPG's --export output into pgpdump (consider storing the output to a file or piping intoless`, as the output can get really long):

gpg --export[key-id] | pgpdump -i

To understand the output of pgpdump (and the structure of OpenPGP messages), read RFC 4880.

$\endgroup$

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.