stella 0.3.2 → 0.5.1
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.
- data/README.txt +24 -84
- data/Rakefile +1 -6
- data/doc/classes/Crypto.html +248 -0
- data/doc/classes/Crypto/Key.html +308 -0
- data/doc/classes/Enumerable.html +309 -0
- data/doc/classes/FileUtil.html +310 -0
- data/doc/classes/HTTPUtil.html +530 -0
- data/doc/classes/MathUtil.html +210 -0
- data/doc/classes/Stella.html +238 -0
- data/doc/classes/Stella/Adapter.html +127 -0
- data/doc/classes/Stella/Adapter/ApacheBench.html +1076 -0
- data/doc/classes/Stella/Adapter/Base.html +432 -0
- data/doc/classes/Stella/Adapter/CommandNotReady.html +146 -0
- data/doc/classes/Stella/Adapter/Httperf.html +949 -0
- data/doc/classes/Stella/Adapter/Siege.html +1011 -0
- data/doc/classes/Stella/CLI.html +914 -0
- data/doc/classes/Stella/CLI/Base.html +186 -0
- data/doc/classes/Stella/CLI/Language.html +149 -0
- data/doc/classes/Stella/CLI/LocalTest.html +268 -0
- data/doc/classes/Stella/Command.html +111 -0
- data/doc/classes/Stella/Command/Base.html +335 -0
- data/doc/classes/Stella/Config.html +292 -0
- data/doc/classes/Stella/InvalidArgument.html +242 -0
- data/doc/classes/Stella/LocalTest.html +450 -0
- data/doc/classes/Stella/Logger.html +548 -0
- data/doc/classes/Stella/Response.html +846 -0
- data/doc/classes/Stella/Storable.html +928 -0
- data/doc/classes/Stella/Test.html +142 -0
- data/doc/classes/Stella/Test/DaySummary.html +249 -0
- data/doc/classes/Stella/Test/Definition.html +294 -0
- data/doc/classes/Stella/Test/Definition/Rampup.html +215 -0
- data/doc/classes/Stella/Test/RunSummary.html +315 -0
- data/doc/classes/Stella/Test/SummaryBase.html +286 -0
- data/doc/classes/Stella/Test/TestSummary.html +200 -0
- data/doc/classes/Stella/Text.html +581 -0
- data/doc/classes/Stella/Text/Resource.html +289 -0
- data/doc/classes/Stella/UnavailableAdapter.html +242 -0
- data/doc/classes/Stella/UnknownValue.html +242 -0
- data/doc/classes/Stella/UnsupportedLanguage.html +115 -0
- data/doc/classes/Stella/Util.html +348 -0
- data/doc/classes/TextGraph.html +460 -0
- data/doc/classes/TimerUtil.html +431 -0
- data/doc/created.rid +1 -0
- data/doc/files/LICENSE_txt.html +129 -0
- data/doc/files/README_txt.html +209 -0
- data/doc/files/lib/stella/adapter/ab_rb.html +101 -0
- data/doc/files/lib/stella/adapter/base_rb.html +101 -0
- data/doc/files/lib/stella/adapter/httperf_rb.html +101 -0
- data/doc/files/lib/stella/adapter/siege_rb.html +101 -0
- data/doc/files/lib/stella/cli/base_rb.html +101 -0
- data/doc/files/lib/stella/cli/language_rb.html +101 -0
- data/doc/files/lib/stella/cli/localtest_rb.html +101 -0
- data/doc/files/lib/stella/cli_rb.html +112 -0
- data/doc/files/lib/stella/command/base_rb.html +101 -0
- data/doc/files/lib/stella/command/localtest_rb.html +101 -0
- data/doc/files/lib/stella/logger_rb.html +101 -0
- data/doc/files/lib/stella/response_rb.html +101 -0
- data/doc/files/lib/stella/storable_rb.html +109 -0
- data/doc/files/lib/stella/support_rb.html +101 -0
- data/doc/files/lib/stella/test/daysummary_rb.html +101 -0
- data/doc/files/lib/stella/test/definition_rb.html +101 -0
- data/doc/files/lib/stella/test/runsummary_rb.html +101 -0
- data/doc/files/lib/stella/test/summarybase_rb.html +101 -0
- data/doc/files/lib/stella/test/testsummary_rb.html +108 -0
- data/doc/files/lib/stella/text/resource_rb.html +108 -0
- data/doc/files/lib/stella/text_rb.html +108 -0
- data/doc/files/lib/stella_rb.html +128 -0
- data/doc/files/lib/utils/crypto-key_rb.html +116 -0
- data/doc/files/lib/utils/fileutil_rb.html +108 -0
- data/doc/files/lib/utils/httputil_rb.html +110 -0
- data/doc/files/lib/utils/mathutil_rb.html +101 -0
- data/doc/files/lib/utils/textgraph_rb.html +138 -0
- data/doc/files/lib/utils/timerutil_rb.html +108 -0
- data/doc/fr_class_index.html +66 -0
- data/doc/fr_file_index.html +62 -0
- data/doc/fr_method_index.html +309 -0
- data/doc/index.html +24 -0
- data/doc/rdoc-style.css +208 -0
- data/lib/stella.rb +5 -6
- data/lib/stella/adapter/ab.rb +4 -31
- data/lib/stella/adapter/base.rb +1 -15
- data/lib/stella/adapter/httperf.rb +4 -35
- data/lib/stella/adapter/siege.rb +29 -51
- data/lib/stella/cli.rb +22 -45
- data/lib/stella/cli/language.rb +0 -2
- data/lib/stella/cli/localtest.rb +0 -5
- data/lib/stella/command/base.rb +1 -1
- data/lib/stella/command/localtest.rb +68 -84
- data/lib/stella/test/daysummary.rb +93 -0
- data/lib/stella/test/definition.rb +5 -10
- data/lib/stella/test/{run/summary.rb → runsummary.rb} +6 -4
- data/lib/stella/test/{base.rb → summarybase.rb} +7 -3
- data/lib/stella/test/{summary.rb → testsummary.rb} +29 -27
- data/lib/utils/mathutil.rb +34 -36
- data/spec/base.rb +26 -0
- data/spec/shell_spec.rb +12 -0
- data/support/text/en.yaml +1 -7
- metadata +102 -8
- data/lib/stella/cli/agents.rb +0 -73
- data/lib/utils/escape.rb +0 -302
data/README.txt
CHANGED
|
@@ -1,20 +1,13 @@
|
|
|
1
|
-
Stella -
|
|
2
|
-
|
|
3
|
-
Release: 0.3.2-preview (2008-12-23)
|
|
4
|
-
|
|
5
|
-
This is a PREVIEW release. Don't trust and double verify!
|
|
1
|
+
Stella Tools - Management and reporting tools for performance testing
|
|
6
2
|
|
|
3
|
+
Release: 0.5.1 (2008-12-23)
|
|
7
4
|
|
|
8
5
|
== Prerequisites
|
|
9
6
|
|
|
10
7
|
* Linux, *BSD, Solaris
|
|
11
8
|
* Ruby 1.8.x or 1.9.x
|
|
12
9
|
* Ruby Libraries
|
|
13
|
-
*
|
|
14
|
-
* mongrel
|
|
15
|
-
* rspec
|
|
16
|
-
* rdoc
|
|
17
|
-
|
|
10
|
+
*
|
|
18
11
|
* One of:
|
|
19
12
|
* Apache Bench
|
|
20
13
|
* Siege
|
|
@@ -24,111 +17,58 @@ This is a PREVIEW release. Don't trust and double verify!
|
|
|
24
17
|
== Installation
|
|
25
18
|
|
|
26
19
|
Get it in one of the following ways:
|
|
27
|
-
*
|
|
28
|
-
*
|
|
20
|
+
* GitHub: http://github.com/solutious/stella
|
|
21
|
+
* RubyForge: http://stella.rubyforge.org/
|
|
22
|
+
* gem install stella
|
|
29
23
|
|
|
30
24
|
Use ab, siege, and httperf like you normally would with the addition of stella at the beginning (examples are below).
|
|
31
25
|
|
|
32
|
-
=== Debian (and derivatives)
|
|
33
|
-
|
|
34
|
-
Debian and its derivative (Ubunutu) handling packing a bit differently (see: http://pkg-ruby-extras.alioth.debian.org/rubygems.html). There are a couple errors to watch out for during the installation. The solutions are below:
|
|
35
|
-
|
|
36
|
-
"no such file to load -- mkmf (LoadError)"
|
|
37
|
-
|
|
38
|
-
apt-get install ruby1.8-dev
|
|
39
|
-
|
|
40
|
-
"ERROR: RDoc documentation generator not installed!"
|
|
41
|
-
|
|
42
|
-
apt-get install rdoc
|
|
43
|
-
|
|
44
|
-
|
|
45
26
|
== Examples
|
|
46
27
|
|
|
47
|
-
Run Apache Bench with a warmup and rampup from 100 to 300 virtual users in increments of 25
|
|
48
|
-
|
|
28
|
+
# Run Apache Bench with a warmup and rampup from 100 to 300 virtual users in increments of 25
|
|
49
29
|
stella --warmup=0.5 --rampup=25,300 ab -c 100 -n 10000 http://stellaaahhhh.com/search?term=trooper
|
|
50
30
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
Run Httperf like you normally would (but all the test data will be collected for you)
|
|
58
|
-
|
|
59
|
-
stella httperf --hog --client=0/1 --server=127.0.0.1 --port=5600 --uri=/ --rate=50 --num-conns=3000 --timeout=5
|
|
60
|
-
|
|
61
|
-
|
|
31
|
+
# Run Siege, repeat the test 5 times. Automatically creates a summary averages and standard deviations.
|
|
32
|
+
stella --datapath=./stella --testruns=5 siege -c 100 -r 100 -b http://stellaaahhhh.com/search?term=flock+of+seagulls
|
|
33
|
+
|
|
34
|
+
|
|
62
35
|
== Sample Output
|
|
63
36
|
|
|
64
|
-
$ stella -f csv -x 5 -w
|
|
65
|
-
Writing test data to: stella/testruns/2008-12-23/test-
|
|
66
|
-
|
|
67
|
-
Warmup: 3750@37/1 100% 264.29/s 0.140s 0.024MB/s 0.340MB 14.000s .
|
|
37
|
+
$ stella -f csv -x 5 -w -m "httpd 2.2.9-prefork" siege -c 125 -r 100 -b http://stella:5600/
|
|
38
|
+
Writing test data to: ./stella/testruns/2008-12-23/test-006
|
|
68
39
|
|
|
69
|
-
|
|
70
|
-
REQ@VU/s AVAIL REQ/s RTIME DATA/s DATA TIME
|
|
71
|
-
|
|
72
|
-
Run 01: 7500@75/1 100% 345.30/s 0.210s 0.032MB/s 0.690MB 21.720s
|
|
73
|
-
Run 02: 7500@75/1 100% 360.58/s 0.200s 0.033MB/s 0.690MB 20.800s
|
|
74
|
-
Run 03: 7500@75/1 100% 359.02/s 0.210s 0.033MB/s 0.690MB 20.890s
|
|
75
|
-
-------------------------------------------------------------------
|
|
76
|
-
Total: 22500@73 100% 354.97/s 0.207s 0.033MB/s 2.070MB 63.410s
|
|
77
|
-
Std Dev: 6.86/s 0.005s 0.001MB/s 0.414s
|
|
78
|
-
|
|
79
|
-
Run 04: 10000@100/1 100% 384.47/s 0.260s 0.035MB/s 0.920MB 26.010s
|
|
80
|
-
Run 05: 10000@100/1 100% 385.06/s 0.260s 0.035MB/s 0.920MB 25.970s
|
|
81
|
-
Run 06: 10000@100/1 100% 380.95/s 0.260s 0.035MB/s 0.920MB 26.250s
|
|
82
|
-
-------------------------------------------------------------------
|
|
83
|
-
Total: 30000@98 100% 383.49/s 0.260s 0.035MB/s 2.760MB 78.230s
|
|
84
|
-
Std Dev: 1.81/s 0.000s 0.000MB/s 0.124s
|
|
85
|
-
|
|
86
|
-
Run 07: 12500@125/1 100% 397.20/s 0.310s 0.036MB/s 1.140MB 31.470s
|
|
87
|
-
Run 08: 12500@125/1 100% 397.08/s 0.310s 0.036MB/s 1.140MB 31.480s
|
|
88
|
-
Run 09: 12500@125/1 100% 397.58/s 0.310s 0.036MB/s 1.140MB 31.440s
|
|
89
|
-
-------------------------------------------------------------------
|
|
90
|
-
Total: 37500@123 100% 397.29/s 0.310s 0.036MB/s 3.420MB 94.390s
|
|
91
|
-
Std Dev: 0.21/s 0.000s 0.000MB/s 0.017s
|
|
40
|
+
Warmup: 125@12 1.1700s 102.56/s 0.1100s (100.00%) .
|
|
92
41
|
|
|
42
|
+
Run 01: 1250@125 3.4800s 359.20/s 0.3200s (100.00%)
|
|
43
|
+
Run 02: 1250@125 3.4400s 363.37/s 0.3200s (100.00%)
|
|
44
|
+
Run 03: 1250@125 5.0000s 250.00/s 0.4700s (100.00%)
|
|
45
|
+
Run 04: 1250@125 3.3300s 375.38/s 0.3100s (100.00%)
|
|
46
|
+
Run 05: 1250@125 3.4100s 366.57/s 0.3100s (100.00%)
|
|
93
47
|
-------------------------------------------------------------------
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
48
|
+
Std Dev: 0.6359s 46.76/s 0.0622s
|
|
49
|
+
Total: 6250@116 18.6600s 342.90/s 0.3460s (100.00%)
|
|
97
50
|
|
|
98
51
|
All test data is collected under ./stella (this can be changed with the parameter --datapath):
|
|
99
|
-
|
|
100
52
|
$ ls -l ./stella/testruns/2008-12-23/
|
|
101
|
-
test-001 test-002 test-003 test-004 test-005 test-006
|
|
53
|
+
test-001 test-002 test-003 test-004 test-005 test-006
|
|
102
54
|
|
|
103
|
-
|
|
104
55
|
A symbolic link points to the most recent test:
|
|
105
|
-
|
|
106
56
|
$ ls -l ./stella/latest/
|
|
107
57
|
ID.txt MESSAGE.txt SUMMARY.csv run01 run02 run03 run04 run05 warmup
|
|
108
58
|
|
|
109
|
-
|
|
110
59
|
Each run directory contains all associated data, including the command and configuration
|
|
111
|
-
|
|
112
60
|
$ ls -l ./stella/latest/run01/
|
|
113
61
|
COMMAND.txt STDOUT.txt siege.log STDERR.txt SUMMARY.csv siegerc
|
|
114
62
|
|
|
115
63
|
|
|
116
|
-
== Known Issues
|
|
117
|
-
|
|
118
|
-
* The output for the REQ@VU/s columns is a work in progress. It's not aligned across tools and it will likely change in the next release.
|
|
119
|
-
* The summary data has not been audited. Don't trust and double verify!
|
|
120
|
-
* httperf is functional but needs a lot more testing (most dev was done with ab and siege).
|
|
121
|
-
* The Ruby API has not been finalized. It's functional but there's no example because it is subject to change.
|
|
122
|
-
* There are no specs.
|
|
123
64
|
|
|
124
65
|
== Report an issue
|
|
125
66
|
|
|
126
67
|
Email issues and bugs to stella@solutious.com
|
|
127
68
|
|
|
69
|
+
== More Information
|
|
128
70
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
http://www.youtube.com/watch?v=wmq-JDonTpc
|
|
71
|
+
http://stella.github.com/
|
|
132
72
|
|
|
133
73
|
== License
|
|
134
74
|
|
data/Rakefile
CHANGED
|
@@ -31,12 +31,7 @@ require 'rake/rdoctask'
|
|
|
31
31
|
require 'fileutils'
|
|
32
32
|
include FileUtils
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
$: << File.join(STELLA_HOME, 'lib')
|
|
36
|
-
|
|
37
|
-
require 'stella'
|
|
38
|
-
version = Stella::VERSION.to_s
|
|
39
|
-
|
|
34
|
+
version = "0.5.1"
|
|
40
35
|
name = "stella"
|
|
41
36
|
|
|
42
37
|
spec = Gem::Specification.new do |s|
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<!DOCTYPE html
|
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
5
|
+
|
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
7
|
+
<head>
|
|
8
|
+
<title>Module: Crypto</title>
|
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
|
11
|
+
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
|
12
|
+
<script type="text/javascript">
|
|
13
|
+
// <![CDATA[
|
|
14
|
+
|
|
15
|
+
function popupCode( url ) {
|
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function toggleCode( id ) {
|
|
20
|
+
if ( document.getElementById )
|
|
21
|
+
elem = document.getElementById( id );
|
|
22
|
+
else if ( document.all )
|
|
23
|
+
elem = eval( "document.all." + id );
|
|
24
|
+
else
|
|
25
|
+
return false;
|
|
26
|
+
|
|
27
|
+
elemStyle = elem.style;
|
|
28
|
+
|
|
29
|
+
if ( elemStyle.display != "block" ) {
|
|
30
|
+
elemStyle.display = "block"
|
|
31
|
+
} else {
|
|
32
|
+
elemStyle.display = "none"
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Make codeblocks hidden by default
|
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
|
40
|
+
|
|
41
|
+
// ]]>
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
</head>
|
|
45
|
+
<body>
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
<div id="classHeader">
|
|
50
|
+
<table class="header-table">
|
|
51
|
+
<tr class="top-aligned-row">
|
|
52
|
+
<td><strong>Module</strong></td>
|
|
53
|
+
<td class="class-name-in-header">Crypto</td>
|
|
54
|
+
</tr>
|
|
55
|
+
<tr class="top-aligned-row">
|
|
56
|
+
<td><strong>In:</strong></td>
|
|
57
|
+
<td>
|
|
58
|
+
<a href="../files/lib/utils/crypto-key_rb.html">
|
|
59
|
+
lib/utils/crypto-key.rb
|
|
60
|
+
</a>
|
|
61
|
+
<br />
|
|
62
|
+
</td>
|
|
63
|
+
</tr>
|
|
64
|
+
|
|
65
|
+
</table>
|
|
66
|
+
</div>
|
|
67
|
+
<!-- banner header -->
|
|
68
|
+
|
|
69
|
+
<div id="bodyContent">
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
<div id="contextContent">
|
|
74
|
+
|
|
75
|
+
<div id="description">
|
|
76
|
+
<pre>
|
|
77
|
+
ELSE
|
|
78
|
+
</pre>
|
|
79
|
+
<p>
|
|
80
|
+
module JRuby
|
|
81
|
+
</p>
|
|
82
|
+
<pre>
|
|
83
|
+
module OpenSSL
|
|
84
|
+
GEM_ONLY = false unless defined?(GEM_ONLY)
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
if JRuby::OpenSSL::GEM_ONLY
|
|
89
|
+
require 'jruby/openssl/gem'
|
|
90
|
+
else
|
|
91
|
+
module OpenSSL
|
|
92
|
+
class OpenSSLError < StandardError; end
|
|
93
|
+
# These require the gem
|
|
94
|
+
%w[
|
|
95
|
+
ASN1
|
|
96
|
+
BN
|
|
97
|
+
Cipher
|
|
98
|
+
Config
|
|
99
|
+
Netscape
|
|
100
|
+
PKCS7
|
|
101
|
+
PKey
|
|
102
|
+
Random
|
|
103
|
+
SSL
|
|
104
|
+
X509
|
|
105
|
+
].each {|c| autoload c, "jruby/openssl/gem"}
|
|
106
|
+
end
|
|
107
|
+
require "jruby/openssl/builtin"
|
|
108
|
+
end
|
|
109
|
+
</pre>
|
|
110
|
+
<p>
|
|
111
|
+
end
|
|
112
|
+
</p>
|
|
113
|
+
|
|
114
|
+
</div>
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
</div>
|
|
118
|
+
|
|
119
|
+
<div id="method-list">
|
|
120
|
+
<h3 class="section-bar">Methods</h3>
|
|
121
|
+
|
|
122
|
+
<div class="name-list">
|
|
123
|
+
<a href="#M000250">aws_sign</a>
|
|
124
|
+
<a href="#M000248">create_keys</a>
|
|
125
|
+
<a href="#M000249">sign</a>
|
|
126
|
+
</div>
|
|
127
|
+
</div>
|
|
128
|
+
|
|
129
|
+
</div>
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
<!-- if includes -->
|
|
133
|
+
|
|
134
|
+
<div id="section">
|
|
135
|
+
|
|
136
|
+
<div id="class-list">
|
|
137
|
+
<h3 class="section-bar">Classes and Modules</h3>
|
|
138
|
+
|
|
139
|
+
Class <a href="Crypto/Key.html" class="link">Crypto::Key</a><br />
|
|
140
|
+
|
|
141
|
+
</div>
|
|
142
|
+
|
|
143
|
+
<div id="constants-list">
|
|
144
|
+
<h3 class="section-bar">Constants</h3>
|
|
145
|
+
|
|
146
|
+
<div class="name-list">
|
|
147
|
+
<table summary="Constants">
|
|
148
|
+
<tr class="top-aligned-row context-row">
|
|
149
|
+
<td class="context-item-name">VERSION</td>
|
|
150
|
+
<td>=</td>
|
|
151
|
+
<td class="context-item-value">1.0</td>
|
|
152
|
+
</tr>
|
|
153
|
+
</table>
|
|
154
|
+
</div>
|
|
155
|
+
</div>
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
<!-- if method_list -->
|
|
163
|
+
<div id="methods">
|
|
164
|
+
<h3 class="section-bar">Public Class methods</h3>
|
|
165
|
+
|
|
166
|
+
<div id="method-M000250" class="method-detail">
|
|
167
|
+
<a name="M000250"></a>
|
|
168
|
+
|
|
169
|
+
<div class="method-heading">
|
|
170
|
+
<a href="#M000250" class="method-signature">
|
|
171
|
+
<span class="method-name">aws_sign</span><span class="method-args">(secret, string)</span>
|
|
172
|
+
</a>
|
|
173
|
+
</div>
|
|
174
|
+
|
|
175
|
+
<div class="method-description">
|
|
176
|
+
<p><a class="source-toggle" href="#"
|
|
177
|
+
onclick="toggleCode('M000250-source');return false;">[Source]</a></p>
|
|
178
|
+
<div class="method-source-code" id="M000250-source">
|
|
179
|
+
<pre>
|
|
180
|
+
<span class="ruby-comment cmt"># File lib/utils/crypto-key.rb, line 50</span>
|
|
181
|
+
50: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">aws_sign</span>(<span class="ruby-identifier">secret</span>, <span class="ruby-identifier">string</span>)
|
|
182
|
+
51: <span class="ruby-constant">Base64</span>.<span class="ruby-identifier">encode64</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">sign</span>(<span class="ruby-identifier">secret</span>, <span class="ruby-identifier">string</span>)).<span class="ruby-identifier">strip</span>
|
|
183
|
+
52: <span class="ruby-keyword kw">end</span>
|
|
184
|
+
</pre>
|
|
185
|
+
</div>
|
|
186
|
+
</div>
|
|
187
|
+
</div>
|
|
188
|
+
|
|
189
|
+
<div id="method-M000248" class="method-detail">
|
|
190
|
+
<a name="M000248"></a>
|
|
191
|
+
|
|
192
|
+
<div class="method-heading">
|
|
193
|
+
<a href="#M000248" class="method-signature">
|
|
194
|
+
<span class="method-name">create_keys</span><span class="method-args">(bits = 2048)</span>
|
|
195
|
+
</a>
|
|
196
|
+
</div>
|
|
197
|
+
|
|
198
|
+
<div class="method-description">
|
|
199
|
+
<p><a class="source-toggle" href="#"
|
|
200
|
+
onclick="toggleCode('M000248-source');return false;">[Source]</a></p>
|
|
201
|
+
<div class="method-source-code" id="M000248-source">
|
|
202
|
+
<pre>
|
|
203
|
+
<span class="ruby-comment cmt"># File lib/utils/crypto-key.rb, line 41</span>
|
|
204
|
+
41: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">create_keys</span>(<span class="ruby-identifier">bits</span> = <span class="ruby-value">2048</span>)
|
|
205
|
+
42: <span class="ruby-identifier">pk</span> = <span class="ruby-constant">OpenSSL</span><span class="ruby-operator">::</span><span class="ruby-constant">PKey</span><span class="ruby-operator">::</span><span class="ruby-constant">RSA</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">bits</span>)
|
|
206
|
+
43: <span class="ruby-keyword kw">end</span>
|
|
207
|
+
</pre>
|
|
208
|
+
</div>
|
|
209
|
+
</div>
|
|
210
|
+
</div>
|
|
211
|
+
|
|
212
|
+
<div id="method-M000249" class="method-detail">
|
|
213
|
+
<a name="M000249"></a>
|
|
214
|
+
|
|
215
|
+
<div class="method-heading">
|
|
216
|
+
<a href="#M000249" class="method-signature">
|
|
217
|
+
<span class="method-name">sign</span><span class="method-args">(secret, string)</span>
|
|
218
|
+
</a>
|
|
219
|
+
</div>
|
|
220
|
+
|
|
221
|
+
<div class="method-description">
|
|
222
|
+
<p><a class="source-toggle" href="#"
|
|
223
|
+
onclick="toggleCode('M000249-source');return false;">[Source]</a></p>
|
|
224
|
+
<div class="method-source-code" id="M000249-source">
|
|
225
|
+
<pre>
|
|
226
|
+
<span class="ruby-comment cmt"># File lib/utils/crypto-key.rb, line 46</span>
|
|
227
|
+
46: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">sign</span>(<span class="ruby-identifier">secret</span>, <span class="ruby-identifier">string</span>)
|
|
228
|
+
47: <span class="ruby-identifier">sig</span> = <span class="ruby-constant">OpenSSL</span><span class="ruby-operator">::</span><span class="ruby-constant">HMAC</span>.<span class="ruby-identifier">hexdigest</span>(<span class="ruby-ivar">@@digest</span>, <span class="ruby-identifier">secret</span>, <span class="ruby-identifier">string</span>).<span class="ruby-identifier">strip</span>
|
|
229
|
+
48: <span class="ruby-comment cmt">#sig.gsub(/\+/, "%2b")</span>
|
|
230
|
+
49: <span class="ruby-keyword kw">end</span>
|
|
231
|
+
</pre>
|
|
232
|
+
</div>
|
|
233
|
+
</div>
|
|
234
|
+
</div>
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
</div>
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
</div>
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
<div id="validator-badges">
|
|
244
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
|
245
|
+
</div>
|
|
246
|
+
|
|
247
|
+
</body>
|
|
248
|
+
</html>
|
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<!DOCTYPE html
|
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
5
|
+
|
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
7
|
+
<head>
|
|
8
|
+
<title>Class: Crypto::Key</title>
|
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
|
11
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
|
12
|
+
<script type="text/javascript">
|
|
13
|
+
// <![CDATA[
|
|
14
|
+
|
|
15
|
+
function popupCode( url ) {
|
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function toggleCode( id ) {
|
|
20
|
+
if ( document.getElementById )
|
|
21
|
+
elem = document.getElementById( id );
|
|
22
|
+
else if ( document.all )
|
|
23
|
+
elem = eval( "document.all." + id );
|
|
24
|
+
else
|
|
25
|
+
return false;
|
|
26
|
+
|
|
27
|
+
elemStyle = elem.style;
|
|
28
|
+
|
|
29
|
+
if ( elemStyle.display != "block" ) {
|
|
30
|
+
elemStyle.display = "block"
|
|
31
|
+
} else {
|
|
32
|
+
elemStyle.display = "none"
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Make codeblocks hidden by default
|
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
|
40
|
+
|
|
41
|
+
// ]]>
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
</head>
|
|
45
|
+
<body>
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
<div id="classHeader">
|
|
50
|
+
<table class="header-table">
|
|
51
|
+
<tr class="top-aligned-row">
|
|
52
|
+
<td><strong>Class</strong></td>
|
|
53
|
+
<td class="class-name-in-header">Crypto::Key</td>
|
|
54
|
+
</tr>
|
|
55
|
+
<tr class="top-aligned-row">
|
|
56
|
+
<td><strong>In:</strong></td>
|
|
57
|
+
<td>
|
|
58
|
+
<a href="../../files/lib/utils/crypto-key_rb.html">
|
|
59
|
+
lib/utils/crypto-key.rb
|
|
60
|
+
</a>
|
|
61
|
+
<br />
|
|
62
|
+
</td>
|
|
63
|
+
</tr>
|
|
64
|
+
|
|
65
|
+
<tr class="top-aligned-row">
|
|
66
|
+
<td><strong>Parent:</strong></td>
|
|
67
|
+
<td>
|
|
68
|
+
Object
|
|
69
|
+
</td>
|
|
70
|
+
</tr>
|
|
71
|
+
</table>
|
|
72
|
+
</div>
|
|
73
|
+
<!-- banner header -->
|
|
74
|
+
|
|
75
|
+
<div id="bodyContent">
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
<div id="contextContent">
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
</div>
|
|
84
|
+
|
|
85
|
+
<div id="method-list">
|
|
86
|
+
<h3 class="section-bar">Methods</h3>
|
|
87
|
+
|
|
88
|
+
<div class="name-list">
|
|
89
|
+
<a href="#M000254">decrypt</a>
|
|
90
|
+
<a href="#M000253">encrypt</a>
|
|
91
|
+
<a href="#M000252">from_file</a>
|
|
92
|
+
<a href="#M000251">new</a>
|
|
93
|
+
<a href="#M000255">private?</a>
|
|
94
|
+
<a href="#M000256">public?</a>
|
|
95
|
+
<a href="#M000257">type</a>
|
|
96
|
+
</div>
|
|
97
|
+
</div>
|
|
98
|
+
|
|
99
|
+
</div>
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
<!-- if includes -->
|
|
103
|
+
|
|
104
|
+
<div id="section">
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
<div id="attribute-list">
|
|
111
|
+
<h3 class="section-bar">Attributes</h3>
|
|
112
|
+
|
|
113
|
+
<div class="name-list">
|
|
114
|
+
<table>
|
|
115
|
+
<tr class="top-aligned-row context-row">
|
|
116
|
+
<td class="context-item-name">data</td>
|
|
117
|
+
<td class="context-item-value"> [R] </td>
|
|
118
|
+
<td class="context-item-desc"></td>
|
|
119
|
+
</tr>
|
|
120
|
+
<tr class="top-aligned-row context-row">
|
|
121
|
+
<td class="context-item-name">key</td>
|
|
122
|
+
<td class="context-item-value"> [R] </td>
|
|
123
|
+
<td class="context-item-desc"></td>
|
|
124
|
+
</tr>
|
|
125
|
+
</table>
|
|
126
|
+
</div>
|
|
127
|
+
</div>
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
<!-- if method_list -->
|
|
132
|
+
<div id="methods">
|
|
133
|
+
<h3 class="section-bar">Public Class methods</h3>
|
|
134
|
+
|
|
135
|
+
<div id="method-M000252" class="method-detail">
|
|
136
|
+
<a name="M000252"></a>
|
|
137
|
+
|
|
138
|
+
<div class="method-heading">
|
|
139
|
+
<a href="#M000252" class="method-signature">
|
|
140
|
+
<span class="method-name">from_file</span><span class="method-args">(filename)</span>
|
|
141
|
+
</a>
|
|
142
|
+
</div>
|
|
143
|
+
|
|
144
|
+
<div class="method-description">
|
|
145
|
+
<p><a class="source-toggle" href="#"
|
|
146
|
+
onclick="toggleCode('M000252-source');return false;">[Source]</a></p>
|
|
147
|
+
<div class="method-source-code" id="M000252-source">
|
|
148
|
+
<pre>
|
|
149
|
+
<span class="ruby-comment cmt"># File lib/utils/crypto-key.rb, line 64</span>
|
|
150
|
+
64: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">from_file</span>(<span class="ruby-identifier">filename</span>)
|
|
151
|
+
65: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">new</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">read</span>( <span class="ruby-identifier">filename</span> )
|
|
152
|
+
66: <span class="ruby-keyword kw">end</span>
|
|
153
|
+
</pre>
|
|
154
|
+
</div>
|
|
155
|
+
</div>
|
|
156
|
+
</div>
|
|
157
|
+
|
|
158
|
+
<div id="method-M000251" class="method-detail">
|
|
159
|
+
<a name="M000251"></a>
|
|
160
|
+
|
|
161
|
+
<div class="method-heading">
|
|
162
|
+
<a href="#M000251" class="method-signature">
|
|
163
|
+
<span class="method-name">new</span><span class="method-args">(data)</span>
|
|
164
|
+
</a>
|
|
165
|
+
</div>
|
|
166
|
+
|
|
167
|
+
<div class="method-description">
|
|
168
|
+
<p><a class="source-toggle" href="#"
|
|
169
|
+
onclick="toggleCode('M000251-source');return false;">[Source]</a></p>
|
|
170
|
+
<div class="method-source-code" id="M000251-source">
|
|
171
|
+
<pre>
|
|
172
|
+
<span class="ruby-comment cmt"># File lib/utils/crypto-key.rb, line 57</span>
|
|
173
|
+
57: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">data</span>)
|
|
174
|
+
58: <span class="ruby-ivar">@data</span> = <span class="ruby-identifier">data</span>
|
|
175
|
+
59: <span class="ruby-ivar">@public</span> = (<span class="ruby-identifier">data</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^-----BEGIN (RSA|DSA) PRIVATE KEY-----$/</span>).<span class="ruby-identifier">nil?</span>
|
|
176
|
+
60: <span class="ruby-ivar">@key</span> = <span class="ruby-constant">OpenSSL</span><span class="ruby-operator">::</span><span class="ruby-constant">PKey</span><span class="ruby-operator">::</span><span class="ruby-constant">RSA</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@data</span>)
|
|
177
|
+
61: <span class="ruby-keyword kw">end</span>
|
|
178
|
+
</pre>
|
|
179
|
+
</div>
|
|
180
|
+
</div>
|
|
181
|
+
</div>
|
|
182
|
+
|
|
183
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
|
184
|
+
|
|
185
|
+
<div id="method-M000254" class="method-detail">
|
|
186
|
+
<a name="M000254"></a>
|
|
187
|
+
|
|
188
|
+
<div class="method-heading">
|
|
189
|
+
<a href="#M000254" class="method-signature">
|
|
190
|
+
<span class="method-name">decrypt</span><span class="method-args">(text)</span>
|
|
191
|
+
</a>
|
|
192
|
+
</div>
|
|
193
|
+
|
|
194
|
+
<div class="method-description">
|
|
195
|
+
<p><a class="source-toggle" href="#"
|
|
196
|
+
onclick="toggleCode('M000254-source');return false;">[Source]</a></p>
|
|
197
|
+
<div class="method-source-code" id="M000254-source">
|
|
198
|
+
<pre>
|
|
199
|
+
<span class="ruby-comment cmt"># File lib/utils/crypto-key.rb, line 72</span>
|
|
200
|
+
72: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">decrypt</span>(<span class="ruby-identifier">text</span>)
|
|
201
|
+
73: <span class="ruby-ivar">@key</span>.<span class="ruby-identifier">send</span>(<span class="ruby-node">"#{type}_decrypt"</span>, <span class="ruby-constant">Base64</span>.<span class="ruby-identifier">decode64</span>(<span class="ruby-identifier">text</span>))
|
|
202
|
+
74: <span class="ruby-keyword kw">end</span>
|
|
203
|
+
</pre>
|
|
204
|
+
</div>
|
|
205
|
+
</div>
|
|
206
|
+
</div>
|
|
207
|
+
|
|
208
|
+
<div id="method-M000253" class="method-detail">
|
|
209
|
+
<a name="M000253"></a>
|
|
210
|
+
|
|
211
|
+
<div class="method-heading">
|
|
212
|
+
<a href="#M000253" class="method-signature">
|
|
213
|
+
<span class="method-name">encrypt</span><span class="method-args">(text)</span>
|
|
214
|
+
</a>
|
|
215
|
+
</div>
|
|
216
|
+
|
|
217
|
+
<div class="method-description">
|
|
218
|
+
<p><a class="source-toggle" href="#"
|
|
219
|
+
onclick="toggleCode('M000253-source');return false;">[Source]</a></p>
|
|
220
|
+
<div class="method-source-code" id="M000253-source">
|
|
221
|
+
<pre>
|
|
222
|
+
<span class="ruby-comment cmt"># File lib/utils/crypto-key.rb, line 68</span>
|
|
223
|
+
68: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">encrypt</span>(<span class="ruby-identifier">text</span>)
|
|
224
|
+
69: <span class="ruby-constant">Base64</span>.<span class="ruby-identifier">encode64</span>(<span class="ruby-ivar">@key</span>.<span class="ruby-identifier">send</span>(<span class="ruby-node">"#{type}_encrypt"</span>, <span class="ruby-identifier">text</span>))
|
|
225
|
+
70: <span class="ruby-keyword kw">end</span>
|
|
226
|
+
</pre>
|
|
227
|
+
</div>
|
|
228
|
+
</div>
|
|
229
|
+
</div>
|
|
230
|
+
|
|
231
|
+
<div id="method-M000255" class="method-detail">
|
|
232
|
+
<a name="M000255"></a>
|
|
233
|
+
|
|
234
|
+
<div class="method-heading">
|
|
235
|
+
<a href="#M000255" class="method-signature">
|
|
236
|
+
<span class="method-name">private?</span><span class="method-args">()</span>
|
|
237
|
+
</a>
|
|
238
|
+
</div>
|
|
239
|
+
|
|
240
|
+
<div class="method-description">
|
|
241
|
+
<p><a class="source-toggle" href="#"
|
|
242
|
+
onclick="toggleCode('M000255-source');return false;">[Source]</a></p>
|
|
243
|
+
<div class="method-source-code" id="M000255-source">
|
|
244
|
+
<pre>
|
|
245
|
+
<span class="ruby-comment cmt"># File lib/utils/crypto-key.rb, line 76</span>
|
|
246
|
+
76: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">private?</span>() <span class="ruby-operator">!</span><span class="ruby-ivar">@public</span>; <span class="ruby-keyword kw">end</span>
|
|
247
|
+
</pre>
|
|
248
|
+
</div>
|
|
249
|
+
</div>
|
|
250
|
+
</div>
|
|
251
|
+
|
|
252
|
+
<div id="method-M000256" class="method-detail">
|
|
253
|
+
<a name="M000256"></a>
|
|
254
|
+
|
|
255
|
+
<div class="method-heading">
|
|
256
|
+
<a href="#M000256" class="method-signature">
|
|
257
|
+
<span class="method-name">public?</span><span class="method-args">()</span>
|
|
258
|
+
</a>
|
|
259
|
+
</div>
|
|
260
|
+
|
|
261
|
+
<div class="method-description">
|
|
262
|
+
<p><a class="source-toggle" href="#"
|
|
263
|
+
onclick="toggleCode('M000256-source');return false;">[Source]</a></p>
|
|
264
|
+
<div class="method-source-code" id="M000256-source">
|
|
265
|
+
<pre>
|
|
266
|
+
<span class="ruby-comment cmt"># File lib/utils/crypto-key.rb, line 78</span>
|
|
267
|
+
78: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">public?</span>() <span class="ruby-ivar">@public</span>; <span class="ruby-keyword kw">end</span>
|
|
268
|
+
</pre>
|
|
269
|
+
</div>
|
|
270
|
+
</div>
|
|
271
|
+
</div>
|
|
272
|
+
|
|
273
|
+
<div id="method-M000257" class="method-detail">
|
|
274
|
+
<a name="M000257"></a>
|
|
275
|
+
|
|
276
|
+
<div class="method-heading">
|
|
277
|
+
<a href="#M000257" class="method-signature">
|
|
278
|
+
<span class="method-name">type</span><span class="method-args">()</span>
|
|
279
|
+
</a>
|
|
280
|
+
</div>
|
|
281
|
+
|
|
282
|
+
<div class="method-description">
|
|
283
|
+
<p><a class="source-toggle" href="#"
|
|
284
|
+
onclick="toggleCode('M000257-source');return false;">[Source]</a></p>
|
|
285
|
+
<div class="method-source-code" id="M000257-source">
|
|
286
|
+
<pre>
|
|
287
|
+
<span class="ruby-comment cmt"># File lib/utils/crypto-key.rb, line 80</span>
|
|
288
|
+
80: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">type</span>
|
|
289
|
+
81: <span class="ruby-ivar">@public</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">:public</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">:private</span>
|
|
290
|
+
82: <span class="ruby-keyword kw">end</span>
|
|
291
|
+
</pre>
|
|
292
|
+
</div>
|
|
293
|
+
</div>
|
|
294
|
+
</div>
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
</div>
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
</div>
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
<div id="validator-badges">
|
|
304
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
|
305
|
+
</div>
|
|
306
|
+
|
|
307
|
+
</body>
|
|
308
|
+
</html>
|