示例#1
0
  void CAESModule::generateKey(uint8_t * const pGeneratedKey) const
  {
    size_t const ByteRead = fortuna_read(pGeneratedKey, static_cast<unsigned long>(getKeySize()), &gInternalData.mRandomGenerator);
    FASSERT(ByteRead == getKeySize());

  	return;
  }
ByteBufferPtr AsymmetricKey::computeSharedSecretKey(AsymmetricKey *publicKey)
{
   if(publicKey->getKeySize() != getKeySize() || !mHasPrivateKey)
      return NULL;

   U8 hash[32];
   unsigned long outLen = sizeof(staticCryptoBuffer);

   TIME_BLOCK(secretSubKeyGen,
   crypto_shared_secret((crypto_key *) mKeyData, (crypto_key *) publicKey->mKeyData,
      staticCryptoBuffer, &outLen);
   )