diff options
author | Mark Spruiell <mes@zeroc.com> | 2002-04-24 21:13:00 +0000 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2002-04-24 21:13:00 +0000 |
commit | 5409c1ecef0f226dedc77721c0d2fc8dfe9e85de (patch) | |
tree | 97ba75bc47a143726d6d8382be3a462e51716700 /cpp/src/IceSSL/RSAKeyPair.cpp | |
parent | cleaning up sample impls (diff) | |
download | ice-5409c1ecef0f226dedc77721c0d2fc8dfe9e85de.tar.bz2 ice-5409c1ecef0f226dedc77721c0d2fc8dfe9e85de.tar.xz ice-5409c1ecef0f226dedc77721c0d2fc8dfe9e85de.zip |
merging from plugins branch
Diffstat (limited to 'cpp/src/IceSSL/RSAKeyPair.cpp')
-rw-r--r-- | cpp/src/IceSSL/RSAKeyPair.cpp | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/cpp/src/IceSSL/RSAKeyPair.cpp b/cpp/src/IceSSL/RSAKeyPair.cpp new file mode 100644 index 00000000000..1d494c22328 --- /dev/null +++ b/cpp/src/IceSSL/RSAKeyPair.cpp @@ -0,0 +1,87 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#include <IceUtil/Config.h> +#include <IceUtil/Base64.h> +#include <IceSSL/RSAKeyPair.h> +#include <IceSSL/RSAPrivateKey.h> +#include <IceSSL/RSAPublicKey.h> +#include <assert.h> + +void ::IceInternal::incRef(::IceSSL::OpenSSL::RSAKeyPair* p) { p->__incRef(); } +void ::IceInternal::decRef(::IceSSL::OpenSSL::RSAKeyPair* p) { p->__decRef(); } + +using std::back_inserter; +using std::string; +using Ice::ByteSeq; +using IceUtil::Base64; + +IceSSL::OpenSSL::RSAKeyPair::RSAKeyPair(const string& key, const string& cert) : + _privateKey(new RSAPrivateKey(key)), + _publicKey(new RSAPublicKey(cert)) +{ + assert(_privateKey != 0); + assert(_publicKey != 0); +} + +IceSSL::OpenSSL::RSAKeyPair::RSAKeyPair(const ByteSeq& keySeq, const ByteSeq& certSeq) : + _privateKey(new RSAPrivateKey(keySeq)), + _publicKey(new RSAPublicKey(certSeq)) +{ + assert(_privateKey != 0); + assert(_publicKey != 0); +} + +IceSSL::OpenSSL::RSAKeyPair::~RSAKeyPair() +{ +} + +void +IceSSL::OpenSSL::RSAKeyPair::keyToBase64(string& b64Key) +{ + _privateKey->keyToBase64(b64Key); +} + +void +IceSSL::OpenSSL::RSAKeyPair::certToBase64(string& b64Cert) +{ + _publicKey->certToBase64(b64Cert); +} + +void +IceSSL::OpenSSL::RSAKeyPair::keyToByteSeq(ByteSeq& keySeq) +{ + _privateKey->keyToByteSeq(keySeq); +} + +void +IceSSL::OpenSSL::RSAKeyPair::certToByteSeq(ByteSeq& certSeq) +{ + _publicKey->certToByteSeq(certSeq); +} + +RSA* +IceSSL::OpenSSL::RSAKeyPair::getRSAPrivateKey() const +{ + return _privateKey->get(); +} + +X509* +IceSSL::OpenSSL::RSAKeyPair::getX509PublicKey() const +{ + return _publicKey->getX509PublicKey(); +} + +IceSSL::OpenSSL::RSAKeyPair::RSAKeyPair(const RSAPrivateKeyPtr& rsa, const RSAPublicKeyPtr& x509) : + _privateKey(rsa), + _publicKey(x509) +{ +} + |