diff options
author | Anthony Neal <aneal@zeroc.com> | 2002-03-05 19:24:28 +0000 |
---|---|---|
committer | Anthony Neal <aneal@zeroc.com> | 2002-03-05 19:24:28 +0000 |
commit | d671d3456850f12d09986100b4bcd3c76fdcab55 (patch) | |
tree | b4a3b4502d01ddca5b1df1a06667273087621e7a /cpp/src | |
parent | eliminating need for .antrc (diff) | |
download | ice-d671d3456850f12d09986100b4bcd3c76fdcab55.tar.bz2 ice-d671d3456850f12d09986100b4bcd3c76fdcab55.tar.xz ice-d671d3456850f12d09986100b4bcd3c76fdcab55.zip |
Cleaned up a few things, added OpenSSL to the link dependencies on Glacier
(needed), and also fixed the CertVerifier in both the Starter Client
and Glacier itself.
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/Glacier/CertVerifier.cpp | 16 | ||||
-rw-r--r-- | cpp/src/Glacier/glacierrouter.dsp | 18 | ||||
-rw-r--r-- | cpp/src/Ice/SslConnectionOpenSSL.cpp | 2 | ||||
-rw-r--r-- | cpp/src/Ice/SslRSAKeyPair.cpp | 130 | ||||
-rw-r--r-- | cpp/src/Ice/SslRSAPrivateKey.cpp | 1 | ||||
-rw-r--r-- | cpp/src/Ice/SslRSAPublicKey.cpp | 1 | ||||
-rw-r--r-- | cpp/src/Ice/ice.dsp | 40 |
7 files changed, 68 insertions, 140 deletions
diff --git a/cpp/src/Glacier/CertVerifier.cpp b/cpp/src/Glacier/CertVerifier.cpp index f99ee3ae277..0e7e059cf16 100644 --- a/cpp/src/Glacier/CertVerifier.cpp +++ b/cpp/src/Glacier/CertVerifier.cpp @@ -8,7 +8,8 @@ // // ********************************************************************** -#include <Glacier/CertVerifier.h> +#include <Glacier/CertVerifier.h>
+#include <Ice/SslRSAPublicKey.h> #include <openssl/err.h> #include <algorithm> #include <iostream> @@ -96,9 +97,14 @@ CertVerifier::verify(int preVerifyOkay, X509_STORE_CTX* x509StoreContext, SSL* s ByteSeq CertVerifier::toByteSeq(X509* certificate) -{ - ByteSeq certByteSeq; - +{
+ IceSecurity::Ssl::OpenSSL::RSAPublicKey publicKey(certificate); +
+ ByteSeq certByteSeq;
+
+ publicKey.certToByteSeq(certByteSeq); +
+/* // Convert the X509 to a unsigned char buffer. unsigned int certSize = i2d_X509(certificate, 0); unsigned char* certBuffer = new unsigned char[certSize]; @@ -108,7 +114,7 @@ CertVerifier::toByteSeq(X509* certificate) // Yet another conversion to a ByteSeq (easy comparison this way). copy(certBuffer, (certBuffer + certSize), back_inserter(certByteSeq)); delete []certBuffer; - +*/ return certByteSeq; } diff --git a/cpp/src/Glacier/glacierrouter.dsp b/cpp/src/Glacier/glacierrouter.dsp index c9bd22bc416..fdbb1e1b5ba 100644 --- a/cpp/src/Glacier/glacierrouter.dsp +++ b/cpp/src/Glacier/glacierrouter.dsp @@ -25,7 +25,7 @@ CFG=GlacierRouter - Win32 Debug # PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
-CPP=xicl6.exe
+CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "GlacierRouter - Win32 Release"
@@ -49,9 +49,9 @@ RSC=rc.exe BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
-LINK32=xilink6.exe
+LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 /nologo /subsystem:console /machine:I386 /out:"C:\marc\ice\bin\glacier.exe" /libpath:"../../../lib"
+# ADD LINK32 libeay32.lib ssleay32.lib /nologo /subsystem:console /machine:I386 /out:"C:\marc\ice\bin\glacier.exe" /libpath:"../../../lib"
# SUBTRACT LINK32 /nodefaultlib
!ELSEIF "$(CFG)" == "GlacierRouter - Win32 Debug"
@@ -75,9 +75,9 @@ LINK32=xilink6.exe BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
-LINK32=xilink6.exe
+LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 /nologo /subsystem:console /debug /machine:I386 /out:"C:\marc\ice\bin\glacier.exe" /pdbtype:sept /libpath:"../../../lib"
+# ADD LINK32 libeay32.lib ssleay32.lib /nologo /subsystem:console /debug /machine:I386 /out:"C:\marc\ice\bin\glacier.exe" /pdbtype:sept /libpath:"../../../lib"
# SUBTRACT LINK32 /nodefaultlib
!ENDIF
@@ -91,6 +91,10 @@ LINK32=xilink6.exe # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
+SOURCE=.\CertVerifier.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\ClientBlobject.cpp
# End Source File
# Begin Source File
@@ -111,6 +115,10 @@ SOURCE=.\ServerBlobject.cpp # PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
+SOURCE=.\CertVerifier.h
+# End Source File
+# Begin Source File
+
SOURCE=.\ClientBlobject.h
# End Source File
# Begin Source File
diff --git a/cpp/src/Ice/SslConnectionOpenSSL.cpp b/cpp/src/Ice/SslConnectionOpenSSL.cpp index f7f5a33a4d3..90356d05045 100644 --- a/cpp/src/Ice/SslConnectionOpenSSL.cpp +++ b/cpp/src/Ice/SslConnectionOpenSSL.cpp @@ -105,7 +105,7 @@ IceSecurity::Ssl::OpenSSL::DefaultCertificateVerifier::verify(int preVerifyOkay, ostringstream outStringStream; - outStringStream << "depth = " << errorDepth << ":" << buf << endl; + outStringStream << "depth = " << dec << errorDepth << ":" << buf << std::endl; if (!preVerifyOkay) { diff --git a/cpp/src/Ice/SslRSAKeyPair.cpp b/cpp/src/Ice/SslRSAKeyPair.cpp index e2876ebc845..9f18a5e3af3 100644 --- a/cpp/src/Ice/SslRSAKeyPair.cpp +++ b/cpp/src/Ice/SslRSAKeyPair.cpp @@ -20,114 +20,47 @@ void ::IceInternal::decRef(::IceSecurity::Ssl::OpenSSL::RSAKeyPair* p) { p->__de using std::back_inserter;
using std::string;
+using Ice::ByteSeq;
using IceUtil::Base64;
IceSecurity::Ssl::OpenSSL::RSAKeyPair::RSAKeyPair(const string& key, const string& cert) :
_privateKey(new RSAPrivateKey(key)),
_publicKey(new RSAPublicKey(cert))
{
-/*
- _privateKey = 0;
- _publicKey = 0;
-
- ByteSeq keySeq = Base64::decode(key);
- ByteSeq certSeq = Base64::decode(cert);
-
- byteSeqToKey(keySeq);
- byteSeqToCert(certSeq);
-*/
}
IceSecurity::Ssl::OpenSSL::RSAKeyPair::RSAKeyPair(const ByteSeq& keySeq, const ByteSeq& certSeq) :
_privateKey(new RSAPrivateKey(keySeq)),
_publicKey(new RSAPublicKey(certSeq))
{
-/*
- _privateKey = 0;
- _publicKey = 0;
- byteSeqToKey(keySeq);
- byteSeqToCert(certSeq);
-*/
}
IceSecurity::Ssl::OpenSSL::RSAKeyPair::~RSAKeyPair()
{
-/*
- RSA_free(_privateKey);
- X509_free(_publicKey);
-*/
}
void
IceSecurity::Ssl::OpenSSL::RSAKeyPair::keyToBase64(string& b64Key)
{
_privateKey->keyToBase64(b64Key);
-
-/*
- ByteSeq keySeq;
- keyToByteSeq(keySeq);
- b64Key = Base64::encode(keySeq);
-*/
}
void
IceSecurity::Ssl::OpenSSL::RSAKeyPair::certToBase64(string& b64Cert)
{
_publicKey->certToBase64(b64Cert);
-/*
- ByteSeq certSeq;
- certToByteSeq(certSeq);
- b64Cert = Base64::encode(certSeq);
-*/
}
void
IceSecurity::Ssl::OpenSSL::RSAKeyPair::keyToByteSeq(ByteSeq& keySeq)
{
_privateKey->keyToByteSeq(keySeq);
-/*
- assert(_privateKey);
-
- // Output the Private Key to a char buffer
- unsigned int privKeySize = i2d_RSAPrivateKey(_privateKey, 0);
-
- assert(privKeySize > 0);
-
- unsigned char* privateKeyBuffer = new unsigned char[privKeySize];
-
- // We have to do this because i2d_RSAPrivateKey changes the pointer.
- unsigned char* privKeyBuff = privateKeyBuffer;
- i2d_RSAPrivateKey(_privateKey, &privKeyBuff);
-
- ucharToByteSeq(privateKeyBuffer, privKeySize, keySeq);
-
- delete []privateKeyBuffer;
-*/
}
void
IceSecurity::Ssl::OpenSSL::RSAKeyPair::certToByteSeq(ByteSeq& certSeq)
{
_publicKey->certToByteSeq(certSeq);
-
-/*
- assert(_publicKey);
-
- // Output the Public Key to a char buffer
- unsigned int pubKeySize = i2d_X509(_publicKey, 0);
-
- assert(pubKeySize > 0);
-
- unsigned char* publicKeyBuffer = new unsigned char[pubKeySize];
-
- // We have to do this because i2d_X509_PUBKEY changes the pointer.
- unsigned char* pubKeyBuff = publicKeyBuffer;
- i2d_X509(_publicKey, &pubKeyBuff);
-
- ucharToByteSeq(publicKeyBuffer, pubKeySize, certSeq);
-
- delete []publicKeyBuffer;
-*/
}
RSA*
@@ -142,70 +75,9 @@ IceSecurity::Ssl::OpenSSL::RSAKeyPair::getX509PublicKey() const return _publicKey->getX509PublicKey();
}
-// IceSecurity::Ssl::OpenSSL::RSAKeyPair::RSAKeyPair(RSA* rsa, X509* x509) :
-
IceSecurity::Ssl::OpenSSL::RSAKeyPair::RSAKeyPair(const RSAPrivateKeyPtr& rsa, const RSAPublicKeyPtr& x509) :
_privateKey(rsa),
_publicKey(x509)
{
}
-/*
-void
-IceSecurity::Ssl::OpenSSL::RSAKeyPair::byteSeqToKey(const ByteSeq& keySeq)
-{
- unsigned char* privateKeyBuffer = byteSeqToUChar(keySeq);
- assert(privateKeyBuffer);
-
- unsigned char* privKeyBuff = privateKeyBuffer;
- unsigned char** privKeyBuffpp = &privKeyBuff;
- RSA** rsapp = &_privateKey;
-
- _privateKey = d2i_RSAPrivateKey(rsapp, privKeyBuffpp, (long)keySeq.size());
- assert(_privateKey);
-
- delete []privateKeyBuffer;
-}
-
-void
-IceSecurity::Ssl::OpenSSL::RSAKeyPair::byteSeqToCert(const ByteSeq& certSeq)
-{
- unsigned char* publicKeyBuffer = byteSeqToUChar(certSeq);
- assert(publicKeyBuffer);
-
- // We have to do this because d2i_X509 changes the pointer.
- unsigned char* pubKeyBuff = publicKeyBuffer;
- unsigned char** pubKeyBuffpp = &pubKeyBuff;
-
- X509** x509pp = &_publicKey;
-
- _publicKey = d2i_X509(x509pp, pubKeyBuffpp, (long)certSeq.size());
- assert(_publicKey);
-
- delete []publicKeyBuffer;
-}
-
-
-void
-IceSecurity::Ssl::OpenSSL::RSAKeyPair::ucharToByteSeq(unsigned char* ucharBuffer, int length, ByteSeq& destBuffer)
-{
- destBuffer.reserve(length);
- std::copy(ucharBuffer, (ucharBuffer + length), back_inserter(destBuffer));
-}
-
-
-unsigned char*
-IceSecurity::Ssl::OpenSSL::RSAKeyPair::byteSeqToUChar(const ByteSeq& sequence)
-{
- int seqSize = sequence.size();
-
- assert(seqSize > 0);
-
- unsigned char* ucharSeq = new unsigned char[seqSize];
- unsigned char* ucharPtr = ucharSeq;
- std::copy(sequence.begin(), sequence.end(), ucharPtr);
-
- return ucharSeq;
-}
-*/
-
diff --git a/cpp/src/Ice/SslRSAPrivateKey.cpp b/cpp/src/Ice/SslRSAPrivateKey.cpp index 2029a581a7a..6f2f3229a74 100644 --- a/cpp/src/Ice/SslRSAPrivateKey.cpp +++ b/cpp/src/Ice/SslRSAPrivateKey.cpp @@ -19,6 +19,7 @@ void ::IceInternal::decRef(::IceSecurity::Ssl::OpenSSL::RSAPrivateKey* p) { p->_ using std::back_inserter;
using std::string;
+using Ice::ByteSeq;
using IceUtil::Base64;
IceSecurity::Ssl::OpenSSL::RSAPrivateKey::RSAPrivateKey(const string& key)
diff --git a/cpp/src/Ice/SslRSAPublicKey.cpp b/cpp/src/Ice/SslRSAPublicKey.cpp index 95391cc5b5c..0ff14313738 100644 --- a/cpp/src/Ice/SslRSAPublicKey.cpp +++ b/cpp/src/Ice/SslRSAPublicKey.cpp @@ -19,6 +19,7 @@ void ::IceInternal::decRef(::IceSecurity::Ssl::OpenSSL::RSAPublicKey* p) { p->__ using std::back_inserter;
using std::string;
+using Ice::ByteSeq;
using IceUtil::Base64;
IceSecurity::Ssl::OpenSSL::RSAPublicKey::RSAPublicKey(const string& cert)
diff --git a/cpp/src/Ice/ice.dsp b/cpp/src/Ice/ice.dsp index 160de8c1a8d..2f7b12fbbff 100644 --- a/cpp/src/Ice/ice.dsp +++ b/cpp/src/Ice/ice.dsp @@ -352,6 +352,10 @@ SOURCE=.\SslGeneralConfig.cpp # End Source File
# Begin Source File
+SOURCE=.\SslIceUtils.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\SslJanitors.cpp
# End Source File
# Begin Source File
@@ -368,6 +372,14 @@ SOURCE=.\SslRSAKeyPair.cpp # End Source File
# Begin Source File
+SOURCE=.\SslRSAPrivateKey.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\SslRSAPublicKey.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\SslSystem.cpp
# End Source File
# Begin Source File
@@ -776,6 +788,10 @@ SOURCE=.\SecureUdp.h # End Source File
# Begin Source File
+SOURCE=..\..\include\Ice\Security.h
+# End Source File
+# Begin Source File
+
SOURCE=..\..\include\Ice\ServantLocator.h
# End Source File
# Begin Source File
@@ -808,6 +824,10 @@ SOURCE=..\..\include\Ice\SslCertificateVerifierF.h # End Source File
# Begin Source File
+SOURCE=..\..\include\Ice\SslCertificateVerifierOpenSSL.h
+# End Source File
+# Begin Source File
+
SOURCE=.\SslCertificateVerifierOpenSSL.h
# End Source File
# Begin Source File
@@ -852,6 +872,10 @@ SOURCE=.\SslGeneralConfig.h # End Source File
# Begin Source File
+SOURCE=.\SslIceUtils.h
+# End Source File
+# Begin Source File
+
SOURCE=.\SslJanitors.h
# End Source File
# Begin Source File
@@ -876,6 +900,22 @@ SOURCE=..\..\include\Ice\SslRSAKeyPairF.h # End Source File
# Begin Source File
+SOURCE=..\..\include\Ice\SslRSAPrivateKey.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\Ice\SslRSAPrivateKeyF.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\Ice\SslRSAPublicKey.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\include\Ice\SslRSAPublicKeyF.h
+# End Source File
+# Begin Source File
+
SOURCE=.\SslSystem.h
# End Source File
# Begin Source File
|