Cryptography/CafeLib.Cryptography/AesEncryption.cs
/// <summary>
/// Restore encryption components from merged encrypted data
/// </summary>
/// <param name="encryptedBytes">encrypted bytes</param>
/// <returns>encrypted components</returns>
Restore encryption components from merged encrypted data
Restore encryption components from merged encrypted data
private static (byte[] salt, byte[] key, byte[] iv, byte[] data) UnpackArrays(byte[] encryptedBytes)
        {
            var arrays = new byte[4][];
            var index = 0;
            for (var item = 0; item < arrays.Length; ++item)
            {
                var length = BitConverter.ToInt32(encryptedBytes, index);
                index += sizeof(int);
                arrays[item] = new byte[length];
                Array.Copy(encryptedBytes, index, arrays[item], 0, length);
                index += length;
            }
            return (arrays[0], arrays[1], arrays[2], arrays[3]);
        }
private static ( byte [ ] salt , byte [ ] key , byte [ ] iv , byte [ ] data ) UnpackArrays ( byte [ ] encryptedBytes ) { var arrays = new byte [ 4 ] [ ] ; var index = 0 ; for ( var item = 0 ; item < arrays . Length ; ++ item ) { var length = BitConverter . ToInt32 ( encryptedBytes , index ) ; index += sizeof ( int ) ; arrays [ item ] = new byte [ length ] ; Array . Copy ( encryptedBytes , index , arrays [ item ] , 0 , length ) ; index += length ; } return ( arrays [ 0 ] , arrays [ 1 ] , arrays [ 2 ] , arrays [ 3 ] ) ; }
Restore encryption components from merged encrypted data
Restore encryption components from merged encrypted data
None
encryptedBytes
byte[]
None