Major change to the way certificates are stored now defaults to ~/.retroshare/SSLID/

* supports Multiple Accounts on same computer.
	* Enabled libretroshare tests using Makefiles.
	* restructured RsInit functions: Config Data is now private.
	* switch OpenPGP on by default (added #define to rsinit).
	


git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1451 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2009-07-30 21:27:47 +00:00
parent a7209f1001
commit a023a0bfcd
14 changed files with 1372 additions and 968 deletions

View file

@ -803,7 +803,7 @@ std::string AuthSSL::getIssuerName(std::string id)
bool AuthSSL::getDetails(std::string id, pqiAuthDetails &details)
{
#ifdef AUTHSSL_DEBUG
std::cerr << "AuthSSL::getDetails() " << id;
std::cerr << "AuthSSL::getDetails() \"" << id << "\"";
std::cerr << std::endl;
#endif
sslMtx.lock(); /***** LOCK *****/
@ -1964,6 +1964,59 @@ int LoadCheckX509andGetName(const char *cert_file, std::string &userName, std::s
}
}
// Not dependent on sslroot. load, and detroys the X509 memory.
int LoadCheckX509andGetIssuerName(const char *cert_file, std::string &issuerName, std::string &userId)
{
/* This function loads the X509 certificate from the file,
* and checks the certificate
*/
FILE *tmpfp = fopen(cert_file, "r");
if (tmpfp == NULL)
{
#ifdef AUTHSSL_DEBUG
std::cerr << "sslroot::LoadCheckAndGetX509Name()";
std::cerr << " Failed to open Certificate File:" << cert_file;
std::cerr << std::endl;
#endif
return 0;
}
// get xPGP certificate.
X509 *x509 = PEM_read_X509(tmpfp, NULL, NULL, NULL);
fclose(tmpfp);
// check the certificate.
bool valid = false;
if (x509)
{
valid = ((AuthSSL *) getAuthMgr())->ValidateCertificate(x509, userId);
}
if (valid)
{
// extract the name.
issuerName = getX509CNString(x509->cert_info->issuer);
}
std::cout << getX509Info(x509) << std::endl ;
// clean up.
X509_free(x509);
if (valid)
{
// happy!
return 1;
}
else
{
// something went wrong!
return 0;
}
}
std::string getX509NameString(X509_NAME *name)
{
std::string namestr;