gnupg

Check if GPG/PGP public key is valid

不羁的心 提交于 2019-12-24 07:47:12
问题 Through a web interface I'm trying to check if a given public key is valid or not. The bash command gpg --import key.pub returns import successful/failed based on the given key, but I don't want to use $data = system("/usr/bin/gpg --import $key) for my own security concerns. Is there an alternative? 回答1: Ok, I've done a little debugging and this is what I've found: nginx daemon was running under nginx:nginx , no home dir, nologin shell When I executed sudo -u nginx php -r "echo system("gpg -k

Encrypt file with GPG in python 3 with subprocess

六眼飞鱼酱① 提交于 2019-12-24 05:26:26
问题 How do I encrypt file with subprocess, so the output will be string. password = '%030x' % random.randrange(16**30) encrypted_file = subprocess.geststatusoutput("echo "+password+ "|gpg --password-fd 0 < "+ name_of_selected_file) I want to encrypted _file to be a string so I could use it as encrypted file to upload with post request. What is the best way to do it with gnupg library? 回答1: You can use subprocess.Popen() to execute a gpg command like this: import shlex import random from

.exe processes are not running from a C# application when called

岁酱吖の 提交于 2019-12-24 03:16:35
问题 I wrote an app that, among other things, decrypts a file using GpgApi. I used GpgApi in C# to decrypt the file as follows: GpgInterface.ExePath = @"C:\Program Files (x86)\GNU\GnuPG\gpg.exe"; GpgDecrypt decrypt = new GpgDecrypt(encryptedFile, file); decrypt.AskPassphrase = GetPassword; { GpgInterfaceResult result = decrypt.Execute(); Callback(result); } I also installed gpg classic from https://www.gnupg.org/download/, and the public and private keys already exist in the server. Now, the

.exe processes are not running from a C# application when called

陌路散爱 提交于 2019-12-24 03:16:18
问题 I wrote an app that, among other things, decrypts a file using GpgApi. I used GpgApi in C# to decrypt the file as follows: GpgInterface.ExePath = @"C:\Program Files (x86)\GNU\GnuPG\gpg.exe"; GpgDecrypt decrypt = new GpgDecrypt(encryptedFile, file); decrypt.AskPassphrase = GetPassword; { GpgInterfaceResult result = decrypt.Execute(); Callback(result); } I also installed gpg classic from https://www.gnupg.org/download/, and the public and private keys already exist in the server. Now, the

What are the advantages of signing git commit with GPG key compared to SSH key

主宰稳场 提交于 2019-12-23 21:08:04
问题 I'm using git for most of my programming work and sign them with SSH key for most of the commits. However, when I updated git to version 2.17.1, git defaulted to signing with GPG key instead of the SSH key. I would like to know what are the advantages and disadvantages of using a GPG key over a SSH key and why git is making GPG the default. 回答1: SSH key is used for many authentication application such as logging in to ssh server, logging in, and many other applications. This means that if you

What do returned values of PHP gnupg signature verification mean?

我与影子孤独终老i 提交于 2019-12-23 20:59:01
问题 I want to verify pgp signed text in PHP. Following PHP documentation and answer to this question i made simple script to test gnupg library. I sent signed email between two email accounts using Thunderbird with Enigmail - receiving Thunderbird shows that signature is correct. In PHP, when i use plain email text and senders public key, verify() function returns array like this: array(1) { [0]=> array(5) { ["fingerprint"]=> string(40) "468F82339FC55DE5CAFD71BB63DD32AE1308A57F" ["validity"]=>

Using output from gpg --list-packets on a key to get the mpi values to generate s-expressions

孤人 提交于 2019-12-23 15:05:13
问题 I am trying to use gpg generated public keys to do encryption using libgcrypt. I used the list packets command on the key to get me the contents of the key and parsed the mpi values into an s-expression. So when I try to encode my session key with my public key I get the error "Odd hexadecimal numbers in S-expression"? I think list packets is maybe giving me hex numbers without the leading zero? If so what do I need to do to get me mpi values that I can use in libgcrypt? 回答1: After trial and

gpg failed to sign the data. Failed to write commit object

不羁岁月 提交于 2019-12-23 14:49:48
问题 I wrongly did sudo install gpg due to passphrase error. Now I am not able to commit anything through intelliJ. I am getting below error: gpg: skipped "10XXXXXXXXX3892": secret key not available gpg: signing failed: secret key not available error: gpg failed to sign the data fatal: failed to write commit object gpg: skipped "MyUpdates": secret key not available gpg: signing failed: secret key not available error: gpg failed to sign the data fatal: failed to write commit object Here two secret

Decrypt with gpg from inside a docker container

不想你离开。 提交于 2019-12-22 11:20:01
问题 I have an encrypted file with gpg that I want to decrypt from inside a docker container. gpg is not found on the container, how would I add it. 回答1: Depending on your base image (used by your container), you would need to add to your Dockerfile (or to make one, starting with FROM <the image used by your container> ) with: RUN apt-get update && apt-get install gnupg (as in this docker-vault-init Dockerfile) Then check out "Adding GPG key inside docker container causes “no valid OpenPGP data

How can I force GPG to accept input from STDIN instead of trying to open a file?

南笙酒味 提交于 2019-12-22 10:34:52
问题 I am trying to incorporate GPG clear-signing of text in a string in a PHP script. I can cause GPG to encrypt text in a string like this: $encrypted = shell_exec("echo '$text' | gpg -e -a -r foo@bar.com --trust-model always"); and that works perfectly, with the encrypted text being sent to the $encrypted variable. This proves GNUPGHOME and GNUPG are set up correctly. However, when I try to produce a clear-signed message in the same way with this: $text = "googar"; $signature = exec("echo