Hi Wei,
I finally got around to doing something with SecureString. It offers
operator (byte*), and all the functionality of basic_string< char >
including the various find*.
* Add the following to secblock.h:
template <class T, class A = AllocatorWithCleanup<T> >
class SecBlock
{
...
template <class U> struct rebind { typedef AllocatorWithCleanup<U> other; };
}
* class 'SecureString' will not compile. Mysteriously, problems appear
with the ctor and conversion from char* to SecureString. Use class
name SecString.
Jeff
#ifndef SEC_STRING_3DBA6092_DE0B_48f5_B484_73F39A26D06
#define SEC_STRING_3DBA6092_DE0B_48f5_B484_73F39A26D06
#include <string>
#pragma warning( push, 3 )
#include <secblock.h>
#pragma warning( pop )
#if defined(_MSC_VER) && (_MSC_VER <= 1300)
# ifndef byte
typedef unsigned char byte;
# endif
#endif
class SecString
: public std::basic_string< char,
std::char_traits<char>,
CryptoPP::SecByteBlock >
{
public:
// Construction
SecString( );
SecString( const SecString& s );
SecString( const std::string& s );
SecString( const char* s );
SecString( char c );
// Destruction
virtual ~SecString( ) { };
// Casting
operator const byte*() { return reinterpret_cast<const byte*>(
this->data() ); }
};
SecString::SecString( const char* s )
{
assign( s, std::char_traits<char>::length( s ) );
}
SecString::SecString( const std::string& s )
{
assign( s.c_str(), s.length() );
}
SecString::SecString( char c )
{
assign( 1, c );
}
#endif // SECURE_STRING_3DBA6092_DE0B_48f5_B484_73F39A26D06
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the "Crypto++ Users"
Google Group.
To unsubscribe, send an email to [EMAIL PROTECTED]
More information about Crypto++ and this group is available at
http://www.cryptopp.com.
-~----------~----~----~----~------~----~------~--~---