Added all SuisseID Functionality except certificate import from server, which shall remain closed; refs #28
This commit is contained in:
@@ -17,6 +17,57 @@
|
||||
/*! @defgroup gcrypto Auxiliary Crypto-Functions */
|
||||
//@{
|
||||
|
||||
#define CRYPTOLOG_QUOTE(X) CRYPTOLOG_QUOTE2(X)
|
||||
#define CRYPTOLOG_QUOTE2(X) #X
|
||||
#if __GNUC__ >= 2
|
||||
# define CRYPTOLOG_END " -- "<<__PRETTY_FUNCTION__<<std::endl
|
||||
#else
|
||||
# define CRYPTOLOG_END std::endl
|
||||
#endif
|
||||
|
||||
// Logging, enable with -DDEBUG
|
||||
#ifndef CRYPTOLOG
|
||||
# ifndef DEBUG
|
||||
# define CRYPTOLOG(X)
|
||||
# else
|
||||
# include <iostream>
|
||||
# define CRYPTOLOG(X) { \
|
||||
std::string file(__FILE__); \
|
||||
std::string line(CRYPTOLOG_QUOTE(__LINE__)); \
|
||||
std::string::size_type pos(file.rfind('/')); \
|
||||
if (pos!=std::string::npos) file=file.substr(pos+1); \
|
||||
std::string spc1(18>file.size()?std::string(18-file.size(), ' ') \
|
||||
:std::string()); \
|
||||
std::string spc2(4>line.size()?std::string(4-line.size(), ' ') \
|
||||
:std::string()); \
|
||||
std::clog<<"CRYPTO: "<<spc1<<file<<':'<<spc2<<line<<" -- "<<X \
|
||||
<<CRYPTOLOG_END; \
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// Verbose logging, use with care, will also log PINs.
|
||||
// Enable with -DDEBUG -DVERBOSE
|
||||
#ifndef CRYPTOLOG_VERBOSE
|
||||
# if !(defined(DEBUG)&&defined(VERBOSE))
|
||||
# define CRYPTOLOG_VERBOSE(X)
|
||||
# else
|
||||
# include <iostream>
|
||||
# define CRYPTOLOG_VERBOSE(X) { \
|
||||
std::string file(__FILE__); \
|
||||
std::string line(CRYPTOLOG_QUOTE(__LINE__)); \
|
||||
std::string::size_type pos(file.rfind('/')); \
|
||||
if (pos!=std::string::npos) file=file.substr(pos+1); \
|
||||
std::string spc1(18>file.size()?std::string(18-file.size(), ' ') \
|
||||
:std::string()); \
|
||||
std::string spc2(4>line.size()?std::string(4-line.size(), ' ') \
|
||||
:std::string()); \
|
||||
std::clog<<"CRYPTO: "<<spc1<<file<<':'<<spc2<<line<<" -- "<<X \
|
||||
<<CRYPTOLOG_END; \
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
//! @see gcrypto
|
||||
namespace crypto {
|
||||
|
||||
|
Reference in New Issue
Block a user