diff options
author | Eric Milkie <milkie@10gen.com> | 2012-10-18 13:36:44 -0400 |
---|---|---|
committer | Eric Milkie <milkie@10gen.com> | 2012-10-23 10:26:31 -0400 |
commit | 82099aad599f6fd97881d703edd0ea4bfce4444c (patch) | |
tree | cc371d3d94d6ac465d8eab277a98b28c84c5c3d1 /src/mongo/util/net/ssl_manager.h | |
parent | ee1220d4c71d9bbc18c1bd9f68893525db0f63be (diff) | |
download | mongo-82099aad599f6fd97881d703edd0ea4bfce4444c.tar.gz |
move SSLManager to new source files
No functional changes expected.
Diffstat (limited to 'src/mongo/util/net/ssl_manager.h')
-rw-r--r-- | src/mongo/util/net/ssl_manager.h | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/src/mongo/util/net/ssl_manager.h b/src/mongo/util/net/ssl_manager.h new file mode 100644 index 00000000000..6c23e2be09f --- /dev/null +++ b/src/mongo/util/net/ssl_manager.h @@ -0,0 +1,51 @@ +/* Copyright 2009 10gen Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#ifdef MONGO_SSL + +#pragma once + +#include <string> +#include "mongo/base/disallow_copying.h" + +#include <openssl/err.h> +#include <openssl/ssl.h> + +namespace mongo { + class SSLManager { + MONGO_DISALLOW_COPYING(SSLManager); + public: + SSLManager( bool client ); + + /** @return true if was successful, otherwise false */ + bool setupPEM( const std::string& keyFile , const std::string& password ); + void setupPubPriv( const std::string& privateKeyFile , const std::string& publicKeyFile ); + + /** + * creates an SSL context to be used for this file descriptor + * caller should delete + */ + SSL * secure( int fd ); + + static int password_cb( char *buf,int num, int rwflag,void *userdata ); + + private: + bool _client; + SSL_CTX* _context; + std::string _password; + }; +} +#endif |