+ SilcRng rng, SilcHash hash,
+ const void *id, SilcIdType type)
+{
+ unsigned char *randomdata;
+ SilcBuffer buf;
+
+ /* Get 256 bytes of random data */
+ if (rng)
+ randomdata = silc_rng_get_rn_data(rng, 256);
+ else
+ randomdata = silc_rng_global_get_rn_data(256);
+ if (!randomdata)
+ return NULL;
+
+ buf = silc_auth_public_key_auth_generate_wpub(public_key, private_key,
+ randomdata, 256, hash,
+ id, type);
+
+ memset(randomdata, 0, 256);
+ silc_free(randomdata);
+
+ return buf;
+}
+
+/* Generates Authentication Payload with authentication data. This is used
+ to do public key based authentication. This generates the random data
+ and the actual authentication data. Returns NULL on error. */
+
+SilcBuffer
+silc_auth_public_key_auth_generate_wpub(SilcPublicKey public_key,
+ SilcPrivateKey private_key,
+ const unsigned char *pubdata,
+ SilcUInt32 pubdata_len,
+ SilcHash hash,
+ const void *id, SilcIdType type)