Example #1
0
 public void SetBadNameWithoutEndingNul()
 {
     byte[] rawFileName = Encoding.ASCII.GetBytes("ABCDEFGHIJK.LMNO");
     byte[] dataBlock   = new byte[16];
     rawFileName.CopyTo(dataBlock, 0);
     SetDataBlockBytesReference(HeaderCrypto.Encrypt(dataBlock));
 }
 private void SetTimeStamp(DateTime dateTime, int timeOffset)
 {
     EnsureDataBlock();
     byte[] timeStampBytes = GetTimeStampBytes(dateTime);
     byte[] rawFileTimes   = HeaderCrypto.Decrypt(GetDataBlockBytesReference());
     Array.Copy(timeStampBytes, 0, rawFileTimes, timeOffset, timeStampBytes.Length);
     SetDataBlockBytesReference(HeaderCrypto.Encrypt(rawFileTimes));
 }
        private void EnsureDataBlock()
        {
            if (GetDataBlockBytesReference().Length > 0)
            {
                return;
            }

            SetDataBlockBytesReference(HeaderCrypto.Encrypt(new byte[32]));
        }
        private void EnsureDataBlock()
        {
            if (GetDataBlockBytesReference().Length > 0)
            {
                return;
            }
            byte[] timeBytes = GetTimeStampBytes(OS.Current.UtcNow);

            byte[] rawData = new byte[32];
            Array.Copy(timeBytes, 0, rawData, CreationTimeOffset, timeBytes.Length);
            Array.Copy(timeBytes, 0, rawData, LastAccessTimeOffset, timeBytes.Length);
            Array.Copy(timeBytes, 0, rawData, LastWriteTimeOffset, timeBytes.Length);

            SetDataBlockBytesReference(HeaderCrypto.Encrypt(rawData));
        }
 private void SetVerifier(byte[] verifier)
 {
     byte[] encryptedBlock = HeaderCrypto.Encrypt(verifier);
     SetDataBlockBytesReference(encryptedBlock);
 }