This repository has been archived by the owner on Jan 19, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
certcenter.go
394 lines (359 loc) · 12 KB
/
certcenter.go
1
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
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
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
package certcenter
// Profile fetches basic informations about your profile
//
func Profile() (*ProfileResult, error) {
req := new(apiRequest)
req.result = new(ProfileResult)
err := req.do("Profile")
checkErr(err)
return req.result.(*ProfileResult), err
}
// Limit inquires information about your current limit and used amount
//
func Limit() (*LimitResult, error) {
req := new(apiRequest)
req.result = new(LimitResult)
err := req.do("Limit")
checkErr(err)
return req.result.(*LimitResult), err
}
// Products allows you to fetch a list of valid ProductCodes
//
func Products() (*ProductsResult, error) {
req := new(apiRequest)
req.result = new(ProductsResult)
err := req.do("Products")
checkErr(err)
return req.result.(*ProductsResult), err
}
// ProductDetails inquires detailed information on a particular ProductCode
//
func ProductDetails(ProductCode string) (*ProductDetailsResult, error) {
req := new(apiRequest)
req.result = new(ProductDetailsResult)
req.request = &ProductDetailsRequest{
ProductCode: ProductCode,
}
err := req.do("ProductDetails", CC_PARAM_TYPE_QS)
checkErr(err)
return req.result.(*ProductDetailsResult), err
}
// Quote allows you to generate an individual real-time quotation
//
func Quote(request *QuoteRequest) (*QuoteResult, error) {
req := new(apiRequest)
req.result = new(QuoteResult)
req.request = request
err := req.do("Quote", CC_PARAM_TYPE_QS)
checkErr(err)
return req.result.(*QuoteResult), err
}
// ValidateCSR allows you to parse and validate a PEM-encoded PKCS#10
//
func ValidateCSR(request *ValidateCSRRequest) (*ValidateCSRResult, error) {
req := new(apiRequest)
req.result = new(ValidateCSRResult)
req.request = request
err := req.do("ValidateCSR", CC_PARAM_TYPE_BODY)
checkErr(err)
return req.result.(*ValidateCSRResult), err
}
// UserAgreement fetches the latest subscriber agreement from the CA
//
func UserAgreement(ProductCode string) (*UserAgreementResult, error) {
req := new(apiRequest)
req.result = new(UserAgreementResult)
req.request = &UserAgreementRequest{
ProductCode: ProductCode,
}
err := req.do("UserAgreement", CC_PARAM_TYPE_QS)
checkErr(err)
return req.result.(*UserAgreementResult), err
}
// ApproverList will fetch a list of valid email addresses
// for a particular CommonName and ProductCode
func ApproverList(request *ApproverListRequest) (*ApproverListResult, error) {
req := new(apiRequest)
req.result = new(ApproverListResult)
req.request = request
err := req.do("ApproverList", CC_PARAM_TYPE_QS)
checkErr(err)
return req.result.(*ApproverListResult), err
}
// Order allows you to submit orders for regular certificates
// as well as S/MIME and AlwaysOnSSL certificates
//
func Order(request *OrderRequest) (*OrderResult, error) {
req := new(apiRequest)
req.result = new(OrderResult)
req.request = request
err := req.do("Order", CC_PARAM_TYPE_BODY)
checkErr(err)
return req.result.(*OrderResult), err
}
// PutApproverEmail allows you to reset the email address of the approver
//
func PutApproverEmail(request *PutApproverEmailRequest) (*PutApproverEmailResult, error) {
req := new(apiRequest)
req.result = new(PutApproverEmailResult)
req.request = request
err := req.do("ApproverEmail", CC_PARAM_TYPE_QS|CC_PARAM_TYPE_PATH)
checkErr(err)
return req.result.(*PutApproverEmailResult), err
}
// ResendApproverEmail allows you to resend the approver email to the approvers address
//
func ResendApproverEmail(request *ResendApproverEmailRequest) (*ResendApproverEmailResult, error) {
req := new(apiRequest)
req.result = new(ResendApproverEmailResult)
req.request = request
err := req.do("ApproverEmail", CC_PARAM_TYPE_PATH)
checkErr(err)
return req.result.(*ResendApproverEmailResult), err
}
// GetOrders gives you the capability to query and filter your orders
//
func GetOrders(request *GetOrdersRequest) (*GetOrdersResult, error) {
req := new(apiRequest)
req.result = new(GetOrdersResult)
req.request = request
err := req.do("Orders", CC_PARAM_TYPE_QS)
checkErr(err)
return req.result.(*GetOrdersResult), err
}
// GetModifiedOrders fetches modified orders. You can provide
// a timespan to specify which changes your're interested in
//
func GetModifiedOrders(request *GetModifiedOrdersRequest) (*GetModifiedOrdersResult, error) {
req := new(apiRequest)
req.result = new(GetModifiedOrdersResult)
req.request = request
err := req.do("GetModifiedOrders", CC_PARAM_TYPE_QS)
checkErr(err)
return req.result.(*GetModifiedOrdersResult), err
}
// GetOrder gives you the capability to query a particular order
//
func GetOrder(request *GetOrderRequest) (*GetOrderResult, error) {
req := new(apiRequest)
req.result = new(GetOrderResult)
req.request = request
err := req.do("Order", CC_PARAM_TYPE_QS|CC_PARAM_TYPE_PATH)
checkErr(err)
return req.result.(*GetOrderResult), err
}
// DeleteOrder gives you the capability to cancel a order
//
func DeleteOrder(request *DeleteOrderRequest) (*DeleteOrderResult, error) {
req := new(apiRequest)
req.result = new(DeleteOrderResult)
req.request = request
err := req.do("Order", CC_PARAM_TYPE_PATH)
checkErr(err)
return req.result.(*DeleteOrderResult), err
}
// Reissue allows you to replace an existent certificate in case
// of a key loss or algorithm/key-size upgrade
//
func Reissue(request *ReissueRequest) (*ReissueResult, error) {
req := new(apiRequest)
req.result = new(ReissueResult)
req.request = request
err := req.do("Reissue", CC_PARAM_TYPE_BODY)
checkErr(err)
return req.result.(*ReissueResult), err
}
// Revoke allows you to mark a certificate as invalid.
//
func Revoke(request *RevokeRequest) (*RevokeResult, error) {
req := new(apiRequest)
req.result = new(RevokeResult)
req.request = request
err := req.do("Revoke", CC_PARAM_TYPE_BODY|CC_PARAM_TYPE_PATH)
checkErr(err)
return req.result.(*RevokeResult), err
}
// BaseDomain allows you to fetch a registered base domain for a FQDN
//
func BaseDomain(request *BaseDomainRequest) (*BaseDomainResult, error) {
req := new(apiRequest)
req.result = new(BaseDomainResult)
req.request = request
err := req.do("BaseDomain", CC_PARAM_TYPE_PATH)
checkErr(err)
return req.result.(*BaseDomainResult), err
}
// ValidateName checks a CommonName against the DigiCert EE blacklist
// (AlwaysOnSSL/DigiCert EE only)
//
func ValidateName(request *ValidateNameRequest) (*ValidateNameResult, error) {
req := new(apiRequest)
req.result = new(ValidateNameResult)
req.request = request
err := req.do("ValidateName", CC_PARAM_TYPE_BODY)
checkErr(err)
return req.result.(*ValidateNameResult), err
}
// DNSData retrieve appropriate data for DNS based validation
// (AlwaysOnSSL/DigiCert EE only)
//
func DNSData(request *DNSDataRequest) (*DNSDataResult, error) {
req := new(apiRequest)
req.result = new(DNSDataResult)
req.request = request
err := req.do("DNSData", CC_PARAM_TYPE_BODY)
checkErr(err)
return req.result.(*DNSDataResult), err
}
// FileData retrieve appropriate data for FILE based validation
// (AlwaysOnSSL/DigiCert EE only)
//
func FileData(request *FileDataRequest) (*FileDataResult, error) {
req := new(apiRequest)
req.result = new(FileDataResult)
req.request = request
err := req.do("FileData", CC_PARAM_TYPE_BODY)
checkErr(err)
return req.result.(*FileDataResult), err
}
// VulnerabilityAssessment allows you to configure the
// Vulnerability Assessment (DigiCert certificates, only!)
//
func VulnerabilityAssessment(request *VulnerabilityAssessmentRequest) (*VulnerabilityAssessmentResult, error) {
req := new(apiRequest)
req.result = new(VulnerabilityAssessmentResult)
req.request = request
err := req.do("VulnerabilityAssessment", CC_PARAM_TYPE_BODY)
checkErr(err)
return req.result.(*VulnerabilityAssessmentResult), err
}
// VulnerabilityAssessmentRescan let you initiate a re-scan for a certain order
//
func VulnerabilityAssessmentRescan(request *VulnerabilityAssessmentRescanRequest) (*VulnerabilityAssessmentRescanResult, error) {
req := new(apiRequest)
req.result = new(VulnerabilityAssessmentRescanResult)
req.request = request
err := req.do("VulnerabilityAssessment", CC_PARAM_TYPE_PATH)
checkErr(err)
return req.result.(*VulnerabilityAssessmentRescanResult), err
}
// CreateUser creates a new user and assign the desired rights
//
func CreateUser(request *CreateUserRequest) (*CreateUserResult, error) {
req := new(apiRequest)
req.result = new(CreateUserResult)
req.request = request
err := req.do("User", CC_PARAM_TYPE_BODY)
checkErr(err)
return req.result.(*CreateUserResult), err
}
// UpdateUser updates an user
//
func UpdateUser(request *UpdateUserRequest) (*UpdateUserResult, error) {
req := new(apiRequest)
req.result = new(UpdateUserResult)
req.request = request
err := req.do("User", CC_PARAM_TYPE_PATH|CC_PARAM_TYPE_BODY)
checkErr(err)
return req.result.(*UpdateUserResult), err
}
// GetUser inquires information about a certain user or even all your
// users (if you keep UserData.UsernameOrUserId blank)
//
func GetUser(request *GetUserRequest) (*GetUserResult, error) {
req := new(apiRequest)
req.result = new(GetUserResult)
req.request = request
err := req.do("User", CC_PARAM_TYPE_PATH)
checkErr(err)
return req.result.(*GetUserResult), err
}
// DeleteUser allows you to delete an user
//
func DeleteUser(request *DeleteUserRequest) (*DeleteUserResult, error) {
req := new(apiRequest)
req.result = new(DeleteUserResult)
req.request = request
err := req.do("DeleteUser", CC_PARAM_TYPE_PATH)
checkErr(err)
return req.result.(*DeleteUserResult), err
}
// KvStore allows you to use mod_fauth with CertCenter's free kv-storage
//
func KvStore(request *KeyValueStoreRequest) (*KeyValueStoreResult, error) {
req := new(apiRequest)
req.result = new(KeyValueStoreResult)
req.request = request
err := req.kv()
checkErr(err)
return req.result.(*KeyValueStoreResult), err
}
// CreateVoucher creates a coupon code which can later be redeemded.
//
func CreateVoucher(request *CreateVoucherRequest) (*CreateVoucherResult, error) {
req := new(apiRequest)
req.result = new(CreateVoucherResult)
req.request = request
err := req.do("Voucher", CC_PARAM_TYPE_BODY)
checkErr(err)
return req.result.(*CreateVoucherResult), err
}
// RedeemVoucher let you redeem a previously generated voucher code
//
func RedeemVoucher(request *RedeemVoucherRequest) (*RedeemVoucherResult, error) {
req := new(apiRequest)
req.result = new(RedeemVoucherResult)
req.request = request
err := req.do("Redeem", CC_PARAM_TYPE_BODY)
checkErr(err)
return req.result.(*RedeemVoucherResult), err
}
// GetVouchers inquires information about all your voucher codes.
//
func GetVouchers() (*GetVouchersResult, error) {
req := new(apiRequest)
req.result = new(GetVouchersResult)
err := req.do("Vouchers")
checkErr(err)
return req.result.(*GetVouchersResult), err
}
// GetVoucher inquires information about a particular voucher.
//
func GetVoucher(request *GetVoucherRequest) (*GetVouchersResult, error) {
req := new(apiRequest)
req.result = new(GetVouchersResult)
req.request = request
err := req.do("GetVoucher", CC_PARAM_TYPE_PATH)
checkErr(err)
return req.result.(*GetVouchersResult), err
}
// GetVoucherAnonymously inquires information about a particular voucher.
//
func GetVoucherAnonymously(request *GetVoucherRequest) (*GetVouchersResult, error) {
req := new(apiRequest)
req.result = new(GetVouchersResult)
req.request = request
err := req.do("GetVoucherAnonymously", CC_PARAM_TYPE_PATH)
checkErr(err)
return req.result.(*GetVouchersResult), err
}
// GetVoucherOrderAnonymously inquires information about a order initiated by func RedeemVoucher(..).
//
func GetVoucherOrderAnonymously(request *GetVoucherRequest) (*GetVouchersResult, error) {
req := new(apiRequest)
req.result = new(GetVouchersResult)
req.request = request
err := req.do("GetVoucherOrderAnonymously", CC_PARAM_TYPE_PATH)
checkErr(err)
return req.result.(*GetVouchersResult), err
}
// DeleteVoucher allows you to invalidate a particular voucher code.
//
func DeleteVoucher(request *DeleteVoucherRequest) (*DeleteVoucherResult, error) {
req := new(apiRequest)
req.result = new(DeleteVoucherResult)
req.request = request
err := req.do("DeleteVoucher", CC_PARAM_TYPE_PATH)
checkErr(err)
return req.result.(*DeleteVoucherResult), err
}