inline void crypt_gen_random(span<char> buffer) { static HCRYPTPROV provider = crypt_acquire_provider(PROV_RSA_FULL); if (!CryptGenRandom(provider, int(buffer.size()) , reinterpret_cast<BYTE*>(buffer.data()))) { throw_ex<system_error>(error_code(GetLastError(), system_category())); } }
inline void crypt_gen_random(span<char> buffer) { static HCRYPTPROV provider = crypt_acquire_provider(PROV_RSA_FULL); if (!CryptGenRandom(provider, int(buffer.size()) , reinterpret_cast<BYTE*>(buffer.data()))) { #ifndef BOOST_NO_EXCEPTIONS throw system_error(error_code(GetLastError(), system_category())); #else std::terminate(); #endif } }
HCRYPTPROV get_provider() { static HCRYPTPROV provider = crypt_acquire_provider(ProviderType); return provider; }