public SharedSecretResponse Encrypt(PublicKey rsaPublicKey, BitString keyingMaterial, BitString additionalInput) { var keyingMaterialByteLen = keyingMaterial.BitLength.CeilingDivide(BitString.BITSINBYTE); var newKeyingMaterial = keyingMaterial.GetDeepCopy(); // Modify a random byte in the keying material prior to executing the base method newKeyingMaterial[_random.GetRandomInt(0, keyingMaterialByteLen)] += 2; return(_kts.Encrypt(rsaPublicKey, newKeyingMaterial, additionalInput)); }
public SharedSecretResponse Encrypt(PublicKey rsaPublicKey, BitString keyingMaterial, BitString additionalInput) { var result = _kts.Encrypt(rsaPublicKey, keyingMaterial, additionalInput); var dkmByteLen = result.SharedSecretZ.BitLength.CeilingDivide(BitString.BITSINBYTE); // Modify a random byte in the result prior to returning result.SharedSecretZ[_random.GetRandomInt(0, dkmByteLen)] += 2; return(result); }