Begin pgp public key block
Author: f | 2025-04-24
-BEGIN PGP PUBLIC KEY BLOCK-BEGIN PGP PUBLIC KEY BLOCK-mDMEZgx0fBYJKwYBBAHaRw8BAQdAv8SlPxaZAT7rf579GcWyQo8zPoaMSnqKvC -BEGIN PGP PUBLIC KEY BLOCK-BEGIN PGP PUBLIC KEY BLOCK-mDMEZgx0fBYJKwYBBAHaRw8BAQdAv8SlPxaZAT7rf579GcWyQo8zPoaMSnqKvC
BEGIN PGP PUBLIC KEY BLOCK
Only you can read, or for 2FA purposes. The next task therefore is to export the public key so you can start sharing it.In the certificates screen of Kleopatra (the default screen when you open the application), right click on the name of the key you just created and you will be presented with the following options:Select 'Export' then when prompted, save the file to your preferred location (you can rename it if you wish). By default the file type should be shown as 'OpenPGP Certificates'. This file can be opened up in a text editor such as Notepad or Leafpad and should look something like this:A public PGP will always begin with:-----BEGIN PGP PUBLIC KEY BLOCK-----and end with:-----END PGP PUBLIC KEY BLOCK-----If you need to make a backup of your private key to import to a different software application or another system, this can be done by selecting 'Backup Secret Keys' instead of export. These will look very similar to public keys but will start and end with the word 'PRIVATE' instead of 'PUBLIC'.Importing someone else's public key and encrypting a messageSo you want to send someone else an encrypted message? It's actually pretty simple. This is what you'd need to do when sending a vendor your name and address for a delivery. First find their public PGP key and copy it. Then go to Tools > Clipboard > Certificate Import.If prompted whether you wish to certify, you can just select no (it's really not necessary). Their public key -BEGIN PGP PUBLIC KEY BLOCK-BEGIN PGP PUBLIC KEY BLOCK-mDMEZgx0fBYJKwYBBAHaRw8BAQdAv8SlPxaZAT7rf579GcWyQo8zPoaMSnqKvC This guide will show you how you can configure your development setup to automatically sign git commits using GPG and link your GPG key with GitHub.PrerequisitesMake sure you follow the Prerequisites, How To Contribute (microsoft/vscode) guide.Install ToolsWindows 10Install Gpg4win and make sure Git uses that GPG version:git config --global gpg.program "C:\Program Files (x86)\GnuPG\bin\gpg.exe"macOS Big SurInstall the necessary tools and configure GPG:> ~/.gnupg/gpg-agent.confecho "use-agent" >> ~/.gnupg/gpg.confecho 'export GPG_TTY=$(tty)' >> ~/.bash_profile # replace with ~/.zprofile if using ZSH">brew install gpg2 gnupg pinentry-macmkdir -p ~/.gnupgecho "pinentry-program $(brew --prefix)/bin/pinentry-mac" >> ~/.gnupg/gpg-agent.confecho "use-agent" >> ~/.gnupg/gpg.confecho 'export GPG_TTY=$(tty)' >> ~/.bash_profile # replace with ~/.zprofile if using ZSHRestart your machine. Yes, really.Create Signing KeyThere are two options: generate or copy an existing key.Generate KeyWindows: make sure you're using a Command Prompt or PowerShell instead of the Git Bash shell. Make sure the right GPG is being used: where gpgC:\Program Files (x86)\GnuPG\bin\gpg.exe">C:\Users\User> where gpgC:\Program Files (x86)\GnuPG\bin\gpg.exeRun:With the following options:Kind of key: RSA and RSA (default)Keysize: 4096Expiration: 0 (does not expire)Real Name: use your real nameEmail address: use your Microsoft email addressComment: Key for signing commits for MicrosoftPassphrase: Pick a long, secure passphrase, which you'll easily remember.In the following example, DF536B632D7967F9 is the key ID:ssb rsa4096/41FC60C87D442095 2021-04-07 [E]">$ gpg --list-secret-keys --keyid-format LONGgpg: checking the trustdbgpg: marginals needed: 3 completes needed: 1 trust model: pgpgpg: depth: 0 valid: 1 signed: 0 trust: 0-, 0q, 0n, 0m, 0f, 1u/home/joao/.gnupg/pubring.kbx-----------------------------sec rsa4096/DF536B632D7967F9 2021-04-07 [SC] 1D0FC7C0350BB570143C934FDF536B632D7967F9uid [ultimate] Joao Moreno (Key for signing commits for Microsoft) [email protected]>ssb rsa4096/41FC60C87D442095 2021-04-07 [E]You can use your key ID to get your public key:$ gpg --armor --export DF536B632D7967F9-----BEGIN PGP PUBLIC KEY BLOCK-----...-----END PGP PUBLIC KEY BLOCK-----Copy KeyAlternatively, you can export a existing key from another machine, by replacing KEYID with your key ID: my-key.asc">gpg --export-secret-keys -a KEYID > my-key.ascThen, copy it into your machine and import it:Finally, set itsComments
Only you can read, or for 2FA purposes. The next task therefore is to export the public key so you can start sharing it.In the certificates screen of Kleopatra (the default screen when you open the application), right click on the name of the key you just created and you will be presented with the following options:Select 'Export' then when prompted, save the file to your preferred location (you can rename it if you wish). By default the file type should be shown as 'OpenPGP Certificates'. This file can be opened up in a text editor such as Notepad or Leafpad and should look something like this:A public PGP will always begin with:-----BEGIN PGP PUBLIC KEY BLOCK-----and end with:-----END PGP PUBLIC KEY BLOCK-----If you need to make a backup of your private key to import to a different software application or another system, this can be done by selecting 'Backup Secret Keys' instead of export. These will look very similar to public keys but will start and end with the word 'PRIVATE' instead of 'PUBLIC'.Importing someone else's public key and encrypting a messageSo you want to send someone else an encrypted message? It's actually pretty simple. This is what you'd need to do when sending a vendor your name and address for a delivery. First find their public PGP key and copy it. Then go to Tools > Clipboard > Certificate Import.If prompted whether you wish to certify, you can just select no (it's really not necessary). Their public key
2025-04-06This guide will show you how you can configure your development setup to automatically sign git commits using GPG and link your GPG key with GitHub.PrerequisitesMake sure you follow the Prerequisites, How To Contribute (microsoft/vscode) guide.Install ToolsWindows 10Install Gpg4win and make sure Git uses that GPG version:git config --global gpg.program "C:\Program Files (x86)\GnuPG\bin\gpg.exe"macOS Big SurInstall the necessary tools and configure GPG:> ~/.gnupg/gpg-agent.confecho "use-agent" >> ~/.gnupg/gpg.confecho 'export GPG_TTY=$(tty)' >> ~/.bash_profile # replace with ~/.zprofile if using ZSH">brew install gpg2 gnupg pinentry-macmkdir -p ~/.gnupgecho "pinentry-program $(brew --prefix)/bin/pinentry-mac" >> ~/.gnupg/gpg-agent.confecho "use-agent" >> ~/.gnupg/gpg.confecho 'export GPG_TTY=$(tty)' >> ~/.bash_profile # replace with ~/.zprofile if using ZSHRestart your machine. Yes, really.Create Signing KeyThere are two options: generate or copy an existing key.Generate KeyWindows: make sure you're using a Command Prompt or PowerShell instead of the Git Bash shell. Make sure the right GPG is being used: where gpgC:\Program Files (x86)\GnuPG\bin\gpg.exe">C:\Users\User> where gpgC:\Program Files (x86)\GnuPG\bin\gpg.exeRun:With the following options:Kind of key: RSA and RSA (default)Keysize: 4096Expiration: 0 (does not expire)Real Name: use your real nameEmail address: use your Microsoft email addressComment: Key for signing commits for MicrosoftPassphrase: Pick a long, secure passphrase, which you'll easily remember.In the following example, DF536B632D7967F9 is the key ID:ssb rsa4096/41FC60C87D442095 2021-04-07 [E]">$ gpg --list-secret-keys --keyid-format LONGgpg: checking the trustdbgpg: marginals needed: 3 completes needed: 1 trust model: pgpgpg: depth: 0 valid: 1 signed: 0 trust: 0-, 0q, 0n, 0m, 0f, 1u/home/joao/.gnupg/pubring.kbx-----------------------------sec rsa4096/DF536B632D7967F9 2021-04-07 [SC] 1D0FC7C0350BB570143C934FDF536B632D7967F9uid [ultimate] Joao Moreno (Key for signing commits for Microsoft) [email protected]>ssb rsa4096/41FC60C87D442095 2021-04-07 [E]You can use your key ID to get your public key:$ gpg --armor --export DF536B632D7967F9-----BEGIN PGP PUBLIC KEY BLOCK-----...-----END PGP PUBLIC KEY BLOCK-----Copy KeyAlternatively, you can export a existing key from another machine, by replacing KEYID with your key ID: my-key.asc">gpg --export-secret-keys -a KEYID > my-key.ascThen, copy it into your machine and import it:Finally, set its
2025-04-02New PGP(encryptionKeys);await pgp.ClearSignAsync(inputFile, signedFile);Clear Sign Stream// Load keysEncryptionKeys encryptionKeys;using (Stream privateKeyStream = new FileStream(@"C:\TEMP\Keys\private.asc", FileMode.Open)) encryptionKeys = new EncryptionKeys(privateKeyStream, "password");PGP pgp = new PGP(encryptionKeys);// Reference input/output filesusing (FileStream inputFileStream = new FileStream(@"C:\TEMP\Content\content.txt", FileMode.Open))using (Stream outputFileStream = File.Create(@"C:\TEMP\Content\signed.pgp")) // Sign await pgp.ClearSignAsync(inputFileStream, outputFileStream);Clear Sign String// Load keysstring privateKey = File.ReadAllText(@"C:\TEMP\Keys\private.asc");EncryptionKeys encryptionKeys = new EncryptionKeys(privateKey, "password");PGP pgp = new PGP(encryptionKeys);// Signstring signedContent = await pgp.ClearSignAsync("String to sign");Encrypt and SignEncrypt the provided file, stream or string using a public key and sign using your private key. You usually encrypt with the public key of your counterparty so they can decrypt with their private key and sign with your private key so they can verify with your public key.Although this method is called EncryptAndSign the signature will actually be included within the encrypted message rather than being appended to the encrypted message. This ensures that the original message was composed by the holder of the private key.gpg --encrypt --sign --recipient 'some user ID value' "C:\TEMP\keys\content.txt"Encrypt File And Sign// Load keysFileInfo publicKey = new FileInfo(@"C:\TEMP\Keys\public.asc");FileInfo privateKey = new FileInfo(@"C:\TEMP\Keys\private.asc");EncryptionKeys encryptionKeys = new EncryptionKeys(publicKey, privateKey, "password");// Reference input/output filesFileInfo inputFile = new FileInfo(@"C:\TEMP\Content\content.txt");FileInfo encryptedSignedFile = new FileInfo(@"C:\TEMP\Content\encryptedSigned.pgp");// Encrypt and SignPGP pgp = new PGP(encryptionKeys);await pgp.EncryptAndSignAsync(inputFile, encryptedSignedFile);Encrypt Stream And Sign// Load keysEncryptionKeys encryptionKeys;using (Stream publicKeyStream = new FileStream(@"C:\TEMP\Keys\public.asc", FileMode.Open))using (Stream privateKeyStream = new FileStream(@"C:\TEMP\Keys\private.asc", FileMode.Open)) encryptionKeys = new EncryptionKeys(publicKeyStream, privateKeyStream, "password");PGP pgp = new PGP(encryptionKeys);// Reference input/output filesusing (FileStream inputFileStream = new FileStream(@"C:\TEMP\Content\content.txt", FileMode.Open))using (Stream outputFileStream = File.Create(@"C:\TEMP\Content\signed.pgp")) // Encrypt and Sign await pgp.EncryptAndSignAsync(inputFileStream, outputFileStream);Encrypt String And
2025-03-29Robo-FTP 3.10 | 3.10 Configurator) and click the 'PGP Keys' tab. Click the 'Import Key' button. Browse to the folder where your exported PGP key file is located. Select the file and click 'OK'. Your key should now be imported and ready to use.Importing a Public KeyIf you wish to encrypt files so that the recipient (and only the recipient) can decrypt them, you must first import the recipient'spublic key. The recipient must export his public key and give you access to this file (most often as an e-mail attachment). Launch the Robo-FTP Configurator (Start | All Programs | Robo-FTP 3.10 | 3.10 Configurator) and click the 'PGP Keys' tab. Click the 'Import Key' button. Browse to the folder where the public key file is located. Select the file and click 'OK'. The key should now be imported and ready to use.Exporting a Public KeyIf you wish to have others encrypt files so that you (and only you) can read them, you must export your public key. You will givethis public key (often as an e-mail attachment) to anybody who needs to encrypt files for you to receive. Launch the Robo-FTP Configurator (Start | All Programs | Robo-FTP 3.10 | 3.10 Configurator) and click the 'PGP Keys' tab. Select the Key that you would like to export by clicking on it in the list of keys. Click the 'Export...' button. Select the location of the file to be exported. Select 'OK'. The public key is now exported to a file
2025-04-01