Esempio n. 1
0
        public static byte[] EncryptMessage(byte[] key, byte[] nonce, byte[] message, ulong sessionID, out byte[] signature)
        {
            SMB2TransformHeader transformHeader = CreateTransformHeader(nonce, message.Length, sessionID);

            byte[] associatedata = transformHeader.GetAssociatedData();
            return(AesCcm.Encrypt(key, nonce, message, associatedata, SMB2TransformHeader.SignatureLength, out signature));
        }
Esempio n. 2
0
 public static byte[] DecryptMessage(byte[] key, SMB2TransformHeader transformHeader, byte[] encryptedMessage)
 {
     byte[] associatedData = transformHeader.GetAssociatedData();
     byte[] aesCcmNonce    = ByteReader.ReadBytes(transformHeader.Nonce, 0, AesCcmNonceLength);
     return(AesCcm.DecryptAndAuthenticate(key, aesCcmNonce, encryptedMessage, associatedData, transformHeader.Signature));
 }