pgp

JavaScript: Decrypt content of GnuPG encrypted files using openpgp.js

好久不见. 提交于 2019-12-04 08:56:10
I'm trying to write a sample decryptor for GnuPG encrypted files in JavaScript using openpgp.js . So I tried it naively without even asking if it is even possible. I made the following page. popup.html <!doctype html> <!-- --> <html> <head> <title>Popup</title> <script src="openpgp.js"></script> <script src="popup.js"></script> </head> <body> <p>Upload message: </p><input id="message" type="file"/><br> <p>Upload secret key: </p><input id="secret" type="file"/><br> <p>Secret key password: </p><input id="password" type="password"/><br><br> <button id="decrypt">Decrypt</button> <p id="output"></p

How to decrypt a signed pgp encrypted file?

房东的猫 提交于 2019-12-03 15:01:11
问题 How can I decrypt and verify a file encrypted with PGP with the BouncyCastle Java API? 回答1: Encryption Code: private static void encryptFile(OutputStream out, String fileName, PGPPublicKey encKey, PGPSecretKey pgpSec, boolean armor, boolean withIntegrityCheck, char[] pass) throws IOException, NoSuchProviderException { if (armor) { out = new ArmoredOutputStream(out); } try { PGPEncryptedDataGenerator encGen = new PGPEncryptedDataGenerator( new JcePGPDataEncryptorBuilder(PGPEncryptedData.CAST5)

PGP-signing multipart e-mails with Python

喜你入骨 提交于 2019-12-03 12:37:18
I'm currently trying to add PGP signing support to my small e-mail sending script (which uses Python 3.x and python-gnupg module). The code that signs message is: gpg = gnupg.GPG() basetext = basemsg.as_string().replace('\n', '\r\n') signature = str(gpg.sign(basetext, detach=True)) if signature: signmsg = messageFromSignature(signature) msg = MIMEMultipart(_subtype="signed", micalg="pgp-sha1", protocol="application/pgp-signature") msg.attach(basemsg) msg.attach(signmsg) else: print('Warning: failed to sign the message!') (Here basemsg is of email.message.Message type.) And messageFromSignature

what is the best/easiest to use encryption library in python [closed]

孤街浪徒 提交于 2019-12-03 09:55:09
I want to encrypt few files using python what is the best way I can use gpg/pgp using any standard/famous python libraries? PyCrypto seems to be the best one around. Try KeyCzar Very easy to implement. I use GPGme The main strength of GPGme is that it read and writes files at the OpenPGP standard ( RFC 4880 ) which can be important if you want to interoperate with other PGP programs. It has a Python interface . Warning: it is a low-level interface, not very Pythonic. If you read French, see examples . Here is one, to check a signature: signed = core.Data(sys.stdin.read()) plain = core.Data()

Adding a OpenPGP signature to an already signed document? [closed]

我怕爱的太早我们不能终老 提交于 2019-12-03 08:30:30
We'd like to implement a workflow that requires multiple people to digitallly sign a document. If I have multiple secret keys in my own keychain, I can do something as simple as: gpg --sign -u userid1 -u userid2 filename But what do I do if I've got an already signed document and I want to add a signature? One solution would be to have everyone generate detached signatures for the document, and then package them all together in a zip file or something, but the overhead there is substantially higher. Is there a better way? No need to ZIP them: you can simply concatenate detached signatures in a

GPG (PGP) decryption in client side web applications

萝らか妹 提交于 2019-12-03 07:38:03
问题 How would I be able to decrypt some encrypted data on the client side of a web application? E.g. The data is stored encrypted on the server. It was encrypted using a public GPG key. The server sends the encrypted to the client. The client needs to decrypt it using their local private key. Assumably I would be able to pass the private key to the browser and use Javascript to decrypt the data. 回答1: If you want to stick with JavaScript, then have a look at the LGPL library OpenPGP.js. 回答2: I

Bouncycastle PGP decrypt and verify

女生的网名这么多〃 提交于 2019-12-03 07:33:27
I'm trying to decrypt and verify a PGP message using the java BouncyCastle libraries, but am running into issues, complaining about premature ends of PartialInputStream. I know the encrypt works fine, because I can decrypt and verify messages created with the encrypt function using gpg on the command line. Here's the code: public static void signEncryptMessage(InputStream in, OutputStream out, PGPPublicKey publicKey, PGPPrivateKey secretKey, SecureRandom rand) throws Exception { out = new ArmoredOutputStream(out); PGPEncryptedDataGenerator encryptedDataGenerator = new PGPEncryptedDataGenerator

PGP Encryption in Javascript

自作多情 提交于 2019-12-03 03:49:15
问题 I'm looking to do some client-side PGP encryption in Javascript. I've found some GPL library scattered on the web, but for obvious reason, I cannot use that code due to licensing issues. I'm looking for some BSD-like license library that would accomplish the same thing. Anyone know of a library I could use? 回答1: I recently found a MIT licensed client-side javascript library: https://github.com/bitwiseshiftleft/sjcl It works well so far, and it allows for a full-client side encryption of the

How to decrypt a signed pgp encrypted file?

老子叫甜甜 提交于 2019-12-03 03:48:49
How can I decrypt and verify a file encrypted with PGP with the BouncyCastle Java API? Vishal Dhawani Encryption Code: private static void encryptFile(OutputStream out, String fileName, PGPPublicKey encKey, PGPSecretKey pgpSec, boolean armor, boolean withIntegrityCheck, char[] pass) throws IOException, NoSuchProviderException { if (armor) { out = new ArmoredOutputStream(out); } try { PGPEncryptedDataGenerator encGen = new PGPEncryptedDataGenerator( new JcePGPDataEncryptorBuilder(PGPEncryptedData.CAST5).setWithIntegrityPacket(withIntegrityCheck).setSecureRandom( new SecureRandom()) .setProvider

GPG (PGP) decryption in client side web applications

拟墨画扇 提交于 2019-12-02 22:39:14
How would I be able to decrypt some encrypted data on the client side of a web application? E.g. The data is stored encrypted on the server. It was encrypted using a public GPG key. The server sends the encrypted to the client. The client needs to decrypt it using their local private key. Assumably I would be able to pass the private key to the browser and use Javascript to decrypt the data. Jens Erat If you want to stick with JavaScript, then have a look at the LGPL library OpenPGP.js . I know I'm coming a bit late to this, but for future reference, there's always an option of using crypto