nuntius 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in nuntius.gemspec
4
+ gemspec
@@ -0,0 +1,93 @@
1
+ # Nuntius:
2
+
3
+ > A messenger, reporter, courier, bearer of news or tidings
4
+
5
+ Nuntius is a simple scheme to send and receive messages in a cryptographicaly secure and compatible way.
6
+
7
+ ## Usage
8
+
9
+ ### Encript a Message
10
+
11
+ ```ruby
12
+ require 'nuntius'
13
+
14
+ sender = Nuntius::Key.new( File.read('private_key_path') )
15
+ messenger = Nuntius::Mesenger.new({
16
+ :key => sender
17
+ })
18
+
19
+ receiver = Nuntius::Key.new( File.read('public_key_path') )
20
+
21
+ envelope = messenger.wrap({
22
+ :message => "Message Content",
23
+ :to => receiver
24
+ })
25
+
26
+ envelope.data
27
+ # => The encripted message
28
+ envelope.key
29
+ # => The encripted message key
30
+ envelope.signature
31
+ # => The encripted message signature
32
+ ```
33
+
34
+ ### Decript a message
35
+
36
+ ```ruby
37
+ require 'nuntius'
38
+
39
+ receiver = Nuntius::Key.new( File.read('private_key_path') )
40
+ messenger = Nuntius::Mesenger.new({
41
+ :key => receiver
42
+ })
43
+
44
+ sender = Nuntius::Key.new( File.read('public_key_path') )
45
+
46
+ envelope = Nuntius::Envelope.new({
47
+ :data => 'The encripted message'
48
+ :key => 'The encripted message key'
49
+ :signature => 'The encripted message signature'
50
+ })
51
+
52
+ message = messenger.unwrap({
53
+ :envelope => envelope,
54
+ :from => sender
55
+ })
56
+
57
+ message
58
+ # => The verified and decripted raw message
59
+ ```
60
+
61
+ ## Encription Scheme
62
+
63
+ Under the hood Nuntius is just a wrapper around OpenSSL and by default uses [RSA]( http://en.wikipedia.org/wiki/RSA_%28algorithm%29 ), [AES](http://en.wikipedia.org/wiki/Advanced_Encryption_Standard) in [CBC mode](http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Cipher-block_chaining_.28CBC.29) and [SHA512](http://en.wikipedia.org/wiki/SHA512) to encript/decript and sign/verify the messages and [URL Safe Base64](http://en.wikipedia.org/wiki/Base64#RFC_4648) to encode/decode the results.
64
+
65
+ The whole scheme can be sumarized in 4 steps:
66
+
67
+ * The message is encripted using AES-256-CBC with a randomly generated key.
68
+ * The key is then encrypted using the receiver's public RSA key.
69
+ * The encripted message's digest is calculated using SHA512 and then signed using the sender's private RSA key.
70
+ * Finally the encripted message, the encripted key and the signed digest are encoded using the RFC4648 URL Safe Base 64 encoding
71
+
72
+ In other terms, encrypting a message with nuntius is the same as doing
73
+
74
+ ```ruby
75
+ require 'openssl'
76
+
77
+ sender = OpenSSL::PKey::RSA.new( File.read('sender_private_key') )
78
+ receiver = OpenSSL::PKey::RSA.new( File.read('receiver_public_key') )
79
+
80
+ cipher = OpenSSL::Cipher.new("AES-256-CBC").encrypt
81
+
82
+ key = receiver.public_encrypt( cipher.random_key )
83
+
84
+ data = cipher.update("message") + cipher.final
85
+
86
+ signature = receiver.private_encrypt( OpenSSL::Digest::SHA512.new(data).digest )
87
+
88
+ result = {
89
+ :data => [data].pack("m0").tr("+/","-_").gsub("=","")
90
+ :key => [key].pack("m0").tr("+/","-_").gsub("=","")
91
+ :signature => [signature].pack("m0").tr("+/","-_").gsub("=","")
92
+ }
93
+ ```
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,11 @@
1
+ require 'openssl'
2
+
3
+ module Nuntius
4
+ class Error < RuntimeError; end
5
+ end
6
+
7
+ require "nuntius/version"
8
+ require "nuntius/encodings"
9
+ require "nuntius/key"
10
+ require "nuntius/envelope"
11
+ require "nuntius/messenger"
@@ -0,0 +1,9 @@
1
+ module Nuntius
2
+ module Encodings
3
+ class DecodingError < Error; end
4
+ end
5
+ end
6
+
7
+ %w{url_safe_base64}.each do |encoding|
8
+ require "nuntius/encodings/#{encoding}"
9
+ end
@@ -0,0 +1,26 @@
1
+ module Nuntius
2
+ module Encodings
3
+
4
+ # Encode/Decode messages using RFC4648 Base 64 Encoding
5
+ # with URL and Filename Safe Alphabet {http://tools.ietf.org/html/rfc4648#section-5}
6
+ module URLSafeBase64
7
+ BASE_CHARACTERS = "+/"
8
+ REPLACEMENT_CHARACTERS = "-_"
9
+ PADDING_CHARACTER = "="
10
+
11
+ def self.encode(bin)
12
+ [bin].pack("m0").tr(BASE_CHARACTERS,REPLACEMENT_CHARACTERS).gsub(PADDING_CHARACTER,'')
13
+ end
14
+
15
+ def self.decode(bin)
16
+ padding = (4 - (bin.length % 4)) % 4
17
+ ( bin.tr(REPLACEMENT_CHARACTERS, BASE_CHARACTERS) + ( PADDING_CHARACTER * padding ) ).unpack("m0").first
18
+ rescue ArgumentError
19
+ raise Nuntius::Encodings::DecodingError.new 'Invalid Base64'
20
+ end
21
+
22
+ end
23
+
24
+ end
25
+ end
26
+
@@ -0,0 +1,45 @@
1
+ module Nuntius
2
+ class Envelope
3
+ include Enumerable
4
+ attr_accessor :data, :key, :signature
5
+
6
+ def initialize(attributes)
7
+ self.data = attributes[:raw_data] ? encode(attributes[:raw_data]) : attributes[:data]
8
+ self.key = attributes[:raw_key] ? encode(attributes[:raw_key]) : attributes[:key]
9
+ self.signature = attributes[:raw_signature] ? encode(attributes[:raw_signature]) : attributes[:signature]
10
+ end
11
+
12
+ def to_hash
13
+ {
14
+ :data => data,
15
+ :key => key,
16
+ :signature => signature
17
+ }
18
+ end
19
+
20
+ def raw_data
21
+ decode data
22
+ end
23
+
24
+ def raw_key
25
+ decode key
26
+ end
27
+
28
+ def raw_signature
29
+ decode signature
30
+ end
31
+
32
+ def each(&block)
33
+ self.to_hash.each(&block)
34
+ end
35
+
36
+ protected
37
+ def encode(string)
38
+ Encodings::URLSafeBase64.encode(string)
39
+ end
40
+
41
+ def decode(string)
42
+ Encodings::URLSafeBase64.decode(string)
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,30 @@
1
+ module Nuntius
2
+ class Key
3
+ def initialize(key_data)
4
+ @key = OpenSSL::PKey::RSA.new(key_data)
5
+ end
6
+
7
+ def private?
8
+ @key.private?
9
+ end
10
+
11
+ def sign(string)
12
+ digest = OpenSSL::Digest::SHA512.new.digest(string)
13
+
14
+ @key.private_encrypt(digest)
15
+ end
16
+
17
+ def validate(message,signature)
18
+ digest = OpenSSL::Digest::SHA512.new.digest(message)
19
+ digest == @key.public_decrypt(signature)
20
+ end
21
+
22
+ def encrypt(string)
23
+ @key.public_encrypt(string)
24
+ end
25
+
26
+ def decrypt(string)
27
+ @key.private_decrypt(string)
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,37 @@
1
+ module Nuntius
2
+ class Messenger
3
+ attr_accessor :key
4
+
5
+ def initialize(attributes)
6
+ self.key = attributes[:key]
7
+ end
8
+
9
+ def wrap(options)
10
+ cipher = OpenSSL::Cipher.new('AES-256-CBC').encrypt
11
+
12
+ key = options[:to].encrypt( cipher.random_key )
13
+ data = cipher.update( options[:message] ) + cipher.final
14
+ signature = @key.sign(data)
15
+
16
+ Envelope.new({
17
+ :raw_data => data,
18
+ :raw_key => key,
19
+ :raw_signature => signature
20
+ })
21
+ end
22
+
23
+ def unwrap(options)
24
+ data = options[:envelope].raw_data
25
+ signature = options[:envelope].raw_signature
26
+
27
+ options[:from].validate(data, signature)
28
+
29
+ key = @key.decrypt options[:envelope].raw_key
30
+
31
+ cipher = OpenSSL::Cipher.new('AES-256-CBC').decrypt
32
+ cipher.key = key
33
+
34
+ cipher.update(data) + cipher.final
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,3 @@
1
+ module Nuntius
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,23 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "nuntius/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "nuntius"
7
+ s.version = Nuntius::VERSION
8
+ s.author = "Sebastian Gamboa"
9
+ s.email = "me@sagmor.com"
10
+ s.homepage = "https://github.com/sagmor/nuntius"
11
+ s.summary = %q{Nuntius: A messenger, reporter, courier, bearer of news or tidings}
12
+ s.description = %q{Nuntius is a simple scheme to send and receive messages in a cryptographicaly secure and compatible way.}
13
+
14
+ s.rubyforge_project = "nuntius"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ s.add_development_dependency "rake"
22
+ s.add_development_dependency "rspec", ">= 2.7.0"
23
+ end
@@ -0,0 +1,27 @@
1
+ -----BEGIN RSA PRIVATE KEY-----
2
+ MIIEpQIBAAKCAQEA5ApVWuSH8hmUU0t855uMnisyJSz4/HpNm+s9pFRCml3AsUKf
3
+ 0pFcLyip12XrzU489lOzO3vDmt5gFKEULRhR2xTqvqGO+PIcjsDtvWOUN07BOlBU
4
+ PuvkqulNZpb0A0wEuMwEQ40uzcte78e9zxieKt7mXfBcGrWwnFNVH73hX2zQXi2H
5
+ AW8aWpkTC7RpHx7iSun0eHEo/xwhf33yIL9UIk5ebYuurEXuUZSkbE99QRgGoyYR
6
+ M+J0IPFsJMpq4Dl+NaiiA9373nxgtdlgE7Ms9xwDuIR+SCnZ30IE+qZZTy8FzjJ8
7
+ E6/mtDU+VLgYYNJPNhQrUYo+qzwFdcfCSiyjLwIDAQABAoIBAQDBilujBu6ydS9D
8
+ +n+J+qS/4R1wG9k+P3b67A6nF7RnW0adq1QF3MUGaVasr54P42UuEx+9Tm9XU4Ds
9
+ QUHkfA2NCRWqsWestZ+zMN8VrBwxTLAGlALMXFz5CYVdmqSC39PqG41K39pnY0Gx
10
+ 9C6OQ/CJpiCSfdtN+AJqyvcmN3u+BfvLBQ7dNXJP4kBgo918trkumPgk8ZO6bnQB
11
+ 7b4JeGZWQ0Tk/GMhdC/j6RYDTtjpqe9wNXmc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TOuhqYdeR3F50qARIl8im7JBBnJtj5Z5HzefO7MODVgJQlGHB5NPWU
26
+ 7BcrPH0xUlnLAqLes6mPiVCVElUgCf9X3/qepX/2qXlesOehTZfp
27
+ -----END RSA PRIVATE KEY-----
@@ -0,0 +1,9 @@
1
+ -----BEGIN PUBLIC KEY-----
2
+ MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAux0cSSixp54Q9O65y3ts
3
+ UGj3AtKYSo1H6SDlDkGsYu0/y11MJSdRPvI1Pyb3ZYaQ5J2yiWj6OPTGtTHBSyRx
4
+ emHdRbAVQHukx/LBpeFKzr5YGgiVK5GUsE3MKHY5R8HBtevLv89c56vKaaEApYjM
5
+ imw5qGciknEMRDNstq45F+RHl1QE0fVx/LEsapj4EfsBnJH0761jMXoW1T3G4krF
6
+ 5PPDvxCydSbZilMCHad0eqr1YQATrF58HwSaS0WqqeUMJHN8YxHtU7nFVWnnFFtv
7
+ jLUY/KUFLVfGDju+HXv1FAUrpjSHPY9gGELFP8sepD26Me8iIAkIy3joZXvoyKNp
8
+ rQIDAQAB
9
+ -----END PUBLIC KEY-----
@@ -0,0 +1,36 @@
1
+ require 'spec_helper'
2
+
3
+ describe Nuntius::Encodings::URLSafeBase64 do
4
+
5
+ before(:all) do
6
+ @samples = {
7
+ "" => "",
8
+ "Hello World" => "SGVsbG8gV29ybGQ",
9
+ OpenSSL::Digest::SHA512.new("").digest =>
10
+ "z4PhNX7vuL3xVChQ1m2AB9Yg5AULVxXcg_SpIdNs6c5H0NE8XYXysP-DGNKHfuwvY7kxvUdBeoGlODJ6-SfaPg",
11
+ "The quick brown fox jumps over the lazy dog" =>
12
+ "VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZw"
13
+ }
14
+ end
15
+
16
+ before(:each) do
17
+ @encoder = Nuntius::Encodings::URLSafeBase64
18
+ end
19
+
20
+ it "should encode messages using RFC4648 compatible Base 64 Encoding with URL and Filename Safe Alphabet" do
21
+ @samples.each do |string,expected|
22
+ @encoder.encode(string).should == expected
23
+ end
24
+ end
25
+
26
+ it "should decode valid RFC4648 compatible Base 64 Encoding with URL and Filename Safe Alphabet messages" do
27
+ @samples.each do |expected,string|
28
+ @encoder.decode(string).should == expected
29
+ end
30
+ end
31
+
32
+ it "should raise an exception on wrongly encoded messages" do
33
+ expect { @encoder.decode "wrong encoding" }.to raise_error(Nuntius::Encodings::DecodingError)
34
+ end
35
+
36
+ end
@@ -0,0 +1,6 @@
1
+
2
+ require 'spec_helper'
3
+
4
+ describe Nuntius::Envelope do
5
+
6
+ end
@@ -0,0 +1,6 @@
1
+
2
+ require 'spec_helper'
3
+
4
+ describe Nuntius::Key do
5
+
6
+ end
@@ -0,0 +1,26 @@
1
+ require 'spec_helper'
2
+
3
+ describe Nuntius::Messenger do
4
+ before(:each) do
5
+ @messenger = Nuntius::Messenger.new key: get_key('bob.pem')
6
+ @alice = get_key('alice.pub')
7
+ end
8
+
9
+ it "should encrypt and sign messages" do
10
+ @envelope = @messenger.wrap message: "Hello Allice", to: @alice
11
+
12
+ @envelope.key.should_not be_nil
13
+ @envelope.signature.should_not be_nil
14
+ @envelope.data.should_not be_nil
15
+ end
16
+
17
+ it "should decrypt valid messages" do
18
+ @envelope = Nuntius::Envelope.new({
19
+ data: "EiOgHgmZQ6Lsg1QKobu5AA",
20
+ key: "PjLZjiwU9kZlOsDYhiiwf_P7Vkvd3l-rtk5MMU7EoYyObTj_H52ujyHlwuzDjgI_KyGKU95U5F8zDrjegsVTkhN6b1t73BQ8ImEOXwsicb1hwsaKbDT3PJLR5c0Zk-x_RbaAEE-7Sd3Vodg0qJul1v0b6us-uJZNX5sqjsfvvQn_LCVtgtvWKru_YzLwxVsZD4tNCu_misl6D-BOewkOHovwGiJPqirvSTR7jPWNPbQHgSL0xvdqFL6kEAwzJ_p5Oj1KH68dNeRhBKU8HwSfc8ZEMCTlcwVWMlc2NcxNhiSbjSxCHjawK5zegviqlhYhzw9J_HDMIMMe7K4gk3O_iA",
21
+ signature: "FF5BhVNFzcoQQbV9_MOsgBHpaLLWKIe0AxmXwx7dOU5QlRmlwzdJhKdQOCUHmbuJIqTfR444kEznQTyAKF66Pmk7UgFniKcmPLPHSfYf5e5BzUkYb2oXI1yqk3qOl9NTb82oVinBOQweufNyo1rmH6b5GrB811xQmzTco7Frogzt5aWGC7BY9x2FWoes633vOMvC4z3kprL4XQVVH2cqIqIvbBXtFteIagy_90HsLA4mfjf1ku5Sjzv5789L2lUUc2oCic5BqUAx0AQ2y9I_q0J8uu4MXCX3vD53Iq5IsrCr2-h6f1nWoHbYWf6aDU4pYGOqStQJRYkurnlh7docFA"
22
+ })
23
+
24
+ @messenger.unwrap(envelope: @envelope, from: @alice).should == "Hello Bob!"
25
+ end
26
+ end
@@ -0,0 +1,9 @@
1
+ require 'bundler/setup'
2
+
3
+ require 'nuntius'
4
+
5
+ Dir["spec/support/**/*.rb"].each { |f| require File.expand_path(f) }
6
+
7
+ RSpec.configure do |config|
8
+ # some (optional) config here
9
+ end
@@ -0,0 +1,3 @@
1
+ def get_key(key_name)
2
+ Nuntius::Key.new File.read( File.expand_path("../../keys/"+key_name, __FILE__) )
3
+ end
metadata ADDED
@@ -0,0 +1,105 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: nuntius
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Sebastian Gamboa
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-12-14 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rake
16
+ requirement: &70365147634180 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: *70365147634180
25
+ - !ruby/object:Gem::Dependency
26
+ name: rspec
27
+ requirement: &70365147654200 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: 2.7.0
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *70365147654200
36
+ description: Nuntius is a simple scheme to send and receive messages in a cryptographicaly
37
+ secure and compatible way.
38
+ email: me@sagmor.com
39
+ executables: []
40
+ extensions: []
41
+ extra_rdoc_files: []
42
+ files:
43
+ - .gitignore
44
+ - Gemfile
45
+ - README.md
46
+ - Rakefile
47
+ - lib/nuntius.rb
48
+ - lib/nuntius/encodings.rb
49
+ - lib/nuntius/encodings/url_safe_base64.rb
50
+ - lib/nuntius/envelope.rb
51
+ - lib/nuntius/key.rb
52
+ - lib/nuntius/messenger.rb
53
+ - lib/nuntius/version.rb
54
+ - nuntius.gemspec
55
+ - spec/keys/alice.pem
56
+ - spec/keys/alice.pub
57
+ - spec/keys/bob.pem
58
+ - spec/keys/bob.pub
59
+ - spec/nuntius/encodings/url_safe_base64_spec.rb
60
+ - spec/nuntius/envelope_spec.rb
61
+ - spec/nuntius/key_spec.rb
62
+ - spec/nuntius/messenger_spec.rb
63
+ - spec/spec_helper.rb
64
+ - spec/support/keys.rb
65
+ homepage: https://github.com/sagmor/nuntius
66
+ licenses: []
67
+ post_install_message:
68
+ rdoc_options: []
69
+ require_paths:
70
+ - lib
71
+ required_ruby_version: !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ segments:
78
+ - 0
79
+ hash: -4368469106361827398
80
+ required_rubygems_version: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ segments:
87
+ - 0
88
+ hash: -4368469106361827398
89
+ requirements: []
90
+ rubyforge_project: nuntius
91
+ rubygems_version: 1.8.10
92
+ signing_key:
93
+ specification_version: 3
94
+ summary: ! 'Nuntius: A messenger, reporter, courier, bearer of news or tidings'
95
+ test_files:
96
+ - spec/keys/alice.pem
97
+ - spec/keys/alice.pub
98
+ - spec/keys/bob.pem
99
+ - spec/keys/bob.pub
100
+ - spec/nuntius/encodings/url_safe_base64_spec.rb
101
+ - spec/nuntius/envelope_spec.rb
102
+ - spec/nuntius/key_spec.rb
103
+ - spec/nuntius/messenger_spec.rb
104
+ - spec/spec_helper.rb
105
+ - spec/support/keys.rb