Public Member Functions | |
verify_signature_impl (PKCS7 *doc, const std::string &content) | |
~verify_signature_impl () | |
int | operator() (const Certificate &ca, unsigned long int flags=0) |
Private Attributes | |
PKCS7 * | doc_ |
const std::string & | content_ |
X509_STORE * | store_ |
X509_STORE_CTX * | store_ctx_ |
BIO * | reader_ |
Definition at line 144 of file SignedDocument.cpp.
OpenDDS::Security::SSL::verify_signature_impl::verify_signature_impl | ( | PKCS7 * | doc, | |
const std::string & | content | |||
) | [inline] |
Definition at line 147 of file SignedDocument.cpp.
References OPENDDS_SSL_LOG_ERR, reader_, store_, and store_ctx_.
00148 : doc_(doc), 00149 content_(content), 00150 store_(NULL), 00151 store_ctx_(NULL), 00152 reader_(NULL) 00153 { 00154 if (NULL == (store_ = X509_STORE_new())) { 00155 OPENDDS_SSL_LOG_ERR("X509_STORE_new failed"); 00156 } 00157 if (NULL == (store_ctx_ = X509_STORE_CTX_new())) { 00158 OPENDDS_SSL_LOG_ERR("X509_STORE_CTX_new failed"); 00159 } 00160 if (NULL == (reader_ = BIO_new(BIO_s_mem()))) { 00161 OPENDDS_SSL_LOG_ERR("BIO_new failed"); 00162 } 00163 }
OpenDDS::Security::SSL::verify_signature_impl::~verify_signature_impl | ( | ) | [inline] |
Definition at line 165 of file SignedDocument.cpp.
References reader_, store_, and store_ctx_.
00166 { 00167 X509_STORE_CTX_free(store_ctx_); 00168 X509_STORE_free(store_); 00169 BIO_free(reader_); 00170 }
int OpenDDS::Security::SSL::verify_signature_impl::operator() | ( | const Certificate & | ca, | |
unsigned long int | flags = 0 | |||
) | [inline] |
Definition at line 172 of file SignedDocument.cpp.
References content_, doc_, len, OPENDDS_SSL_LOG_ERR, reader_, store_, and OpenDDS::Security::SSL::Certificate::x_.
00173 { 00174 if (!doc_) return 1; 00175 if (0 == content_.length()) return 1; 00176 00177 if (1 != X509_STORE_add_cert(store_, ca.x_)) { 00178 OPENDDS_SSL_LOG_ERR("X509_STORE_add_cert failed"); 00179 return 1; 00180 } 00181 00182 size_t len = BIO_write(reader_, content_.c_str(), content_.length()); 00183 if (len <= 0) { 00184 OPENDDS_SSL_LOG_ERR("BIO_write failed"); 00185 return 1; 00186 } 00187 00188 if (1 != PKCS7_verify(doc_, NULL, store_, reader_, NULL, flags)) { 00189 OPENDDS_SSL_LOG_ERR("PKCS7_verify failed"); 00190 return 1; 00191 } 00192 return 0; 00193 }
const std::string& OpenDDS::Security::SSL::verify_signature_impl::content_ [private] |
Definition at line 197 of file SignedDocument.cpp.
Referenced by operator()().
PKCS7* OpenDDS::Security::SSL::verify_signature_impl::doc_ [private] |
Definition at line 196 of file SignedDocument.cpp.
Referenced by operator()().
BIO* OpenDDS::Security::SSL::verify_signature_impl::reader_ [private] |
Definition at line 201 of file SignedDocument.cpp.
Referenced by operator()(), verify_signature_impl(), and ~verify_signature_impl().
X509_STORE* OpenDDS::Security::SSL::verify_signature_impl::store_ [private] |
Definition at line 199 of file SignedDocument.cpp.
Referenced by operator()(), verify_signature_impl(), and ~verify_signature_impl().
X509_STORE_CTX* OpenDDS::Security::SSL::verify_signature_impl::store_ctx_ [private] |
Definition at line 200 of file SignedDocument.cpp.
Referenced by verify_signature_impl(), and ~verify_signature_impl().