win32-certstore 0.1.0 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +228 -225
- data/lib/win32/certstore.rb +1 -1
- data/lib/win32/certstore/mixin/assertions.rb +90 -90
- data/lib/win32/certstore/mixin/crypto.rb +203 -203
- data/lib/win32/certstore/mixin/helper.rb +50 -50
- data/lib/win32/certstore/mixin/shell_out.rb +105 -104
- data/lib/win32/certstore/mixin/string.rb +71 -71
- data/lib/win32/certstore/mixin/unicode.rb +50 -50
- data/lib/win32/certstore/store_base.rb +215 -214
- data/lib/win32/certstore/version.rb +6 -6
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 64767d805d6d3804ebb5cf74f3b8e0e58fb30d011dc25f1837ce28788268ca70
|
4
|
+
data.tar.gz: 909aae7b8937fb0b2b58c3a8b52bd073bfc38fd87e0c5f85a81e383e6530ac6b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 468fce72a67383b7f637c28e13121ee2dbdeca97f098172a5105187e90cee799e7b161f12c3bfda750414a45a3021b56885302acb57d3bb1e96739b58e691f79
|
7
|
+
data.tar.gz: f74cb671edfb4a0b4c5743e04e0a8b572c5179724f26295cb24a63a7350833da88600fdd787b1f27f23851a0355a1a53caa45869d43f851aafb486b9739a9a0c
|
data/README.md
CHANGED
@@ -1,225 +1,228 @@
|
|
1
|
-
# win32-certstore
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
```
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
```
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
```
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
```
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
```
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
store.
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
1
|
+
# win32-certstore
|
2
|
+
[![Build Status](https://travis-ci.org/chef/win32-certstore.svg?branch=master)](https://travis-ci.org/chef/win32-certstore)
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/win32-certstore.svg)](https://badge.fury.io/rb/win32-certstore)
|
4
|
+
|
5
|
+
Ruby library for accessing the certificate store on Microsoft Windows:
|
6
|
+
|
7
|
+
## Subcommands
|
8
|
+
|
9
|
+
This library provides the following features.
|
10
|
+
|
11
|
+
### Open certificate store
|
12
|
+
|
13
|
+
Any valid certificate store can be opened in two ways:
|
14
|
+
|
15
|
+
```
|
16
|
+
Win32::Certstore.open("Root") do |store|
|
17
|
+
//your code should be here!
|
18
|
+
end
|
19
|
+
```
|
20
|
+
|
21
|
+
or
|
22
|
+
|
23
|
+
```
|
24
|
+
store = Win32::Certstore.open("Root")
|
25
|
+
```
|
26
|
+
|
27
|
+
### Add certificate
|
28
|
+
|
29
|
+
This method adds a new certificate to an open certificate store.
|
30
|
+
|
31
|
+
```
|
32
|
+
Input - Certificate Object (OpenSSL::X509)
|
33
|
+
Return - True/False
|
34
|
+
```
|
35
|
+
|
36
|
+
**Notes: The certificate must be passed as an `OpenSSL::X509` object.**
|
37
|
+
|
38
|
+
```
|
39
|
+
raw = File.read "C:\GlobalSignRootCA.pem"
|
40
|
+
certificate_object = OpenSSL::X509::Certificate.new raw
|
41
|
+
|
42
|
+
Win32::Certstore.open('Root') do |store|
|
43
|
+
store.add(certificate_object)
|
44
|
+
end
|
45
|
+
```
|
46
|
+
|
47
|
+
or
|
48
|
+
|
49
|
+
```
|
50
|
+
raw = File.read "C:\GlobalSignRootCA.pem"
|
51
|
+
certificate_object = OpenSSL::X509::Certificate.new raw
|
52
|
+
|
53
|
+
store = Win32::Certstore.open('Root')
|
54
|
+
store.add(certificate_object)
|
55
|
+
store.close
|
56
|
+
```
|
57
|
+
|
58
|
+
### Get certificate
|
59
|
+
|
60
|
+
Gets a certificate from an open certificate store and returns it as an `OpenSSL::X509` object.
|
61
|
+
|
62
|
+
```
|
63
|
+
Input - Certificate thumbprint
|
64
|
+
Return - Certificate Object (OpenSSL::X509)
|
65
|
+
```
|
66
|
+
|
67
|
+
```
|
68
|
+
Win32::Certstore.open("Root") do |store|
|
69
|
+
store.get(certificate_thumbprint)
|
70
|
+
end
|
71
|
+
```
|
72
|
+
|
73
|
+
or
|
74
|
+
|
75
|
+
```
|
76
|
+
store = Win32::Certstore.open("Root")
|
77
|
+
store.get(certificate_thumbprint)
|
78
|
+
store.close
|
79
|
+
```
|
80
|
+
|
81
|
+
### List certificates
|
82
|
+
|
83
|
+
Lists all certificates in a certificate store.
|
84
|
+
|
85
|
+
```
|
86
|
+
Input - NA
|
87
|
+
Return - Certificate List in JSON format.
|
88
|
+
```
|
89
|
+
|
90
|
+
```
|
91
|
+
Win32::Certstore.open("Root") do |store|
|
92
|
+
store.list
|
93
|
+
end
|
94
|
+
```
|
95
|
+
|
96
|
+
or
|
97
|
+
|
98
|
+
```
|
99
|
+
store = Win32::Certstore.open("Root")
|
100
|
+
store.list
|
101
|
+
store.close
|
102
|
+
```
|
103
|
+
|
104
|
+
### Delete certificate
|
105
|
+
|
106
|
+
Deletes a certificate from a certificate store.
|
107
|
+
|
108
|
+
```
|
109
|
+
Input - Certificate thumbprint
|
110
|
+
Return - True/False
|
111
|
+
```
|
112
|
+
|
113
|
+
```
|
114
|
+
Win32::Certstore.open("Root") do |store|
|
115
|
+
store.delete(certificate_thumbprint)
|
116
|
+
end
|
117
|
+
```
|
118
|
+
|
119
|
+
or
|
120
|
+
|
121
|
+
```
|
122
|
+
store = Win32::Certstore.open("Root")
|
123
|
+
store.delete(certificate_thumbprint)
|
124
|
+
store.close
|
125
|
+
```
|
126
|
+
|
127
|
+
### Search certificate
|
128
|
+
|
129
|
+
Searches for a certificate in an open certificate store.
|
130
|
+
|
131
|
+
```
|
132
|
+
Input - Search Token as: Comman name, Friendly name, RDN and other attributes
|
133
|
+
Return - Matching certificate list
|
134
|
+
```
|
135
|
+
|
136
|
+
```
|
137
|
+
Win32::Certstore.open("Root") do |store|
|
138
|
+
store.search(search_token)
|
139
|
+
end
|
140
|
+
```
|
141
|
+
|
142
|
+
or
|
143
|
+
|
144
|
+
```
|
145
|
+
store = Win32::Certstore.open("Root")
|
146
|
+
store.search(search_token)
|
147
|
+
store.close
|
148
|
+
```
|
149
|
+
|
150
|
+
### Validate certificate
|
151
|
+
|
152
|
+
Validates a certificate in a certificate store on the basis of time validity.
|
153
|
+
|
154
|
+
```
|
155
|
+
Input - Certificate thumbprint
|
156
|
+
Return - True/False
|
157
|
+
|
158
|
+
```
|
159
|
+
|
160
|
+
```
|
161
|
+
Win32::Certstore.open("Root") do |store|
|
162
|
+
store.valid?(certificate_thumbprint)
|
163
|
+
end
|
164
|
+
```
|
165
|
+
|
166
|
+
or
|
167
|
+
|
168
|
+
```
|
169
|
+
store = Win32::Certstore.open("Root")
|
170
|
+
store.valid?(certificate_thumbprint)
|
171
|
+
store.close
|
172
|
+
```
|
173
|
+
|
174
|
+
### Performing multiple operations
|
175
|
+
|
176
|
+
To perform more than one operations with single certificate store object
|
177
|
+
|
178
|
+
```
|
179
|
+
raw = File.read "C:\GlobalSignRootCA.pem"
|
180
|
+
certificate_object = OpenSSL::X509::Certificate.new raw
|
181
|
+
|
182
|
+
Win32::Certstore.open('Root') do |store|
|
183
|
+
store.add(certificate_object)
|
184
|
+
store.list
|
185
|
+
end
|
186
|
+
```
|
187
|
+
|
188
|
+
or
|
189
|
+
|
190
|
+
```
|
191
|
+
raw = File.read "C:\GlobalSignRootCA.pem"
|
192
|
+
certificate_object = OpenSSL::X509::Certificate.new raw
|
193
|
+
|
194
|
+
store = Win32::Certstore.open('Root')
|
195
|
+
store.add(certificate_object)
|
196
|
+
store.list
|
197
|
+
store.close
|
198
|
+
```
|
199
|
+
|
200
|
+
## Requirements / setup
|
201
|
+
|
202
|
+
### Ruby
|
203
|
+
|
204
|
+
Ruby 1.9.3+ is required.
|
205
|
+
|
206
|
+
## CONTRIBUTING:
|
207
|
+
|
208
|
+
Please file bugs against the WIN32-CERTSTORE project at https://github.com/chef/win32-certstore/issues.
|
209
|
+
|
210
|
+
More information on the contribution process for Chef projects can be found in the [Chef Contributions document](http://docs.chef.io/community_contributions.html).
|
211
|
+
|
212
|
+
# LICENSE:
|
213
|
+
|
214
|
+
Author:: Bryan McLellan (<btm@chef.io>)
|
215
|
+
Copyright:: 2017-2018 Chef Software, Inc.
|
216
|
+
License:: Apache License, Version 2.0
|
217
|
+
|
218
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
219
|
+
you may not use this file except in compliance with the License.
|
220
|
+
You may obtain a copy of the License at
|
221
|
+
|
222
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
223
|
+
|
224
|
+
Unless required by applicable law or agreed to in writing, software
|
225
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
226
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
227
|
+
See the License for the specific language governing permissions and
|
228
|
+
limitations under the License.
|