retriving master key and salt from SIP SDP with Convert.FromBase64String
I have an application to decrypt media packets. it require me to provide Master key and salt key.
my SDP provide me (after negotiation ended) with AES_CM_128_HMAC_SHA1_80 inline:Fu8vxnU4x1fcCzbhNrtDV0eq4RnaK4n2/jarOigZ
according to SDP rfc the string after the "inline:" is: "concatenated master key and salt, base64 encoded" when the master key is X bytes and the salt is Y bytes.
I am tyring :
byte[] masterAndSalt = Convert.FromBase64String("Fu8vxnU4x1fcCzbhNrtDV0eq4RnaK4n2/jarOigZ")
and then get the first x bytes to the master and the other Y for salt.
but my app says my keys开发者_开发问答 are wrong, i don't understand - should i use some else than Convert.FromBase64String ?
OK, i got it right. on AES_CM_128_HMAC_SHA1_80 cipher the Master key is 16 byte, and the salt is 14 byte long.
what should be done is to use Convert.FromBase64String on the key, which produced a 30 byte long array, take the first 16 as master, and the last 14 as salt.
the decryption algorithm should produce the session key and salt from it (along with other info).
精彩评论