pkcs7-cryptographer 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +0 -3
- data/lib/pkcs7/cryptographer/entity.rb +7 -3
- data/lib/pkcs7/cryptographer/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf8d46e30794182b24393965b11655facc02bd6597a0856e59516b5b185f2ea1
|
4
|
+
data.tar.gz: 0564d998860e51680e422ae8c87768145458a44ae891e6683754436db7fcb38f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1cce85246daad30252c7db7fa69a48c430069ebb06f7a4c27a410363f64d0182abcd46fd256960e6b13e01642ea581a5d1688d2e4ccd52635810c12e7628520d
|
7
|
+
data.tar.gz: 3a6c09eeb65e4a7fa3d406cc98d9673ccbc253dace154a2ef90ae612bc6c3129f29fe12f03cac7a643887efcd475557229c56bdf8cf93261de6edfd1e78fa4f7
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -118,7 +118,6 @@ Read the following examples to get a better undertanding:
|
|
118
118
|
|
119
119
|
# Client PKI data
|
120
120
|
CLIENT_CERTIFICATE = read_file("client.crt")
|
121
|
-
CLIENT_KEY = read_file("client.key")
|
122
121
|
|
123
122
|
CA_STORE = OpenSSL::X509::Store.new
|
124
123
|
CA_STORE.add_cert(OpenSSL::X509::Certificate.new(CA_CERTIFICATE))
|
@@ -130,9 +129,7 @@ Read the following examples to get a better undertanding:
|
|
130
129
|
)
|
131
130
|
|
132
131
|
client_entity = PKCS7::Cryptographer::Entity.new(
|
133
|
-
key: CLIENT_KEY,
|
134
132
|
certificate: CLIENT_CERTIFICATE,
|
135
|
-
ca_store: CA_STORE
|
136
133
|
)
|
137
134
|
|
138
135
|
# SEND MESSAGE TO THE CLIENT
|
@@ -17,8 +17,12 @@ module PKCS7
|
|
17
17
|
|
18
18
|
# PUBLIC METHODS
|
19
19
|
# ------------------------------------------------------------------------
|
20
|
-
def initialize(
|
21
|
-
|
20
|
+
def initialize(
|
21
|
+
certificate:,
|
22
|
+
key: nil,
|
23
|
+
ca_store: OpenSSL::X509::Store.new
|
24
|
+
)
|
25
|
+
@key = key ? rsa_key(key) : nil
|
22
26
|
@certificate = x509_certificate(certificate)
|
23
27
|
@cryptographer = PKCS7::Cryptographer.new
|
24
28
|
@ca_store = ca_store
|
@@ -57,7 +61,7 @@ module PKCS7
|
|
57
61
|
|
58
62
|
def perform_safely(entity)
|
59
63
|
return false unless trustable_entity?(entity)
|
60
|
-
|
64
|
+
return false unless @key.present?
|
61
65
|
yield
|
62
66
|
end
|
63
67
|
end
|