akero 1.0.4 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. checksums.yaml +7 -0
  2. data/.gitattributes +3 -0
  3. data/.gitignore +0 -2
  4. data/.rubocop.yml +43 -0
  5. data/.travis.yml +3 -7
  6. data/Gemfile +1 -0
  7. data/Guardfile +4 -3
  8. data/Makefile +26 -0
  9. data/README.md +28 -10
  10. data/Rakefile +8 -17
  11. data/akero.gemspec +17 -10
  12. data/bin/akero +6 -0
  13. data/coverage/.last_run.json +5 -0
  14. data/coverage/.resultset.json +367 -0
  15. data/coverage/.resultset.json.lock +0 -0
  16. data/coverage/assets/0.10.0/application.css +799 -0
  17. data/coverage/assets/0.10.0/application.js +1707 -0
  18. data/coverage/assets/0.10.0/colorbox/border.png +0 -0
  19. data/coverage/assets/0.10.0/colorbox/controls.png +0 -0
  20. data/coverage/assets/0.10.0/colorbox/loading.gif +0 -0
  21. data/coverage/assets/0.10.0/colorbox/loading_background.png +0 -0
  22. data/coverage/assets/0.10.0/favicon_green.png +0 -0
  23. data/coverage/assets/0.10.0/favicon_red.png +0 -0
  24. data/coverage/assets/0.10.0/favicon_yellow.png +0 -0
  25. data/coverage/assets/0.10.0/loading.gif +0 -0
  26. data/coverage/assets/0.10.0/magnify.png +0 -0
  27. data/coverage/assets/0.10.0/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  28. data/coverage/assets/0.10.0/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  29. data/coverage/assets/0.10.0/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  30. data/coverage/assets/0.10.0/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  31. data/coverage/assets/0.10.0/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  32. data/coverage/assets/0.10.0/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  33. data/coverage/assets/0.10.0/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  34. data/coverage/assets/0.10.0/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  35. data/coverage/assets/0.10.0/smoothness/images/ui-icons_222222_256x240.png +0 -0
  36. data/coverage/assets/0.10.0/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
  37. data/coverage/assets/0.10.0/smoothness/images/ui-icons_454545_256x240.png +0 -0
  38. data/coverage/assets/0.10.0/smoothness/images/ui-icons_888888_256x240.png +0 -0
  39. data/coverage/assets/0.10.0/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
  40. data/coverage/assets/0.7.1/application.css +1110 -0
  41. data/coverage/assets/0.7.1/application.js +626 -0
  42. data/coverage/assets/0.7.1/fancybox/blank.gif +0 -0
  43. data/coverage/assets/0.7.1/fancybox/fancy_close.png +0 -0
  44. data/coverage/assets/0.7.1/fancybox/fancy_loading.png +0 -0
  45. data/coverage/assets/0.7.1/fancybox/fancy_nav_left.png +0 -0
  46. data/coverage/assets/0.7.1/fancybox/fancy_nav_right.png +0 -0
  47. data/coverage/assets/0.7.1/fancybox/fancy_shadow_e.png +0 -0
  48. data/coverage/assets/0.7.1/fancybox/fancy_shadow_n.png +0 -0
  49. data/coverage/assets/0.7.1/fancybox/fancy_shadow_ne.png +0 -0
  50. data/coverage/assets/0.7.1/fancybox/fancy_shadow_nw.png +0 -0
  51. data/coverage/assets/0.7.1/fancybox/fancy_shadow_s.png +0 -0
  52. data/coverage/assets/0.7.1/fancybox/fancy_shadow_se.png +0 -0
  53. data/coverage/assets/0.7.1/fancybox/fancy_shadow_sw.png +0 -0
  54. data/coverage/assets/0.7.1/fancybox/fancy_shadow_w.png +0 -0
  55. data/coverage/assets/0.7.1/fancybox/fancy_title_left.png +0 -0
  56. data/coverage/assets/0.7.1/fancybox/fancy_title_main.png +0 -0
  57. data/coverage/assets/0.7.1/fancybox/fancy_title_over.png +0 -0
  58. data/coverage/assets/0.7.1/fancybox/fancy_title_right.png +0 -0
  59. data/coverage/assets/0.7.1/fancybox/fancybox-x.png +0 -0
  60. data/coverage/assets/0.7.1/fancybox/fancybox-y.png +0 -0
  61. data/coverage/assets/0.7.1/fancybox/fancybox.png +0 -0
  62. data/coverage/assets/0.7.1/favicon_green.png +0 -0
  63. data/coverage/assets/0.7.1/favicon_red.png +0 -0
  64. data/coverage/assets/0.7.1/favicon_yellow.png +0 -0
  65. data/coverage/assets/0.7.1/loading.gif +0 -0
  66. data/coverage/assets/0.7.1/magnify.png +0 -0
  67. data/coverage/assets/0.7.1/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  68. data/coverage/assets/0.7.1/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  69. data/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  70. data/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  71. data/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  72. data/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  73. data/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  74. data/coverage/assets/0.7.1/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  75. data/coverage/assets/0.7.1/smoothness/images/ui-icons_222222_256x240.png +0 -0
  76. data/coverage/assets/0.7.1/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
  77. data/coverage/assets/0.7.1/smoothness/images/ui-icons_454545_256x240.png +0 -0
  78. data/coverage/assets/0.7.1/smoothness/images/ui-icons_888888_256x240.png +0 -0
  79. data/coverage/assets/0.7.1/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
  80. data/coverage/index.html +2248 -0
  81. data/doc/Akero/Message.html +475 -0
  82. data/doc/Akero.html +1148 -0
  83. data/doc/_index.html +125 -0
  84. data/doc/class_list.html +53 -0
  85. data/doc/css/common.css +1 -0
  86. data/doc/css/full_list.css +57 -0
  87. data/doc/css/style.css +338 -0
  88. data/doc/file.README.html +186 -0
  89. data/doc/file_list.html +55 -0
  90. data/doc/frames.html +28 -0
  91. data/doc/index.html +186 -0
  92. data/doc/js/app.js +214 -0
  93. data/doc/js/full_list.js +173 -0
  94. data/doc/js/jquery.js +4 -0
  95. data/doc/method_list.html +148 -0
  96. data/doc/top-level-namespace.html +112 -0
  97. data/lib/akero/benchmark.rb +21 -20
  98. data/lib/akero/cli.rb +74 -0
  99. data/lib/akero/version.rb +2 -1
  100. data/lib/akero.rb +92 -90
  101. data/spec/akero_spec.rb +66 -65
  102. data/spec/spec_helper.rb +1 -0
  103. metadata +164 -52
@@ -0,0 +1,186 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6
+ <title>
7
+ File: README
8
+
9
+ &mdash; Documentation by YARD 0.8.5.2
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ hasFrames = window.top.frames.main ? true : false;
19
+ relpath = '';
20
+ framesUrl = "frames.html#!" + escape(window.location.href);
21
+ </script>
22
+
23
+
24
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
25
+
26
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
27
+
28
+
29
+ </head>
30
+ <body>
31
+ <div id="header">
32
+ <div id="menu">
33
+
34
+ <a href="_index.html">Index</a> &raquo;
35
+ <span class="title">File: README</span>
36
+
37
+
38
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
39
+ </div>
40
+
41
+ <div id="search">
42
+
43
+ <a class="full_list_link" id="class_list_link"
44
+ href="class_list.html">
45
+ Class List
46
+ </a>
47
+
48
+ <a class="full_list_link" id="method_list_link"
49
+ href="method_list.html">
50
+ Method List
51
+ </a>
52
+
53
+ <a class="full_list_link" id="file_list_link"
54
+ href="file_list.html">
55
+ File List
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <iframe id="search_frame"></iframe>
63
+
64
+ <div id="content"><div id='filecontents'><h1>Akero <a href="https://travis-ci.org/busyloop/akero"><img src="https://travis-ci.org/busyloop/akero.png?branch=master" alt="Build Status"></a> <a href="https://gemnasium.com/busyloop/akero"><img src="https://gemnasium.com/busyloop/akero.png" alt="Dependency Status"></a></h1>
65
+
66
+ <p>Akero (<a href="http://en.wiktionary.org/wiki/%F0%90%80%80%F0%90%80%90%F0%90%80%AB">ἄγγελος</a>, messenger) is an easy-to-use library for peer-to-peer <a href="http://en.wikipedia.org/wiki/Public-key_cryptography">public key cryptography</a>. It enables two or more endpoints to exchange encrypted and/or signed messages without requiring a pre-shared secret.</p>
67
+
68
+ <p>Under the hood Akero uses standard OpenSSL primitives. Each instance wraps a <a href="http://en.wikipedia.org/wiki/RSA">RSA</a>-keypair, a corresponding <a href="http://en.wikipedia.org/wiki/X.509">X.509 certificate</a> and exchanges self-signed messages (<a href="https://tools.ietf.org/html/rfc2315">PKCS#7</a>) with other instances.</p>
69
+
70
+ <p>Akero does not try to be a substitute for a fully featured <a href="http://en.wikipedia.org/wiki/Public_key_infrastructure">PKI</a>. It is meant to be used as a building block in scenarios where trust-relationships and keyrings can be managed externally, and where the complexity of traditional solutions (X.509 PKI, OpenPGP, custom RSA) yields no tangible benefits.</p>
71
+
72
+ <h2>Features</h2>
73
+
74
+ <ul>
75
+ <li>Secure 1-to-n messaging (sign-only -or- sign-&gt;encrypt-&gt;sign)</li>
76
+ <li>Low complexity; easy to use, understand and review (only 192 lines of code)</li>
77
+ <li>Transport agnostic; messages and certificates are self-contained and optionally ascii-armored (base64)</li>
78
+ <li>Built on standard OpenSSL primitives, no homegrown algorithms</li>
79
+ <li><a href="http://busyloop.github.com/akero/coverage/">100%</a> test coverage</li>
80
+ </ul>
81
+
82
+ <h2>Installation</h2>
83
+
84
+ <p><code>gem install akero</code></p>
85
+
86
+ <h2>Usage</h2>
87
+
88
+ <pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>akero</span><span class='tstring_end'>'</span></span>
89
+
90
+ <span class='comment'># Alice, Bob and Charlie are Akero instances
91
+ </span><span class='id identifier rubyid_alice'>alice</span> <span class='op'>=</span> <span class='const'>Akero</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
92
+ <span class='id identifier rubyid_bob'>bob</span> <span class='op'>=</span> <span class='const'>Akero</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
93
+ <span class='id identifier rubyid_charlie'>charlie</span> <span class='op'>=</span> <span class='const'>Akero</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
94
+
95
+ <span class='comment'># Inspect Alice's keypair fingerprint
96
+ </span><span class='id identifier rubyid_alice'>alice</span><span class='period'>.</span><span class='id identifier rubyid_id'>id</span> <span class='comment'># =&gt; &quot;AK:12:34:56:...&quot;
97
+ </span>
98
+ <span class='comment'># Alice signs a message
99
+ </span><span class='id identifier rubyid_signed_msg'>signed_msg</span> <span class='op'>=</span> <span class='id identifier rubyid_alice'>alice</span><span class='period'>.</span><span class='id identifier rubyid_sign'>sign</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Hello world!</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
100
+
101
+ <span class='comment'># Anyone can receive this message and extract
102
+ </span><span class='comment'># Alice's fingerprint and public key from it
103
+ </span><span class='id identifier rubyid_msg'>msg</span> <span class='op'>=</span> <span class='id identifier rubyid_bob'>bob</span><span class='period'>.</span><span class='id identifier rubyid_receive'>receive</span><span class='lparen'>(</span><span class='id identifier rubyid_signed_msg'>signed_msg</span><span class='rparen'>)</span>
104
+ <span class='id identifier rubyid_msg'>msg</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span> <span class='comment'># =&gt; &quot;Hello world!&quot;
105
+ </span><span class='id identifier rubyid_msg'>msg</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span> <span class='comment'># =&gt; :signed
106
+ </span><span class='id identifier rubyid_msg'>msg</span><span class='period'>.</span><span class='id identifier rubyid_from'>from</span> <span class='comment'># =&gt; &quot;AK:12:34:56:...&quot;
107
+ </span><span class='id identifier rubyid_msg'>msg</span><span class='period'>.</span><span class='id identifier rubyid_from_pk'>from_pk</span> <span class='comment'># =&gt; &quot;(alice-public-key)&quot;
108
+ </span>
109
+ <span class='comment'># Bob encrypts a message for Alice
110
+ </span><span class='id identifier rubyid_bobs_msg'>bobs_msg</span> <span class='op'>=</span> <span class='id identifier rubyid_bob'>bob</span><span class='period'>.</span><span class='id identifier rubyid_encrypt'>encrypt</span><span class='lparen'>(</span><span class='id identifier rubyid_msg'>msg</span><span class='period'>.</span><span class='id identifier rubyid_from_pk'>from_pk</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Hello Alice!</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
111
+
112
+ <span class='comment'># Alice can receive it...
113
+ </span><span class='id identifier rubyid_msg'>msg</span> <span class='op'>=</span> <span class='id identifier rubyid_alice'>alice</span><span class='period'>.</span><span class='id identifier rubyid_receive'>receive</span><span class='lparen'>(</span><span class='id identifier rubyid_bobs_msg'>bobs_msg</span><span class='rparen'>)</span>
114
+ <span class='id identifier rubyid_msg'>msg</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span> <span class='comment'># =&gt; &quot;Hello Alice!&quot;
115
+ </span><span class='id identifier rubyid_msg'>msg</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span> <span class='comment'># =&gt; :encrypted
116
+ </span><span class='id identifier rubyid_msg'>msg</span><span class='period'>.</span><span class='id identifier rubyid_from'>from</span> <span class='comment'># =&gt; &quot;AK:ab:cd:ef:...&quot;
117
+ </span><span class='id identifier rubyid_msg'>msg</span><span class='period'>.</span><span class='id identifier rubyid_from_pk'>from_pk</span> <span class='comment'># =&gt; &quot;(bob-public-key)&quot;
118
+ </span>
119
+ <span class='comment'># ...and Charlie can't
120
+ </span><span class='id identifier rubyid_msg'>msg</span> <span class='op'>=</span> <span class='id identifier rubyid_charlie'>charlie</span><span class='period'>.</span><span class='id identifier rubyid_receive'>receive</span><span class='lparen'>(</span><span class='id identifier rubyid_bobs_msg'>bobs_msg</span><span class='rparen'>)</span> <span class='comment'># =&gt; Exception is raised
121
+ </span>
122
+ <span class='comment'># Alice encrypts a message for Bob and Charlie
123
+ </span><span class='id identifier rubyid_msg'>msg</span> <span class='op'>=</span> <span class='id identifier rubyid_alice'>alice</span><span class='period'>.</span><span class='id identifier rubyid_encrypt'>encrypt</span><span class='lparen'>(</span><span class='lbracket'>[</span><span class='id identifier rubyid_bob'>bob</span><span class='period'>.</span><span class='id identifier rubyid_public_key'>public_key</span><span class='comma'>,</span> <span class='id identifier rubyid_charlie'>charlie</span><span class='period'>.</span><span class='id identifier rubyid_public_key'>public_key</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Hello!</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
124
+
125
+ <span class='comment'># Save Alice to a file
126
+ </span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_open'>open</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>/tmp/alice.akr</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>w</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_f'>f</span><span class='op'>|</span> <span class='id identifier rubyid_f'>f</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='id identifier rubyid_alice'>alice</span><span class='period'>.</span><span class='id identifier rubyid_private_key'>private_key</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
127
+
128
+ <span class='comment'># And load her again
129
+ </span><span class='id identifier rubyid_new_alice'>new_alice</span> <span class='op'>=</span> <span class='const'>Akero</span><span class='period'>.</span><span class='id identifier rubyid_load'>load</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_read'>read</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>/tmp/alice.akr</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
130
+
131
+ <span class='comment'># By default all messages are ascii armored.
132
+ </span><span class='comment'># In production Alice disables the armoring
133
+ </span><span class='comment'># for better performance.
134
+ </span><span class='id identifier rubyid_signed_msg'>signed_msg</span> <span class='op'>=</span> <span class='id identifier rubyid_alice'>alice</span><span class='period'>.</span><span class='id identifier rubyid_sign'>sign</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Hello world!</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='kw'>false</span><span class='rparen'>)</span>
135
+ <span class='id identifier rubyid_encrypted_msg'>encrypted_msg</span> <span class='op'>=</span> <span class='id identifier rubyid_alice'>alice</span><span class='period'>.</span><span class='id identifier rubyid_encrypt'>encrypt</span><span class='lparen'>(</span><span class='id identifier rubyid_alice'>alice</span><span class='period'>.</span><span class='id identifier rubyid_public_key'>public_key</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Hello!</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='kw'>false</span><span class='rparen'>)</span>
136
+ <span class='id identifier rubyid_puts'>puts</span> <span class='id identifier rubyid_alice'>alice</span><span class='period'>.</span><span class='id identifier rubyid_receive'>receive</span><span class='lparen'>(</span><span class='id identifier rubyid_encrypted_msg'>encrypted_msg</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span> <span class='comment'># =&gt; &quot;Hello!&quot;
137
+ </span>
138
+ </code></pre>
139
+
140
+ <h2>Documentation</h2>
141
+
142
+ <ul>
143
+ <li><a href="http://busyloop.github.com/akero/doc/frames.html">API Docs</a></li>
144
+ <li><a href="https://github.com/busyloop/akero/blob/master/spec/akero_spec.rb">Spec</a></li>
145
+ </ul>
146
+
147
+ <h2>Benchmarks</h2>
148
+
149
+ <p><img src="http://github.com/busyloop/akero/raw/master/benchmark/bm_rate.png" alt="Throughput">
150
+ <img src="http://github.com/busyloop/akero/raw/master/benchmark/bm_size.png" alt="Message size"></p>
151
+
152
+ <p>The above charts were generated using MRI 1.9.3p362 (x86_64-linux) on an <a href="http://www.cpubenchmark.net/cpu.php?cpu=AMD+Turion+II+Neo+N40L+Dual-Core">AMD Turion II Neo N40L</a> CPU.
153
+ You may run the benchmarks on your own machine with <code>rake benchmark</code>.</p>
154
+
155
+ <h2>License (MIT)</h2>
156
+
157
+ <p>Copyright (c) 2012 <a href="mailto:moe@busyloop.net">moe@busyloop.net</a></p>
158
+
159
+ <p>Permission is hereby granted, free of charge, to any person obtaining
160
+ a copy of this software and associated documentation files (the
161
+ &quot;Software&quot;), to deal in the Software without restriction, including
162
+ without limitation the rights to use, copy, modify, merge, publish,
163
+ distribute, sublicense, and/or sell copies of the Software, and to
164
+ permit persons to whom the Software is furnished to do so, subject to
165
+ the following conditions:</p>
166
+
167
+ <p>The above copyright notice and this permission notice shall be
168
+ included in all copies or substantial portions of the Software.</p>
169
+
170
+ <p>THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND,
171
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
172
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
173
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
174
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
175
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
176
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</p>
177
+ </div></div>
178
+
179
+ <div id="footer">
180
+ Generated on Mon Mar 18 15:03:26 2013 by
181
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
182
+ 0.8.5.2 (ruby-1.9.3).
183
+ </div>
184
+
185
+ </body>
186
+ </html>
@@ -0,0 +1,55 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html>
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
+
7
+ <link rel="stylesheet" href="css/full_list.css" type="text/css" media="screen" charset="utf-8" />
8
+
9
+ <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
10
+
11
+
12
+
13
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
14
+
15
+ <script type="text/javascript" charset="utf-8" src="js/full_list.js"></script>
16
+
17
+
18
+ <base id="base_target" target="_parent" />
19
+ </head>
20
+ <body>
21
+ <script type="text/javascript" charset="utf-8">
22
+ if (window.top.frames.main) {
23
+ document.getElementById('base_target').target = 'main';
24
+ document.body.className = 'frames';
25
+ }
26
+ </script>
27
+ <div id="content">
28
+ <h1 id="full_list_header">File List</h1>
29
+ <div id="nav">
30
+
31
+ <span><a target="_self" href="class_list.html">
32
+ Classes
33
+ </a></span>
34
+
35
+ <span><a target="_self" href="method_list.html">
36
+ Methods
37
+ </a></span>
38
+
39
+ <span><a target="_self" href="file_list.html">
40
+ Files
41
+ </a></span>
42
+
43
+ </div>
44
+ <div id="search">Search: <input type="text" /></div>
45
+
46
+ <ul id="full_list" class="file">
47
+
48
+
49
+ <li class="r1"><a href="index.html" title="README">README</a></li>
50
+
51
+
52
+ </ul>
53
+ </div>
54
+ </body>
55
+ </html>
data/doc/frames.html ADDED
@@ -0,0 +1,28 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
3
+
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
+ <head>
6
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
7
+ <title>Documentation by YARD 0.8.5.2</title>
8
+ </head>
9
+ <script type="text/javascript" charset="utf-8">
10
+ window.onload = function() {
11
+ var match = window.location.hash.match(/^#!(.+)/);
12
+ var name = 'index.html';
13
+ if (match) {
14
+ name = unescape(match[1]);
15
+ }
16
+ document.writeln('<frameset cols="20%,*">' +
17
+ '<frame name="list" src="class_list.html" />' +
18
+ '<frame name="main" src="' + name + '" />' +
19
+ '</frameset>');
20
+ }
21
+ </script>
22
+ <noscript>
23
+ <frameset cols="20%,*">
24
+ <frame name="list" src="class_list.html" />
25
+ <frame name="main" src="index.html" />
26
+ </frameset>
27
+ </noscript>
28
+ </html>
data/doc/index.html ADDED
@@ -0,0 +1,186 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6
+ <title>
7
+ File: README
8
+
9
+ &mdash; Documentation by YARD 0.8.5.2
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ hasFrames = window.top.frames.main ? true : false;
19
+ relpath = '';
20
+ framesUrl = "frames.html#!" + escape(window.location.href);
21
+ </script>
22
+
23
+
24
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
25
+
26
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
27
+
28
+
29
+ </head>
30
+ <body>
31
+ <div id="header">
32
+ <div id="menu">
33
+
34
+ <a href="_index.html">Index</a> &raquo;
35
+ <span class="title">File: README</span>
36
+
37
+
38
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
39
+ </div>
40
+
41
+ <div id="search">
42
+
43
+ <a class="full_list_link" id="class_list_link"
44
+ href="class_list.html">
45
+ Class List
46
+ </a>
47
+
48
+ <a class="full_list_link" id="method_list_link"
49
+ href="method_list.html">
50
+ Method List
51
+ </a>
52
+
53
+ <a class="full_list_link" id="file_list_link"
54
+ href="file_list.html">
55
+ File List
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <iframe id="search_frame"></iframe>
63
+
64
+ <div id="content"><div id='filecontents'><h1>Akero <a href="https://travis-ci.org/busyloop/akero"><img src="https://travis-ci.org/busyloop/akero.png?branch=master" alt="Build Status"></a> <a href="https://gemnasium.com/busyloop/akero"><img src="https://gemnasium.com/busyloop/akero.png" alt="Dependency Status"></a></h1>
65
+
66
+ <p>Akero (<a href="http://en.wiktionary.org/wiki/%F0%90%80%80%F0%90%80%90%F0%90%80%AB">ἄγγελος</a>, messenger) is an easy-to-use library for peer-to-peer <a href="http://en.wikipedia.org/wiki/Public-key_cryptography">public key cryptography</a>. It enables two or more endpoints to exchange encrypted and/or signed messages without requiring a pre-shared secret.</p>
67
+
68
+ <p>Under the hood Akero uses standard OpenSSL primitives. Each instance wraps a <a href="http://en.wikipedia.org/wiki/RSA">RSA</a>-keypair, a corresponding <a href="http://en.wikipedia.org/wiki/X.509">X.509 certificate</a> and exchanges self-signed messages (<a href="https://tools.ietf.org/html/rfc2315">PKCS#7</a>) with other instances.</p>
69
+
70
+ <p>Akero does not try to be a substitute for a fully featured <a href="http://en.wikipedia.org/wiki/Public_key_infrastructure">PKI</a>. It is meant to be used as a building block in scenarios where trust-relationships and keyrings can be managed externally, and where the complexity of traditional solutions (X.509 PKI, OpenPGP, custom RSA) yields no tangible benefits.</p>
71
+
72
+ <h2>Features</h2>
73
+
74
+ <ul>
75
+ <li>Secure 1-to-n messaging (sign-only -or- sign-&gt;encrypt-&gt;sign)</li>
76
+ <li>Low complexity; easy to use, understand and review (only 192 lines of code)</li>
77
+ <li>Transport agnostic; messages and certificates are self-contained and optionally ascii-armored (base64)</li>
78
+ <li>Built on standard OpenSSL primitives, no homegrown algorithms</li>
79
+ <li><a href="http://busyloop.github.com/akero/coverage/">100%</a> test coverage</li>
80
+ </ul>
81
+
82
+ <h2>Installation</h2>
83
+
84
+ <p><code>gem install akero</code></p>
85
+
86
+ <h2>Usage</h2>
87
+
88
+ <pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>akero</span><span class='tstring_end'>'</span></span>
89
+
90
+ <span class='comment'># Alice, Bob and Charlie are Akero instances
91
+ </span><span class='id identifier rubyid_alice'>alice</span> <span class='op'>=</span> <span class='const'>Akero</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
92
+ <span class='id identifier rubyid_bob'>bob</span> <span class='op'>=</span> <span class='const'>Akero</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
93
+ <span class='id identifier rubyid_charlie'>charlie</span> <span class='op'>=</span> <span class='const'>Akero</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
94
+
95
+ <span class='comment'># Inspect Alice's keypair fingerprint
96
+ </span><span class='id identifier rubyid_alice'>alice</span><span class='period'>.</span><span class='id identifier rubyid_id'>id</span> <span class='comment'># =&gt; &quot;AK:12:34:56:...&quot;
97
+ </span>
98
+ <span class='comment'># Alice signs a message
99
+ </span><span class='id identifier rubyid_signed_msg'>signed_msg</span> <span class='op'>=</span> <span class='id identifier rubyid_alice'>alice</span><span class='period'>.</span><span class='id identifier rubyid_sign'>sign</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Hello world!</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
100
+
101
+ <span class='comment'># Anyone can receive this message and extract
102
+ </span><span class='comment'># Alice's fingerprint and public key from it
103
+ </span><span class='id identifier rubyid_msg'>msg</span> <span class='op'>=</span> <span class='id identifier rubyid_bob'>bob</span><span class='period'>.</span><span class='id identifier rubyid_receive'>receive</span><span class='lparen'>(</span><span class='id identifier rubyid_signed_msg'>signed_msg</span><span class='rparen'>)</span>
104
+ <span class='id identifier rubyid_msg'>msg</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span> <span class='comment'># =&gt; &quot;Hello world!&quot;
105
+ </span><span class='id identifier rubyid_msg'>msg</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span> <span class='comment'># =&gt; :signed
106
+ </span><span class='id identifier rubyid_msg'>msg</span><span class='period'>.</span><span class='id identifier rubyid_from'>from</span> <span class='comment'># =&gt; &quot;AK:12:34:56:...&quot;
107
+ </span><span class='id identifier rubyid_msg'>msg</span><span class='period'>.</span><span class='id identifier rubyid_from_pk'>from_pk</span> <span class='comment'># =&gt; &quot;(alice-public-key)&quot;
108
+ </span>
109
+ <span class='comment'># Bob encrypts a message for Alice
110
+ </span><span class='id identifier rubyid_bobs_msg'>bobs_msg</span> <span class='op'>=</span> <span class='id identifier rubyid_bob'>bob</span><span class='period'>.</span><span class='id identifier rubyid_encrypt'>encrypt</span><span class='lparen'>(</span><span class='id identifier rubyid_msg'>msg</span><span class='period'>.</span><span class='id identifier rubyid_from_pk'>from_pk</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Hello Alice!</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
111
+
112
+ <span class='comment'># Alice can receive it...
113
+ </span><span class='id identifier rubyid_msg'>msg</span> <span class='op'>=</span> <span class='id identifier rubyid_alice'>alice</span><span class='period'>.</span><span class='id identifier rubyid_receive'>receive</span><span class='lparen'>(</span><span class='id identifier rubyid_bobs_msg'>bobs_msg</span><span class='rparen'>)</span>
114
+ <span class='id identifier rubyid_msg'>msg</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span> <span class='comment'># =&gt; &quot;Hello Alice!&quot;
115
+ </span><span class='id identifier rubyid_msg'>msg</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span> <span class='comment'># =&gt; :encrypted
116
+ </span><span class='id identifier rubyid_msg'>msg</span><span class='period'>.</span><span class='id identifier rubyid_from'>from</span> <span class='comment'># =&gt; &quot;AK:ab:cd:ef:...&quot;
117
+ </span><span class='id identifier rubyid_msg'>msg</span><span class='period'>.</span><span class='id identifier rubyid_from_pk'>from_pk</span> <span class='comment'># =&gt; &quot;(bob-public-key)&quot;
118
+ </span>
119
+ <span class='comment'># ...and Charlie can't
120
+ </span><span class='id identifier rubyid_msg'>msg</span> <span class='op'>=</span> <span class='id identifier rubyid_charlie'>charlie</span><span class='period'>.</span><span class='id identifier rubyid_receive'>receive</span><span class='lparen'>(</span><span class='id identifier rubyid_bobs_msg'>bobs_msg</span><span class='rparen'>)</span> <span class='comment'># =&gt; Exception is raised
121
+ </span>
122
+ <span class='comment'># Alice encrypts a message for Bob and Charlie
123
+ </span><span class='id identifier rubyid_msg'>msg</span> <span class='op'>=</span> <span class='id identifier rubyid_alice'>alice</span><span class='period'>.</span><span class='id identifier rubyid_encrypt'>encrypt</span><span class='lparen'>(</span><span class='lbracket'>[</span><span class='id identifier rubyid_bob'>bob</span><span class='period'>.</span><span class='id identifier rubyid_public_key'>public_key</span><span class='comma'>,</span> <span class='id identifier rubyid_charlie'>charlie</span><span class='period'>.</span><span class='id identifier rubyid_public_key'>public_key</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Hello!</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
124
+
125
+ <span class='comment'># Save Alice to a file
126
+ </span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_open'>open</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>/tmp/alice.akr</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>w</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_f'>f</span><span class='op'>|</span> <span class='id identifier rubyid_f'>f</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='id identifier rubyid_alice'>alice</span><span class='period'>.</span><span class='id identifier rubyid_private_key'>private_key</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
127
+
128
+ <span class='comment'># And load her again
129
+ </span><span class='id identifier rubyid_new_alice'>new_alice</span> <span class='op'>=</span> <span class='const'>Akero</span><span class='period'>.</span><span class='id identifier rubyid_load'>load</span><span class='lparen'>(</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_read'>read</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>/tmp/alice.akr</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
130
+
131
+ <span class='comment'># By default all messages are ascii armored.
132
+ </span><span class='comment'># In production Alice disables the armoring
133
+ </span><span class='comment'># for better performance.
134
+ </span><span class='id identifier rubyid_signed_msg'>signed_msg</span> <span class='op'>=</span> <span class='id identifier rubyid_alice'>alice</span><span class='period'>.</span><span class='id identifier rubyid_sign'>sign</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Hello world!</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='kw'>false</span><span class='rparen'>)</span>
135
+ <span class='id identifier rubyid_encrypted_msg'>encrypted_msg</span> <span class='op'>=</span> <span class='id identifier rubyid_alice'>alice</span><span class='period'>.</span><span class='id identifier rubyid_encrypt'>encrypt</span><span class='lparen'>(</span><span class='id identifier rubyid_alice'>alice</span><span class='period'>.</span><span class='id identifier rubyid_public_key'>public_key</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Hello!</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='kw'>false</span><span class='rparen'>)</span>
136
+ <span class='id identifier rubyid_puts'>puts</span> <span class='id identifier rubyid_alice'>alice</span><span class='period'>.</span><span class='id identifier rubyid_receive'>receive</span><span class='lparen'>(</span><span class='id identifier rubyid_encrypted_msg'>encrypted_msg</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span> <span class='comment'># =&gt; &quot;Hello!&quot;
137
+ </span>
138
+ </code></pre>
139
+
140
+ <h2>Documentation</h2>
141
+
142
+ <ul>
143
+ <li><a href="http://busyloop.github.com/akero/doc/frames.html">API Docs</a></li>
144
+ <li><a href="https://github.com/busyloop/akero/blob/master/spec/akero_spec.rb">Spec</a></li>
145
+ </ul>
146
+
147
+ <h2>Benchmarks</h2>
148
+
149
+ <p><img src="http://github.com/busyloop/akero/raw/master/benchmark/bm_rate.png" alt="Throughput">
150
+ <img src="http://github.com/busyloop/akero/raw/master/benchmark/bm_size.png" alt="Message size"></p>
151
+
152
+ <p>The above charts were generated using MRI 1.9.3p362 (x86_64-linux) on an <a href="http://www.cpubenchmark.net/cpu.php?cpu=AMD+Turion+II+Neo+N40L+Dual-Core">AMD Turion II Neo N40L</a> CPU.
153
+ You may run the benchmarks on your own machine with <code>rake benchmark</code>.</p>
154
+
155
+ <h2>License (MIT)</h2>
156
+
157
+ <p>Copyright (c) 2012 <a href="mailto:moe@busyloop.net">moe@busyloop.net</a></p>
158
+
159
+ <p>Permission is hereby granted, free of charge, to any person obtaining
160
+ a copy of this software and associated documentation files (the
161
+ &quot;Software&quot;), to deal in the Software without restriction, including
162
+ without limitation the rights to use, copy, modify, merge, publish,
163
+ distribute, sublicense, and/or sell copies of the Software, and to
164
+ permit persons to whom the Software is furnished to do so, subject to
165
+ the following conditions:</p>
166
+
167
+ <p>The above copyright notice and this permission notice shall be
168
+ included in all copies or substantial portions of the Software.</p>
169
+
170
+ <p>THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND,
171
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
172
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
173
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
174
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
175
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
176
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</p>
177
+ </div></div>
178
+
179
+ <div id="footer">
180
+ Generated on Mon Mar 18 15:03:26 2013 by
181
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
182
+ 0.8.5.2 (ruby-1.9.3).
183
+ </div>
184
+
185
+ </body>
186
+ </html>