right_agent 0.9.3 → 0.9.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/right_agent/serialize/secure_serializer.rb +24 -8
- data/right_agent.gemspec +2 -2
- metadata +4 -4
@@ -29,6 +29,27 @@ module RightScale
|
|
29
29
|
class MissingCertificate < Exception; end
|
30
30
|
class InvalidSignature < Exception; end
|
31
31
|
|
32
|
+
# create the one and only SecureSerializer
|
33
|
+
def self.init(serializer, identity, cert, key, store, encrypt = true)
|
34
|
+
@serializer = SecureSerializer.new(serializer, identity, cert, key, store, encrypt)
|
35
|
+
true
|
36
|
+
end
|
37
|
+
|
38
|
+
# Was serializer initialized?
|
39
|
+
def self.initialized?
|
40
|
+
!@serializer.nil?
|
41
|
+
end
|
42
|
+
|
43
|
+
# see SecureSerializer::dump
|
44
|
+
def self.dump(obj, encrypt = nil)
|
45
|
+
@serializer.dump(obj, encrypt)
|
46
|
+
end
|
47
|
+
|
48
|
+
# see SecureSerializer::load
|
49
|
+
def self.load(msg)
|
50
|
+
@serializer.load(msg)
|
51
|
+
end
|
52
|
+
|
32
53
|
# Initialize serializer, must be called prior to using it
|
33
54
|
#
|
34
55
|
# === Parameters
|
@@ -40,7 +61,7 @@ module RightScale
|
|
40
61
|
# encryption (get_recipients) and signature validation (get_signer)
|
41
62
|
# encrypt(Boolean):: true if data should be signed and encrypted, otherwise
|
42
63
|
# just signed, true by default
|
43
|
-
def
|
64
|
+
def initialize(serializer, identity, cert, key, store, encrypt = true)
|
44
65
|
@identity = identity
|
45
66
|
@cert = cert
|
46
67
|
@key = key
|
@@ -48,11 +69,6 @@ module RightScale
|
|
48
69
|
@encrypt = encrypt
|
49
70
|
@serializer = serializer
|
50
71
|
end
|
51
|
-
|
52
|
-
# Was serializer initialized?
|
53
|
-
def self.initialized?
|
54
|
-
@identity && @cert && @key && @store
|
55
|
-
end
|
56
72
|
|
57
73
|
# Serialize, sign, and encrypt message
|
58
74
|
# Sign and encrypt using X.509 certificate
|
@@ -67,7 +83,7 @@ module RightScale
|
|
67
83
|
#
|
68
84
|
# === Raise
|
69
85
|
# Exception:: If certificate identity, certificate store, certificate, or private key missing
|
70
|
-
def
|
86
|
+
def dump(obj, encrypt = nil)
|
71
87
|
raise "Missing certificate identity" unless @identity
|
72
88
|
raise "Missing certificate" unless @cert
|
73
89
|
raise "Missing certificate key" unless @key
|
@@ -106,7 +122,7 @@ module RightScale
|
|
106
122
|
# Exception:: If certificate store, certificate, or private key missing
|
107
123
|
# MissingCertificate:: If could not find certificate for message signer
|
108
124
|
# InvalidSignature:: If message signature check failed for message
|
109
|
-
def
|
125
|
+
def load(msg)
|
110
126
|
raise "Missing certificate store" unless @store
|
111
127
|
raise "Missing certificate" unless @cert || !@encrypt
|
112
128
|
raise "Missing certificate key" unless @key || !@encrypt
|
data/right_agent.gemspec
CHANGED
@@ -24,8 +24,8 @@ require 'rubygems'
|
|
24
24
|
|
25
25
|
Gem::Specification.new do |spec|
|
26
26
|
spec.name = 'right_agent'
|
27
|
-
spec.version = '0.9.
|
28
|
-
spec.date = '2012-03-
|
27
|
+
spec.version = '0.9.4'
|
28
|
+
spec.date = '2012-03-14'
|
29
29
|
spec.authors = ['Lee Kirchhoff', 'Raphael Simon', 'Tony Spataro']
|
30
30
|
spec.email = 'lee@rightscale.com'
|
31
31
|
spec.homepage = 'https://github.com/rightscale/right_agent'
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: right_agent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 51
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 9
|
9
|
-
-
|
10
|
-
version: 0.9.
|
9
|
+
- 4
|
10
|
+
version: 0.9.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Lee Kirchhoff
|
@@ -17,7 +17,7 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2012-03-
|
20
|
+
date: 2012-03-14 00:00:00 -07:00
|
21
21
|
default_executable:
|
22
22
|
dependencies:
|
23
23
|
- !ruby/object:Gem::Dependency
|