I use bouncy castle for using Key Derivation Function for ECDH and AES128-GCM.
So It is my code.
byte[] secretZ = txtEcdhKdfZ.Text.HexToByteArray();
byte[] extraInfo = txtEcdhKdfInfo.Text.HexToByteArray();
ECDHKekGenerator egH = new ECDHKekGenerator(DigestUtilities.GetDigest("SHA256"));
egH.Init(new DHKdfParameters(NistObjectIdentifiers.IdAes128Gcm, 128, secretZ, extraInfo));
byte[] symmetricKey = new byte[DigestUtilities.GetDigest("SHA256").GetDigestSize()];
egH.GenerateBytes(symmetricKey, 0, symmetricKey.Length);
txtEcdhKdf.Text = symmetricKey.ToHex();
I saw that code here.
But extraInfo not affect result.
Because the result is always the same whether extraInfo has a value or not.
The secretZ value and keySize in new DHKdfParameters(...) affects the result.
How can I make extraInfo affect the results?