jruby-pgp 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1 @@
1
+ jruby-1.7.2
data/README.md CHANGED
@@ -27,20 +27,26 @@ The feature set is very bare, and restricted to the following operations:
27
27
 
28
28
  - Public and Private keys may be read in from disk or from memory.
29
29
 
30
- Currently, you **cannot** do the following:
30
+ - Verify the signature of a file that you are decrypting. (thanks, @superchris)
31
31
 
32
- - Create new Private Keys / generate public keys from a given Private Key.
32
+ - Use password-protected Private Keys. (thanks, @superchris)
33
33
 
34
- - Sign a file that you are encrypting.
34
+ - Sign a file from the file system. (thanks, @superchris)
35
35
 
36
- - Verify the signature of a file that you are decrypting.
36
+ Currently, you **cannot** do the following (These are TODO items):
37
37
 
38
- - Use password-protected Private Keys. (This is a trivial change that can later be added.)
38
+ - Verify any signatures of public / private keys.
39
+
40
+ - Create new Private Keys / generate public keys from a given Private Key.
41
+
42
+ - Sign a file that you are encrypting.
39
43
 
40
44
  - Obtain the name of the file that was encrypted. (Should be an easy feature to add.)
41
45
 
42
46
  - Obtain the "modificationTime" (timestamp) of the encrypted data / file.
43
47
 
48
+ - Verify a public key based on information from a key server.
49
+
44
50
  ## Notes
45
51
 
46
52
  This gem currently features everything I need and nothing I don't. Pull requests are very much welcome;
@@ -62,6 +68,10 @@ For usage examples, see the below test files:
62
68
  Encryption: spec/lib/pgp/encryptor_spec.rb
63
69
  Decryption: spec/lib/pgp/decryptor_spec.rb
64
70
 
71
+ ## Contributors
72
+
73
+ @superchris
74
+
65
75
  ## Contributing
66
76
 
67
77
  1. Fork it
@@ -69,3 +79,11 @@ For usage examples, see the below test files:
69
79
  3. Commit your changes (`git commit -am 'Add some feature'`)
70
80
  4. Push to the branch (`git push origin my-new-feature`)
71
81
  5. Create new Pull Request
82
+
83
+ ## Testing:
84
+
85
+ Just run:
86
+
87
+ $ rake spec
88
+
89
+ And it will compile the Java extensions prior to running the tests.
@@ -48,6 +48,8 @@ public class Decryptor {
48
48
 
49
49
  private PGPSecretKeyRingCollection _privateKeys;
50
50
 
51
+ private String passphrase;
52
+
51
53
  public Decryptor() { }
52
54
  public Decryptor(PGPSecretKeyRingCollection privateKeys) {
53
55
  setPrivateKeys(privateKeys);
@@ -64,6 +66,10 @@ public class Decryptor {
64
66
  _privateKeys = privateKeys;
65
67
  }
66
68
 
69
+ public void setPassphrase(String passphrase) {
70
+ this.passphrase = passphrase;
71
+ }
72
+
67
73
  public PGPPrivateKey findPrivateKey(long keyID)
68
74
  throws PGPException, NoSuchProviderException {
69
75
  PGPSecretKey pgpSecKey = getPrivateKeys().getSecretKey(keyID);
@@ -71,8 +77,7 @@ public class Decryptor {
71
77
  if (pgpSecKey == null)
72
78
  return null;
73
79
 
74
- // null = the password. We won't need this for now.
75
- return pgpSecKey.extractPrivateKey(null, "BC");
80
+ return pgpSecKey.extractPrivateKey((passphrase == null ? null : passphrase.toCharArray()), "BC");
76
81
  }
77
82
 
78
83
  /** End Accessor Methods **/
@@ -0,0 +1,153 @@
1
+ package org.sgonyea.pgp;
2
+
3
+ import java.io.BufferedInputStream;
4
+ import java.io.ByteArrayOutputStream;
5
+ import java.io.File;
6
+ import java.io.FileInputStream;
7
+ import java.io.IOException;
8
+ import java.io.InputStream;
9
+ import java.security.NoSuchProviderException;
10
+ import java.util.Iterator;
11
+
12
+ import org.bouncycastle.openpgp.PGPCompressedDataGenerator;
13
+ import org.bouncycastle.openpgp.PGPException;
14
+ import org.bouncycastle.openpgp.PGPLiteralData;
15
+ import org.bouncycastle.openpgp.PGPPrivateKey;
16
+ import org.bouncycastle.openpgp.PGPPublicKey;
17
+ import org.bouncycastle.openpgp.PGPPublicKeyRing;
18
+ import org.bouncycastle.openpgp.PGPPublicKeyRingCollection;
19
+ import org.bouncycastle.openpgp.PGPSecretKey;
20
+ import org.bouncycastle.openpgp.PGPSecretKeyRing;
21
+ import org.bouncycastle.openpgp.PGPSecretKeyRingCollection;
22
+ import org.bouncycastle.openpgp.PGPUtil;
23
+
24
+ class PGPExampleUtil
25
+ {
26
+ static byte[] compressFile(String fileName, int algorithm) throws IOException
27
+ {
28
+ ByteArrayOutputStream bOut = new ByteArrayOutputStream();
29
+ PGPCompressedDataGenerator comData = new PGPCompressedDataGenerator(algorithm);
30
+ PGPUtil.writeFileToLiteralData(comData.open(bOut), PGPLiteralData.BINARY,
31
+ new File(fileName));
32
+ comData.close();
33
+ return bOut.toByteArray();
34
+ }
35
+
36
+ /**
37
+ * Search a secret key ring collection for a secret key corresponding to keyID if it
38
+ * exists.
39
+ *
40
+ * @param pgpSec a secret key ring collection.
41
+ * @param keyID keyID we want.
42
+ * @param pass passphrase to decrypt secret key with.
43
+ * @return
44
+ * @throws PGPException
45
+ * @throws NoSuchProviderException
46
+ */
47
+ static PGPPrivateKey findSecretKey(PGPSecretKeyRingCollection pgpSec, long keyID, char[] pass)
48
+ throws PGPException, NoSuchProviderException
49
+ {
50
+ PGPSecretKey pgpSecKey = pgpSec.getSecretKey(keyID);
51
+
52
+ if (pgpSecKey == null)
53
+ {
54
+ return null;
55
+ }
56
+
57
+ return pgpSecKey.extractPrivateKey(pass, "BC");
58
+ }
59
+
60
+ static PGPPublicKey readPublicKey(String fileName) throws IOException, PGPException
61
+ {
62
+ InputStream keyIn = new BufferedInputStream(new FileInputStream(fileName));
63
+ PGPPublicKey pubKey = readPublicKey(keyIn);
64
+ keyIn.close();
65
+ return pubKey;
66
+ }
67
+
68
+ /**
69
+ * A simple routine that opens a key ring file and loads the first available key
70
+ * suitable for encryption.
71
+ *
72
+ * @param input
73
+ * @return
74
+ * @throws IOException
75
+ * @throws PGPException
76
+ */
77
+ static PGPPublicKey readPublicKey(InputStream input) throws IOException, PGPException
78
+ {
79
+ PGPPublicKeyRingCollection pgpPub = new PGPPublicKeyRingCollection(
80
+ PGPUtil.getDecoderStream(input));
81
+
82
+ //
83
+ // we just loop through the collection till we find a key suitable for encryption, in the real
84
+ // world you would probably want to be a bit smarter about this.
85
+ //
86
+
87
+ Iterator keyRingIter = pgpPub.getKeyRings();
88
+ while (keyRingIter.hasNext())
89
+ {
90
+ PGPPublicKeyRing keyRing = (PGPPublicKeyRing)keyRingIter.next();
91
+
92
+ Iterator keyIter = keyRing.getPublicKeys();
93
+ while (keyIter.hasNext())
94
+ {
95
+ PGPPublicKey key = (PGPPublicKey)keyIter.next();
96
+
97
+ if (key.isEncryptionKey())
98
+ {
99
+ return key;
100
+ }
101
+ }
102
+ }
103
+
104
+ throw new IllegalArgumentException("Can't find encryption key in key ring.");
105
+ }
106
+
107
+ static PGPSecretKey readSecretKey(String fileName) throws IOException, PGPException
108
+ {
109
+ InputStream keyIn = new BufferedInputStream(new FileInputStream(fileName));
110
+ PGPSecretKey secKey = readSecretKey(keyIn);
111
+ keyIn.close();
112
+ return secKey;
113
+ }
114
+
115
+ /**
116
+ * A simple routine that opens a key ring file and loads the first available key
117
+ * suitable for signature generation.
118
+ *
119
+ * @param input stream to read the secret key ring collection from.
120
+ * @return a secret key.
121
+ * @throws IOException on a problem with using the input stream.
122
+ * @throws PGPException if there is an issue parsing the input stream.
123
+ */
124
+ static PGPSecretKey readSecretKey(InputStream input) throws IOException, PGPException
125
+ {
126
+ PGPSecretKeyRingCollection pgpSec = new PGPSecretKeyRingCollection(
127
+ PGPUtil.getDecoderStream(input));
128
+
129
+ //
130
+ // we just loop through the collection till we find a key suitable for encryption, in the real
131
+ // world you would probably want to be a bit smarter about this.
132
+ //
133
+
134
+ Iterator keyRingIter = pgpSec.getKeyRings();
135
+ while (keyRingIter.hasNext())
136
+ {
137
+ PGPSecretKeyRing keyRing = (PGPSecretKeyRing)keyRingIter.next();
138
+
139
+ Iterator keyIter = keyRing.getSecretKeys();
140
+ while (keyIter.hasNext())
141
+ {
142
+ PGPSecretKey key = (PGPSecretKey)keyIter.next();
143
+
144
+ if (key.isSigningKey())
145
+ {
146
+ return key;
147
+ }
148
+ }
149
+ }
150
+
151
+ throw new IllegalArgumentException("Can't find signing key in key ring.");
152
+ }
153
+ }
@@ -0,0 +1,133 @@
1
+ /**
2
+ * Much of this code was stolen from this Stack Overflow post:
3
+ * http://stackoverflow.com/questions/3939447/how-to-encrypt-a-string-stream-with-bouncycastle-pgp-without-starting-with-a-fil
4
+ *
5
+ * In addition to the java versions of this lump of code, that have been floating around on the internet:
6
+ * https://gist.github.com/1954648
7
+ *
8
+ * Thanks to everyone who has posted on the topic of Bouncy Castle's PGP Library.
9
+ */
10
+
11
+ package org.sgonyea.pgp;
12
+
13
+ import java.io.ByteArrayInputStream;
14
+ import java.io.ByteArrayOutputStream;
15
+ import java.io.File;
16
+ import java.io.FileInputStream;
17
+ import java.io.FileOutputStream;
18
+ import java.io.IOException;
19
+ import java.io.InputStream;
20
+ import java.io.OutputStream;
21
+ import java.security.NoSuchProviderException;
22
+ import java.security.SecureRandom;
23
+ import java.security.Security;
24
+ import java.util.Date;
25
+ import java.util.Iterator;
26
+
27
+ import org.bouncycastle.bcpg.BCPGOutputStream;
28
+ import org.bouncycastle.bcpg.ArmoredOutputStream;
29
+ import org.bouncycastle.jce.provider.BouncyCastleProvider;
30
+ import org.bouncycastle.openpgp.*;
31
+ import org.bouncycastle.openpgp.operator.jcajce.JcaPGPContentSignerBuilder;
32
+ import org.bouncycastle.openpgp.operator.jcajce.JcaPGPContentVerifierBuilderProvider;
33
+ import org.bouncycastle.openpgp.operator.jcajce.JcePBESecretKeyDecryptorBuilder;
34
+
35
+ public class Signer {
36
+
37
+ private PGPSecretKeyRingCollection _privateKeys;
38
+
39
+ private String passphrase;
40
+
41
+ public Signer() { }
42
+ public Signer(PGPSecretKeyRingCollection privateKeys) {
43
+ setPrivateKeys(privateKeys);
44
+ }
45
+
46
+ /**
47
+ * Accessor and Attribute Helper Methods
48
+ **/
49
+ public PGPSecretKeyRingCollection getPrivateKeys() {
50
+ return _privateKeys;
51
+ }
52
+
53
+ public void setPrivateKeys(PGPSecretKeyRingCollection privateKeys) {
54
+ _privateKeys = privateKeys;
55
+ }
56
+
57
+ public void setPassphrase(String passphrase) {
58
+ this.passphrase = passphrase;
59
+ }
60
+
61
+ private PGPSecretKey findSecretKey()
62
+ throws PGPException, NoSuchProviderException {
63
+ Iterator keyRingIter = _privateKeys.getKeyRings();
64
+ while (keyRingIter.hasNext())
65
+ {
66
+ PGPSecretKeyRing keyRing = (PGPSecretKeyRing)keyRingIter.next();
67
+
68
+ Iterator keyIter = keyRing.getSecretKeys();
69
+ while (keyIter.hasNext())
70
+ {
71
+ PGPSecretKey key = (PGPSecretKey)keyIter.next();
72
+
73
+ if (key.isSigningKey())
74
+ {
75
+ return key;
76
+ }
77
+ }
78
+ }
79
+
80
+ throw new IllegalArgumentException("Can't find signing key in key ring.");
81
+ }
82
+
83
+ public byte[] signData(byte[] clearData)
84
+ throws Exception {
85
+ String fileName = "something.txt";
86
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
87
+ ArmoredOutputStream out = new ArmoredOutputStream(bos);
88
+
89
+ PGPSecretKey pgpSec = findSecretKey();
90
+ PGPPrivateKey pgpPrivKey = pgpSec.extractPrivateKey(new JcePBESecretKeyDecryptorBuilder().setProvider("BC").build(passphrase.toCharArray()));
91
+ PGPSignatureGenerator sGen = new PGPSignatureGenerator(new JcaPGPContentSignerBuilder(pgpSec.getPublicKey().getAlgorithm(), PGPUtil.SHA1).setProvider("BC"));
92
+
93
+ sGen.init(PGPSignature.BINARY_DOCUMENT, pgpPrivKey);
94
+
95
+ Iterator it = pgpSec.getPublicKey().getUserIDs();
96
+ if (it.hasNext())
97
+ {
98
+ PGPSignatureSubpacketGenerator spGen = new PGPSignatureSubpacketGenerator();
99
+
100
+ spGen.setSignerUserID(false, (String)it.next());
101
+ sGen.setHashedSubpackets(spGen.generate());
102
+ }
103
+
104
+ PGPCompressedDataGenerator cGen = new PGPCompressedDataGenerator(
105
+ PGPCompressedData.ZLIB);
106
+
107
+ BCPGOutputStream bOut = new BCPGOutputStream(cGen.open(out));
108
+
109
+ sGen.generateOnePassVersion(false).encode(bOut);
110
+
111
+ File file = new File(fileName);
112
+ PGPLiteralDataGenerator lGen = new PGPLiteralDataGenerator();
113
+ OutputStream lOut = lGen.open(bOut,
114
+ PGPLiteralData.BINARY, PGPLiteralDataGenerator.CONSOLE,
115
+ clearData.length, PGPLiteralDataGenerator.NOW);
116
+ int ch;
117
+
118
+ lOut.write(clearData);
119
+ sGen.update(clearData);
120
+
121
+ lGen.close();
122
+
123
+ sGen.generate().encode(bOut);
124
+
125
+ cGen.close();
126
+
127
+ out.close();
128
+
129
+ return bos.toByteArray();
130
+ }
131
+
132
+
133
+ }
@@ -0,0 +1,7 @@
1
+ package org.sgonyea.pgp;
2
+
3
+ public class VerificationFailedException extends Exception {
4
+ public VerificationFailedException(String message) {
5
+ super(message);
6
+ }
7
+ }
@@ -0,0 +1,104 @@
1
+ /**
2
+ * Much of this code was stolen from this Stack Overflow post:
3
+ * http://stackoverflow.com/questions/3939447/how-to-encrypt-a-string-stream-with-bouncycastle-pgp-without-starting-with-a-fil
4
+ *
5
+ * In addition to the java versions of this lump of code, that have been floating around on the internet:
6
+ * https://gist.github.com/1954648
7
+ *
8
+ * Thanks to everyone who has posted on the topic of Bouncy Castle's PGP Library.
9
+ */
10
+
11
+ package org.sgonyea.pgp;
12
+
13
+ import org.sgonyea.pgp.VerificationFailedException;
14
+
15
+ import java.io.ByteArrayInputStream;
16
+ import java.io.ByteArrayOutputStream;
17
+ import java.io.File;
18
+ import java.io.FileInputStream;
19
+ import java.io.FileOutputStream;
20
+ import java.io.IOException;
21
+ import java.io.InputStream;
22
+ import java.io.OutputStream;
23
+ import java.security.NoSuchProviderException;
24
+ import java.security.SecureRandom;
25
+ import java.security.Security;
26
+ import java.util.Date;
27
+ import java.util.Iterator;
28
+
29
+ import org.bouncycastle.bcpg.ArmoredOutputStream;
30
+ import org.bouncycastle.jce.provider.BouncyCastleProvider;
31
+ import org.bouncycastle.openpgp.*;
32
+
33
+ import org.bouncycastle.openpgp.operator.jcajce.JcaPGPContentSignerBuilder;
34
+ import org.bouncycastle.openpgp.operator.jcajce.JcaPGPContentVerifierBuilderProvider;
35
+ import org.bouncycastle.openpgp.operator.jcajce.JcePBESecretKeyDecryptorBuilder;
36
+
37
+ public class Verifier {
38
+
39
+ private PGPPublicKeyRingCollection _publicKeys;
40
+
41
+ public Verifier() { }
42
+ /**
43
+ * Accessor and Attribute Helper Methods
44
+ **/
45
+ public PGPPublicKeyRingCollection getPublicKeys() {
46
+ return _publicKeys;
47
+ }
48
+
49
+ public void setPublicKeys(PGPPublicKeyRingCollection keys) {
50
+ _publicKeys = keys;
51
+ }
52
+
53
+
54
+ public byte[] verifyStream(InputStream inStream)
55
+ throws Exception, VerificationFailedException
56
+ {
57
+ InputStream in = PGPUtil.getDecoderStream(inStream);
58
+
59
+ PGPObjectFactory pgpFact = new PGPObjectFactory(in);
60
+
61
+ PGPCompressedData c1 = (PGPCompressedData)pgpFact.nextObject();
62
+
63
+ pgpFact = new PGPObjectFactory(c1.getDataStream());
64
+
65
+ PGPOnePassSignatureList p1 = (PGPOnePassSignatureList)pgpFact.nextObject();
66
+
67
+ PGPOnePassSignature ops = p1.get(0);
68
+
69
+ PGPLiteralData p2 = (PGPLiteralData)pgpFact.nextObject();
70
+
71
+ InputStream dIn = p2.getInputStream();
72
+ int ch;
73
+
74
+ PGPPublicKey key = _publicKeys.getPublicKey(ops.getKeyID());
75
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
76
+
77
+ if(key == null) {
78
+ throw new VerificationFailedException("Error: Signature could not be verified.");
79
+ }
80
+
81
+ ops.init(new JcaPGPContentVerifierBuilderProvider().setProvider("BC"), key);
82
+
83
+ while ((ch = dIn.read()) >= 0)
84
+ {
85
+ ops.update((byte)ch);
86
+ out.write(ch);
87
+ }
88
+
89
+ out.close();
90
+
91
+ PGPSignatureList p3 = (PGPSignatureList)pgpFact.nextObject();
92
+
93
+ if (!ops.verify(p3.get(0))) {
94
+ throw new VerificationFailedException("Error: Signature could not be verified.");
95
+ }
96
+
97
+ byte[] returnBytes = out.toByteArray();
98
+ out.close();
99
+
100
+ return returnBytes;
101
+
102
+ }
103
+
104
+ }
data/lib/pgp.rb CHANGED
@@ -1,10 +1,12 @@
1
1
  require 'java'
2
- require 'pgp/jars/bcprov-jdk15on-147.jar' if JRUBY_VERSION < '1.7'
2
+ require 'pgp/jars/bcprov-jdk15on-147.jar'
3
3
  require 'pgp/jars/bcpg-jdk15on-147.jar'
4
4
  require 'pgp/jruby-pgp.jar'
5
5
 
6
6
  require 'pgp/decryptor'
7
7
  require 'pgp/encryptor'
8
+ require 'pgp/verifier'
9
+ require 'pgp/signer'
8
10
  require 'pgp/private_key'
9
11
 
10
12
  module PGP
@@ -0,0 +1,39 @@
1
+ module PGP
2
+ class Signer < org.sgonyea.pgp.Signer
3
+ include_package "org.bouncycastle.openpgp"
4
+
5
+ def add_keys(key_string)
6
+ self.private_keys = keyring_from_string(key_string)
7
+ end
8
+
9
+ def add_keys_from_file(filename)
10
+ self.private_keys = keyring_from_file(filename)
11
+ end
12
+
13
+ def sign(data)
14
+ signed_data = sign_data(data.to_java_bytes)
15
+ String.from_java_bytes(signed_data)
16
+ end
17
+
18
+ def sign_file(file_path)
19
+ sign File.read(file_path)
20
+ end
21
+
22
+ protected
23
+ def keyring_from_file(filename)
24
+ file = File.open(filename)
25
+ keyring_from_stream(file.to_inputstream)
26
+ end
27
+
28
+ def keyring_from_string(string)
29
+ input_stream = PGP.string_to_bais(string)
30
+ keyring_from_stream(input_stream)
31
+ end
32
+
33
+ def keyring_from_stream(stream)
34
+ yafs = PGPUtil.get_decoder_stream(stream)
35
+ PGPSecretKeyRingCollection.new(yafs)
36
+ end
37
+
38
+ end
39
+ end
@@ -0,0 +1,38 @@
1
+ module PGP
2
+ class Verifier < org.sgonyea.pgp.Verifier
3
+ include_package "org.bouncycastle.openpgp"
4
+
5
+ def add_keys(key_string)
6
+ self.public_keys = keyring_from_string(key_string)
7
+ end
8
+
9
+ def add_keys_from_file(filename)
10
+ self.public_keys = keyring_from_file(filename)
11
+ end
12
+
13
+ def verify(signed_data)
14
+ input_stream = PGP.string_to_bais(signed_data)
15
+ verified_data = verify_stream(input_stream)
16
+ String.from_java_bytes(verified_data)
17
+ end
18
+
19
+ def decrypt_file(file_path)
20
+ decrypt File.read(file_path)
21
+ end
22
+
23
+ def keyring_from_file(filename)
24
+ file = File.open(filename)
25
+ keyring_from_stream(file.to_inputstream)
26
+ end
27
+
28
+ def keyring_from_string(key_string)
29
+ keyring_from_stream PGP.string_to_bais(key_string)
30
+ end
31
+
32
+ def keyring_from_stream(stream)
33
+ yafs = PGPUtil.get_decoder_stream(stream)
34
+ PGPPublicKeyRingCollection.new(yafs)
35
+ end
36
+
37
+ end
38
+ end
@@ -1,3 +1,3 @@
1
1
  module PGP
2
- VERSION = '0.2.0'
2
+ VERSION = '0.3.0'
3
3
  end
@@ -20,4 +20,21 @@ describe PGP::Decryptor do
20
20
  decryptor.decrypt(encrypted_text).should == unencrypted_text
21
21
  end
22
22
  end
23
+
24
+ describe "decrypt with private key and passphrase" do
25
+ let(:private_key_with_passphrase_path) { Fixtures_Path.join('private_key_with_passphrase.asc') }
26
+ let(:encrypted_with_passphrase_file) { Fixtures_Path.join('encrypted_with_passphrase_key.txt.asc') }
27
+ let(:encrypted_text) { File.read(encrypted_with_passphrase_file) }
28
+ let(:unencrypted_text) { File.read(Fixtures_Path.join('encrypted_with_passphrase_key.txt'))}
29
+ let(:passphrase) { "testingpgp" }
30
+ before do
31
+ decryptor.passphrase = passphrase
32
+ decryptor.add_keys_from_file(private_key_with_passphrase_path)
33
+ end
34
+ it "should decrypt" do
35
+ decryptor.decrypt(encrypted_text).should == unencrypted_text
36
+ end
37
+
38
+ end
39
+
23
40
  end
@@ -0,0 +1,44 @@
1
+ require 'spec_helper'
2
+
3
+ describe PGP::Signer do
4
+ let(:private_key_path) { Fixtures_Path.join('private_key_with_passphrase.asc').to_s }
5
+ let(:public_key_path) { Fixtures_Path.join('public_key_with_passphrase.asc').to_s }
6
+
7
+ let(:signer) do
8
+ signer = PGP::Signer.new
9
+ signer.passphrase = "testingpgp"
10
+ signer.add_keys_from_file(private_key_path)
11
+ signer
12
+ end
13
+
14
+ let(:unsigned_file) { Fixtures_Path.join('signed_file.txt') }
15
+ let(:unsigned_data) { File.read(unsigned_file)}
16
+ let(:signed_file) { Fixtures_Path.join('signed_file.txt.asc') }
17
+ let(:verifier) do
18
+ verifier = PGP::Verifier.new
19
+ verifier.add_keys_from_file(public_key_path)
20
+ verifier
21
+ end
22
+
23
+ describe '#sign' do
24
+
25
+ it "signs" do
26
+ verifier.verify(signer.sign(unsigned_data)).should == unsigned_data
27
+ end
28
+
29
+ end
30
+
31
+ describe "encrypting and signing" do
32
+ let(:encryptor) { PGP::Encryptor.new(File.read public_key_path) }
33
+ let(:decryptor) do
34
+ decryptor = PGP::Decryptor.new
35
+ decryptor.passphrase = "testingpgp"
36
+ decryptor.add_keys_from_file(private_key_path)
37
+ decryptor
38
+ end
39
+ it "can decrypt and verify something that has been signed and encrypted" do
40
+ verifier.verify(decryptor.decrypt(encryptor.encrypt(signer.sign("something fabulous")))).should == "something fabulous"
41
+ end
42
+ end
43
+
44
+ end
@@ -0,0 +1,33 @@
1
+ require 'spec_helper'
2
+
3
+ describe PGP::Verifier do
4
+ let(:public_key_path) { Fixtures_Path.join('public_key_with_passphrase.asc').to_s }
5
+
6
+ let(:verifier) { PGP::Verifier.new }
7
+ let(:unsigned_file) { Fixtures_Path.join('signed_file.txt') }
8
+ let(:signed_file) { Fixtures_Path.join('signed_file.txt.asc') }
9
+
10
+ describe '#verify' do
11
+ before do
12
+ verifier.add_keys_from_file(public_key_path)
13
+ end
14
+
15
+ context 'When the Public Key is from a file' do
16
+ it "verifies" do
17
+ verifier.verify(File.read(signed_file)).should == File.read(unsigned_file)
18
+ end
19
+ end
20
+
21
+
22
+ context 'When the public key cannot verify a signature' do
23
+ let(:public_key_path) { Fixtures_Path.join('wrong_public_key_for_signature.asc').to_s }
24
+
25
+ it "should raise an exception" do
26
+ expect {
27
+ verifier.verify(File.read(signed_file))
28
+ }.to raise_exception(org.sgonyea.pgp.VerificationFailedException, /Signature could not be verified/)
29
+ end
30
+ end
31
+ end
32
+
33
+ end
@@ -1,7 +1,5 @@
1
- require 'bundler/setup'
2
-
3
- Bundler.require :development, :test
4
-
1
+ require 'rspec'
2
+ require 'bundler'
5
3
  require 'jruby-pgp'
6
4
 
7
5
  Fixtures_Path = Bundler.root + 'spec/support/fixtures/'
@@ -0,0 +1 @@
1
+ here is some unencrypted stuff, yo
@@ -0,0 +1,13 @@
1
+ -----BEGIN PGP MESSAGE-----
2
+ Version: BCPG v1.48
3
+
4
+ hQEMA5U54ioziO4kAQf+NdzYMb6XwRHg52pbuknrDmQeW6qJBwdtn0rsG6eUTVtr
5
+ LoR3NEXNmBd+Hk2kPd10cQTQ6nVSvaJvgiu+9pVf6j/GGiNEWDNKqsLPokHN5uwv
6
+ 5VsRxNdfkChs7fYJf97fiSxt3I7OyCTx9r2R2Gy1kEx3+wwGfBZm+ZDUCs8W/TMs
7
+ lmGxliFqJ8MNWr7bbFvlDB5FPpeWFW6U2bYMGYAXx5bzIGM8a+CyglShdz6lLlLv
8
+ 831wGM1kK4eBHtyEKQa0bMqQ2y4p8BAToyMJTef1OFg4kDw4W6MgSlIgJcCCpUhN
9
+ oPLMqNLRv9SKqi+3GN8YmUmDjREBClb8jewAnnz9GMlT1s48T6KESXqwXwAZmF7o
10
+ LHTmCnW3HOKy0aUgZuEDjJPCinEI21gZ7hW35XIKIJQ/hIxar1C9bDbYXboo9uIt
11
+ Jwk/lT3994V3Pw763v6SeaXMcCw=
12
+ =xYIS
13
+ -----END PGP MESSAGE-----
@@ -0,0 +1,59 @@
1
+ -----BEGIN PGP PRIVATE KEY BLOCK-----
2
+ Version: GnuPG v1.4.12 (Darwin)
3
+
4
+ lQO+BFE1G+YBCACbAxhkShGGLEvCcA60zD1ozlgE2Ed0U92/iCVQBkY05Y8F0sxq
5
+ NwaJfi+IbSeGq4PVrqEzOsD7pPGRwAkZ9dkzYJVC6jnflQPEYdF12HePQ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sR6L3q65JU11mE2P/2Q2W+eYwjFDffhEXcd8/SY2EWuGehw==
29
+ =OnFp
30
+ -----END PGP PUBLIC KEY BLOCK-----
@@ -0,0 +1 @@
1
+ Here is some stuff to sign, yo
@@ -0,0 +1,14 @@
1
+ -----BEGIN PGP MESSAGE-----
2
+ Version: BCPG v1.48
3
+
4
+ owJ4nJvAy8zAxDjV8pGWccc7FcbTJkn8xZnpeakp8WmZOal6JRUlgZZ8azxSi1IV
5
+ MosVivNzUxWKS0rT0hRK8hVACnUUKvO5OhndWRgYmRgMWZmAqk9oyThnFAFV+6Xm
6
+ FOfnKdgUlxakFiWDhPLAIg7puYmZOXrJ+bl2DFycAjDLS5LY//sEH7GKr3Pd8+aW
7
+ 0zNBkWiVPxF2z+xketdnJzsebj/NvvLN6pV/9P1+VmjMj7jdrnK51iTz397Y5loF
8
+ BWfLyWed/v8q6J57U/7k+dbXauaCW/7um/RuGr+Iamc895Yr5g23r4jPebDDb3Z6
9
+ 7B6bcIW1KzOOHXXNcdo2jcv8OLPVh5im7CUSNyY3vH5TUdfA2bn9SIqqpEHq6eM7
10
+ BL3EzT86FSf9ivXk32lq3vzGn+1wtsOsKSsMBD9bHbG+VOggefpm0vx/ejcny3xM
11
+ Xlh20G1mnNnPzezvrvueO3HW2UF12op1E9VWBxmofnHbtXbe5nPzeG64tk9W9lq4
12
+ 8sjOm3ZaD1aWBu8R4K2cfrH7hgEAwrOvhQ==
13
+ =nUp1
14
+ -----END PGP MESSAGE-----
@@ -0,0 +1,63 @@
1
+ -----BEGIN PGP PRIVATE KEY BLOCK-----
2
+ Version: GnuPG/MacGPG2 v2.0.18 (Darwin)
3
+
4
+ lQOYBFE6kEoBCACk3kXNCj84My+mzx17/VLkZFP1c8/4QuULK+6LiJdMdTYM0XFZ
5
+ NAr5Pk/CCCI+1NeB/e7ZUF8gbfmCA9NNkT8NQX49w3SUKlmvHll7kepmlq8VbqgE
6
+ wskjaP7hO9Q9H90p9pNpimVNPFNq8b6FJti5p9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eXjJNQnzKhNVIDrOtH/CgMLUZsHsLYhxImvpUaWxx/ubrSHh9
25
+ L7aYWxRkRqiGJ6PSaSJzS9xX5/gSdwpsp1Z5WmMfVoaX24wIDtCBOvj+uhc+MzEi
26
+ atP1w8JRzLFggLmJ8Qs0OqYpGOjRFnw/+wPJ8aWu1Z+z/25SRdj+qIYnQa9KS/qt
27
+ FOqO8RoULzqodE4i6gvf8DBe1ynsIWEoQtZZpEDGmWy/APVsjetQ1MVtNRIpvXo8
28
+ fVy2+MiRc5XwdwaNXxKoi8xisLno3wGX3HvVoRRVp5/b8dI+xXXDZC3w3PN6DQ7e
29
+ Cn0FZwSawc0rSlcNmSs361RejgB9owf/bW3tsrirRw22eJiE1FNXqV7Ice4ChH3z
30
+ rynP69YyS85Rc/P5gwHvuTYoq0a9sK9Ob/HKzW7qijaniW4zQkXysYiYNiOuTME+
31
+ zqeFFh3L2U0aWroiu9dkrwckGqALsTo1xFKKdf3UzkGGdjjPd0pobjFi3KaFFWFM
32
+ NAhq0g7XGc2RGkzJVb9mnZky4+RoJVmgy/7obAxcn4B9QLg8CKU4r5EegNrUWcB6
33
+ 5aRGo24XJP2PbaWexC+5fRzvWfuIdIUM0covGmnFyXfzeE8zlcmXx6f00cCcMiw8
34
+ XFTa39eqeG+pxntgG8pRrjfXkiAMHgRv70iSO2ESRbBdeN6ThRkKsg==
35
+ =66YG
36
+ -----END PGP PUBLIC KEY BLOCK-----
metadata CHANGED
@@ -1,134 +1,185 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: jruby-pgp
3
- version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 0.2.0
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.3.0
6
6
  platform: ruby
7
- authors:
8
- - Scott Gonyea
9
- autorequire:
7
+ authors:
8
+ - Scott Gonyea
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2013-01-04 00:00:00 Z
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: jruby-openssl
17
- prerelease: false
18
- requirement: &id001 !ruby/object:Gem::Requirement
19
- none: false
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
23
- version: "0"
24
- type: :runtime
25
- version_requirements: *id001
26
- - !ruby/object:Gem::Dependency
27
- name: rake
28
- prerelease: false
29
- requirement: &id002 !ruby/object:Gem::Requirement
30
- none: false
31
- requirements:
32
- - - ">="
33
- - !ruby/object:Gem::Version
34
- version: "0"
35
- type: :development
36
- version_requirements: *id002
37
- - !ruby/object:Gem::Dependency
38
- name: rspec
39
- prerelease: false
40
- requirement: &id003 !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ">="
44
- - !ruby/object:Gem::Version
45
- version: "0"
46
- type: :development
47
- version_requirements: *id003
48
- - !ruby/object:Gem::Dependency
49
- name: rake-compiler
50
- prerelease: false
51
- requirement: &id004 !ruby/object:Gem::Requirement
52
- none: false
53
- requirements:
54
- - - ">="
55
- - !ruby/object:Gem::Version
56
- version: "0"
57
- type: :development
58
- version_requirements: *id004
12
+ date: 2013-03-09 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: jruby-openssl
16
+ version_requirements: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: !binary |-
21
+ MA==
22
+ none: false
23
+ requirement: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: !binary |-
28
+ MA==
29
+ none: false
30
+ prerelease: false
31
+ type: :runtime
32
+ - !ruby/object:Gem::Dependency
33
+ name: rake
34
+ version_requirements: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ">="
37
+ - !ruby/object:Gem::Version
38
+ version: !binary |-
39
+ MA==
40
+ none: false
41
+ requirement: !ruby/object:Gem::Requirement
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: !binary |-
46
+ MA==
47
+ none: false
48
+ prerelease: false
49
+ type: :development
50
+ - !ruby/object:Gem::Dependency
51
+ name: rspec
52
+ version_requirements: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: !binary |-
57
+ MA==
58
+ none: false
59
+ requirement: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: !binary |-
64
+ MA==
65
+ none: false
66
+ prerelease: false
67
+ type: :development
68
+ - !ruby/object:Gem::Dependency
69
+ name: rake-compiler
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: !binary |-
75
+ MA==
76
+ none: false
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: !binary |-
82
+ MA==
83
+ none: false
84
+ prerelease: false
85
+ type: :development
59
86
  description: PGP for JRuby
60
- email:
61
- - me@sgonyea.com
62
- executables:
63
- - jrpgp
87
+ email:
88
+ - me@sgonyea.com
89
+ executables:
90
+ - jrpgp
64
91
  extensions: []
65
-
66
92
  extra_rdoc_files: []
67
-
68
- files:
69
- - .gitignore
70
- - .rspec
71
- - Gemfile
72
- - LICENSE.txt
73
- - README.md
74
- - Rakefile
75
- - bin/jrpgp
76
- - ext/org/sgonyea/pgp/Decryptor.java
77
- - ext/org/sgonyea/pgp/Encryptor.java
78
- - jruby-pgp.gemspec
79
- - lib/jruby-pgp.rb
80
- - lib/pgp.rb
81
- - lib/pgp/cli.rb
82
- - lib/pgp/cli/runner.rb
83
- - lib/pgp/decryptor.rb
84
- - lib/pgp/encryptor.rb
85
- - lib/pgp/jars/bcpg-jdk15on-147.jar
86
- - lib/pgp/jars/bcprov-jdk15on-147.jar
87
- - lib/pgp/private_key.rb
88
- - lib/pgp/ruby_decryptor.rb
89
- - lib/pgp/version.rb
90
- - spec/lib/pgp/cli_spec.rb
91
- - spec/lib/pgp/decryptor_spec.rb
92
- - spec/lib/pgp/encryptor_spec.rb
93
- - spec/spec_helper.rb
94
- - spec/support/fixtures/private_key.asc
95
- - spec/support/fixtures/public_key.asc
96
- - spec/support/fixtures/unencrypted_file.txt
97
- - spec/support/fixtures/unencrypted_file.txt.asc
98
- - lib/pgp/jruby-pgp.jar
93
+ files:
94
+ - ".gitignore"
95
+ - ".rbenv-version"
96
+ - ".rspec"
97
+ - Gemfile
98
+ - LICENSE.txt
99
+ - README.md
100
+ - Rakefile
101
+ - bin/jrpgp
102
+ - ext/org/sgonyea/pgp/Decryptor.java
103
+ - ext/org/sgonyea/pgp/Encryptor.java
104
+ - ext/org/sgonyea/pgp/PGPExampleUtil.java
105
+ - ext/org/sgonyea/pgp/Signer.java
106
+ - ext/org/sgonyea/pgp/VerificationFailedException.java
107
+ - ext/org/sgonyea/pgp/Verifier.java
108
+ - jruby-pgp.gemspec
109
+ - lib/jruby-pgp.rb
110
+ - lib/pgp.rb
111
+ - lib/pgp/cli.rb
112
+ - lib/pgp/cli/runner.rb
113
+ - lib/pgp/decryptor.rb
114
+ - lib/pgp/encryptor.rb
115
+ - lib/pgp/jars/bcpg-jdk15on-147.jar
116
+ - lib/pgp/jars/bcprov-jdk15on-147.jar
117
+ - lib/pgp/private_key.rb
118
+ - lib/pgp/ruby_decryptor.rb
119
+ - lib/pgp/signer.rb
120
+ - lib/pgp/verifier.rb
121
+ - lib/pgp/version.rb
122
+ - spec/lib/pgp/cli_spec.rb
123
+ - spec/lib/pgp/decryptor_spec.rb
124
+ - spec/lib/pgp/encryptor_spec.rb
125
+ - spec/lib/pgp/signer_spec.rb
126
+ - spec/lib/pgp/verifier_spec.rb
127
+ - spec/spec_helper.rb
128
+ - spec/support/fixtures/encrypted_with_passphrase_key.txt
129
+ - spec/support/fixtures/encrypted_with_passphrase_key.txt.asc
130
+ - spec/support/fixtures/private_key.asc
131
+ - spec/support/fixtures/private_key_with_passphrase.asc
132
+ - spec/support/fixtures/public_key.asc
133
+ - spec/support/fixtures/public_key_with_passphrase.asc
134
+ - spec/support/fixtures/signed_file.txt
135
+ - spec/support/fixtures/signed_file.txt.asc
136
+ - spec/support/fixtures/unencrypted_file.txt
137
+ - spec/support/fixtures/unencrypted_file.txt.asc
138
+ - spec/support/fixtures/wrong_private_key_for_signature.asc
139
+ - spec/support/fixtures/wrong_public_key_for_signature.asc
140
+ - lib/pgp/jruby-pgp.jar
99
141
  homepage: https://github.com/sgonyea/jruby-pgp
100
142
  licenses: []
101
-
102
- post_install_message:
143
+ post_install_message:
103
144
  rdoc_options: []
104
-
105
- require_paths:
106
- - lib
107
- required_ruby_version: !ruby/object:Gem::Requirement
145
+ require_paths:
146
+ - lib
147
+ required_ruby_version: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - ">="
150
+ - !ruby/object:Gem::Version
151
+ version: !binary |-
152
+ MA==
108
153
  none: false
109
- requirements:
110
- - - ">="
111
- - !ruby/object:Gem::Version
112
- version: "0"
113
- required_rubygems_version: !ruby/object:Gem::Requirement
154
+ required_rubygems_version: !ruby/object:Gem::Requirement
155
+ requirements:
156
+ - - ">="
157
+ - !ruby/object:Gem::Version
158
+ version: !binary |-
159
+ MA==
114
160
  none: false
115
- requirements:
116
- - - ">="
117
- - !ruby/object:Gem::Version
118
- version: "0"
119
161
  requirements: []
120
-
121
- rubyforge_project:
122
- rubygems_version: 1.8.9
123
- signing_key:
162
+ rubyforge_project:
163
+ rubygems_version: 1.8.24
164
+ signing_key:
124
165
  specification_version: 3
125
166
  summary: This is a Java+JRuby wrapper around the Bouncy Castle PGP APIs
126
- test_files:
127
- - spec/lib/pgp/cli_spec.rb
128
- - spec/lib/pgp/decryptor_spec.rb
129
- - spec/lib/pgp/encryptor_spec.rb
130
- - spec/spec_helper.rb
131
- - spec/support/fixtures/private_key.asc
132
- - spec/support/fixtures/public_key.asc
133
- - spec/support/fixtures/unencrypted_file.txt
134
- - spec/support/fixtures/unencrypted_file.txt.asc
167
+ test_files:
168
+ - spec/lib/pgp/cli_spec.rb
169
+ - spec/lib/pgp/decryptor_spec.rb
170
+ - spec/lib/pgp/encryptor_spec.rb
171
+ - spec/lib/pgp/signer_spec.rb
172
+ - spec/lib/pgp/verifier_spec.rb
173
+ - spec/spec_helper.rb
174
+ - spec/support/fixtures/encrypted_with_passphrase_key.txt
175
+ - spec/support/fixtures/encrypted_with_passphrase_key.txt.asc
176
+ - spec/support/fixtures/private_key.asc
177
+ - spec/support/fixtures/private_key_with_passphrase.asc
178
+ - spec/support/fixtures/public_key.asc
179
+ - spec/support/fixtures/public_key_with_passphrase.asc
180
+ - spec/support/fixtures/signed_file.txt
181
+ - spec/support/fixtures/signed_file.txt.asc
182
+ - spec/support/fixtures/unencrypted_file.txt
183
+ - spec/support/fixtures/unencrypted_file.txt.asc
184
+ - spec/support/fixtures/wrong_private_key_for_signature.asc
185
+ - spec/support/fixtures/wrong_public_key_for_signature.asc