| 310 | } |
| 311 | |
| 312 | bool CCryptoKeyBase::SetFromHexEncodedString( const char *pchEncodedKey ) |
| 313 | { |
| 314 | Wipe(); |
| 315 | |
| 316 | uint32 cubKey = V_strlen( pchEncodedKey ) / 2 + 1; |
| 317 | void *buf = alloca( cubKey ); |
| 318 | |
| 319 | if ( !CCrypto::HexDecode( pchEncodedKey, buf, &cubKey ) ) |
| 320 | { |
| 321 | SecureZeroMemory( buf, cubKey ); |
| 322 | return false; |
| 323 | } |
| 324 | |
| 325 | return SetRawDataAndWipeInput( buf, cubKey ); |
| 326 | } |
| 327 | |
| 328 | |
| 329 | //----------------------------------------------------------------------------- |