New method - import CRLs from PEM encoded files.

svn path=/trunk/kdesupport/qca/; revision=508540
This commit is contained in:
Brad Hards 2006-02-12 06:58:00 +00:00
parent 81765d206b
commit b6c689e87f
2 changed files with 23 additions and 1 deletions

View File

@ -114,7 +114,7 @@ namespace QCA
ErrorSelfSigned, ///< The certificate is self-signed, and is not found in the list of trusted certificates
ErrorRevoked, ///< The certificate has been revoked
ErrorPathLengthExceeded, ///< The path length from the root CA to this certificate is too long
ErrorExpired, ///< The certificate has expired
ErrorExpired, ///< The certificate has expired, or is not yet valid (e.g. current time is earlier than notBefore time)
ErrorExpiredCA, ///< The Certificate Authority has expired
ErrorValidityUnknown ///< Validity is unknown
};
@ -894,6 +894,17 @@ namespace QCA
\return the CRL corresponding to the contents of the string
*/
static CRL fromPEM(const QString &s, ConvertResult *result = 0, const QString &provider = QString());
/**
Import a PEM encoded %Certificate Revocation List (CRL) from a file
\param fileName the name (and path, if required) of the file containing the certificate in PEM format
\param result a pointer to a ConvertResult, which if not-null will be set to the conversion status
\param provider the provider to use, if a specific provider is required
\return the CRL in the file
*/
static CRL fromPEMFile(const QString &fileName, ConvertResult *result = 0, const QString &provider = QString());
};
/**

View File

@ -747,6 +747,17 @@ CRL CRL::fromPEM(const QString &s, ConvertResult *result, const QString &provide
return c;
}
CRL CRL::fromPEMFile(const QString &fileName, ConvertResult *result, const QString &provider)
{
QString pem;
if(!stringFromFile(fileName, &pem))
{
if(result)
*result = ErrorFile;
return CRL();
}
return fromPEM(pem, result, provider);
}
//----------------------------------------------------------------------------
// Store
//----------------------------------------------------------------------------