MCPcopy Create free account
hub / github.com/OpenDDS/OpenDDS / verify

Method verify

dds/DCPS/security/SSL/SignedDocument.cpp:254–303  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

252};
253
254bool SignedDocument::verify(const Certificate& ca)
255{
256 content_.clear();
257 verified_ = false;
258
259 StackOfX509 certs;
260 if (!certs) {
261 return false;
262 }
263
264 if (!certs.push(ca)) {
265 return false;
266 }
267
268 Bio filebuf;
269 if (!filebuf.new_mem()) {
270 return false;
271 }
272
273 if (!filebuf.write(original_.get_buffer(), static_cast<int>(original_.length()))) {
274 return false;
275 }
276
277 Bio bcont;
278 PKCS7Doc doc(SMIME_read_PKCS7(filebuf.bio(), &bcont.bio()));
279 if (!doc) {
280 OPENDDS_SSL_LOG_ERR("SMIME_read_PKCS7 failed");
281 return false;
282 }
283
284 Bio content;
285 if (!content.new_mem()) {
286 return false;
287 }
288
289 if (!doc.verify(&certs, 0, bcont, content, PKCS7_TEXT | PKCS7_NOVERIFY | PKCS7_NOINTERN)) {
290 return false;
291 }
292
293 char* p = 0;
294 long size = content.get_mem_data(&p);
295 if (size < 0) {
296 return false;
297 }
298
299 content_ = std::string(p, static_cast<size_t>(size));
300 verified_ = true;
301
302 return verified_;
303}
304
305void SignedDocument::load_file(const std::string& path)
306{

Callers

nothing calls this directly

Calls 8

new_memMethod · 0.80
bioMethod · 0.80
get_mem_dataMethod · 0.80
clearMethod · 0.45
pushMethod · 0.45
writeMethod · 0.45
get_bufferMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected