Saturday, December 14, 2024

Understanding Compression and the Encrypting File System

Share

The Windows XP Professional operating system allows for both compression and encryption natively within the operating system by setting given attributes on the files and folders. Both of these functions are mutually exclusive of each other and only one or the other can be enacted on a particular file or directory at any given time.

[NOTES FROM THE FIELD] – What you can do is compress an entire directory and all of the files and folders within that directory and then go in and elect to encrypt select files which will remove the compression bit from those selections that will be come encrypted. A file or folder cannot be both encrypted and compressed at the same time under Windows 2000 or XP Professional natively by the operating system itself.

There is a Compressed Folders feature within Windows XP Professional which provides the ability to create compressed folders and view their contents much in the manner that many other programs such as PKZip and WinZip perform. This article deals with the operating system / attribute driven level of compression and not this particular utility.

It is important to note that compressed folders of this nature, created through the use of the Compressed Folders feature within Windows XP Professional, CAN be encrypted on NTFS partitions and CAN be compressed (only) on FAT16 and FAT32 partitions.

You can compress a folder by selecting the folder, right clicking it and choosing Properties. On the GENERAL tab of the properties page you would select the Advanced button in order to bring up the Advanced Attributes page, as shown below.

On the Advanced Attributes page you would go down to the Compress or Encrypt attributes section where you can choose one checkbox to compress the contents or the other to encrypt them.

[NOTES FROM THE FIELD] – Strangely enough, the options to target are check boxes, which normally denote the ability to choose more than one selection. (Radio buttons are normally used in a situation where only one option from a number of given ones can be selected.) Regardless of which, if you attempt to select both, you will find that your second choice in this section undoes your first selection.

I think the decision to program this property page in this way stems from the fact that you cannot unselect a radio button by clicking on it a second time as you can a checkbox. (This is just my thought on this. This is not backed up by any facts.) If you want to make a folder and the contents “normal” by neither encrypting them nor compressing them, you’d clear the checkboxes.

Once you elect to compress the folder by selecting that checkbox you would click OK and it would seem as if nothing has happened, and actually, nothing has. Until you click APPLY or OK to the main property sheet, you will not be given any further options for this operation.

At that time, the next options are available as shown below.

If you elect to apply changes to the folder only, only the folder itself will become compressed. What this means is that anything currently in the folder will keep it’s current compression state. (In most cases this would mean that the files and other folders within that folder will remain uncompressed.) Anything added to that folder from that point forward will become compressed as it is copied to or moved to the folder.

[NOTES FROM THE FIELD] – Any encrypted file that is moved to or copied to that compressed folder will remain encrypted and will NOT become compressed and hence unencrypted. If the encrypted file that was moved to that folder is right clicked and has the encryption attribute removed it will NOT become compressed automatically.

The only way to compress that file is to individually right click it and choose to compress it or to MOVE it out of and then back into the folder. Simply copying it out to a temporary location and then back in with the OVERWRITE option will NOT cause it to become compressed even if changes were made to the copied out version.

This means that if an encrypted document is unencrypted in a compressed folder it will be in a normal state. If another copy of that document exists somewhere else on the system and it is in a compressed state and editing is performed on it and then saved and then that compressed and updated copy is copied over the older version, that older version will still be uncompressed in that folder that is supposed to compress all new files that are copied in. The updates to the text will be present, but the file will still be uncompressed.

This is because the attributes to the file are not carried over with the changes to the file itself.

This also works for the reverse, from not compressed to compressed.

If you elect to apply changes to the folder and all of the files and subfolders contained within the folder, they will all become compressed.

If you elect to remove compression from the folder itself and choose to make the attribute changes to the folder only, all the files in the folder that were compressed before will remain compressed as you move them around the local system.

When you effect changes to the folder and all of the files subfolders contained within, all of the files will be come uncompressed.

[NOTES FROM THE FIELD] – If there is a file within the folder that is to be uncompressed that is in an encrypted state, it will stay encrypted as the encrypted attribute of that file is not affected by the clearing of the compression attributes of the other files around it and the fold it’s in.

You can select to view compressed and encrypted files in different colors so that you know the state of the file by quickly looking at it.

[NOTES FROM THE FIELD] – In the example above, the file denoted in blue lettering is compressed and the one in green lettering is encrypted. This can be set by going in to the Windows Explorer and choosing Tools and then Folder Options.

On the View tab of the pop up box is where you would select the Show encrypted of compressed NTFS files in color checkbox to enable this feature.

If you copy an attribute set compressed file to a FAT16 or a FAT32 partition or to a floppy disk, it will lose its compression attribute.

The overall rules for compression are as follows:

  • Copying a file within the same NTFS volume causes the file to inherit the compression state of the target folder. When you copy a compressed file to an uncompressed folder, the file is automatically uncompressed.
  • Moving a file or folder within the same NTFS volume causes the file or folder to retain its original compression state. When you move a compressed file to an uncompressed folder, the file remains compressed.
  • Copying a file or folder from one NTFS volume to another causes the file or folder to inherit the compression state of the target folder. When you copy a compressed file from one NTFS volume to another, where the target folder is uncompressed, the file is automatically uncompressed.
  • Moving a file or folder from one NTFS volume to another causes the file or folder to inherit the compression state of the target folder. Windows XP Professional treats a move (cut and paste) as a copy and a delete, the files inherit the compression state of the target folder.
  • Moving or copying a file or folder to a FAT16 or FAT32 volume – Windows XP Professional supports attribute driven compression only on the NTFS file system, so when you move or copy a compressed NTFS file or folder to a FAT volume, (12, 16 or 32) Windows XP Professional will automatically uncompress the file or folder. If you need to maintain some level of compression in this scenario you can use the Compressed Folders feature within Windows XP Professional.
  • Moving or copying a compressed file or folder to a floppy disk or other removable media – Windows XP Professional supports attribute driven compression only on the NTFS file system, so when you move or copy a compressed NTFS file or folder to most types of removable media, Windows XP Professional will automatically uncompress the file or folder because most forms of removable media do not support the NTFS file system. If you need to maintain some level of compression in this scenario you can use the Compressed Folders feature within Windows XP Professional.

Best practices state that you should not attempt to set the compression attribute on software compressed files and folders such as ones set by PKZip and/or WinZip or folders that are compressed by using the Compressed Folders feature within Windows XP Professional because the operating system will attempt to further compress the files. This will not yield any additional savings of space on the hard drive and will unnecessarily burn CPU cycles in the process.

You should also attempt to compress data that is not often modified, as there is some system overhead to uncompressing the files to open them for editing and then compressing them again. This also is the same for files that are moved or copied often. When a compressed file is copied, it is uncompressed, copied, and then compressed again as a new file (depending on its final destination as outlined above.)

The Windows XP Professional operating system allows for both compression and encryption natively within the operating system by setting given attributes on the files and folders. Both of these functions are mutually exclusive of each other and only one or the other can be enacted on a particular file or directory at any given time.

[NOTES FROM THE FIELD] – What you can do is compress an entire directory and all of the files and folders within that directory and then go in and elect to encrypt select files which will remove the compression bit from those selections that will be come encrypted. A file or folder cannot be both encrypted and compressed at the same time under Windows 2000 or XP Professional natively by the operating system itself.

There is a Compressed Folders feature within Windows XP Professional which provides the ability to create compressed folders and view their contents much in the manner that many other programs such as PKZip and WinZip perform. This article deals with the operating system / attribute driven level of compression and not this particular utility.

It is important to note that compressed folders of this nature, created through the use of the Compressed Folders feature within Windows XP Professional, CAN be encrypted on NTFS partitions and CAN be compressed (only) on FAT16 and FAT32 partitions.

You can encrypt a folder by selecting the folder, right clicking it and choosing Properties.

On the GENERAL tab of the properties page you would select the Advanced button in order to bring up the Advanced Attributes page, as shown below.

On the Advanced Attributes page you would go down to the Compress or Encrypt attributes section where you can choose one checkbox to compress the contents or the other to encrypt them.

[NOTES FROM THE FIELD] – Strangely enough, the options to target are check boxes, which normally denote the ability to choose more than one selection. (Radio buttons are normally used in a situation where only one option from a number of given ones can be selected.) Regardless of which, if you attempt to select both, you will find that your second choice in this section undoes your first selection.

I think the decision to program this property page in this way stems from the fact that you cannot unselect a radio button by clicking on it a second time as you can a checkbox. (This is just my thought on this. This is not backed up by any facts.) If you want to make a folder and the contents “normal” by neither encrypting them nor compressing them, you’d clear the checkboxes.

Once you elect to encrypt the folder by selecting that checkbox you would click OK and it would seem as if nothing has happened, and actually, nothing has. Until you click APPLY or OK to the main property sheet, you will not be given any further options for this operation.

At that time, the next options are available as shown below.

If you elect to apply changes to the folder only, only the folder itself will become encrypted. What this means is that anything currently in the folder will keep its current state which is unencrypted. Anything added to that folder from that point forward will become encrypted as it is copied to or moved to the folder.

Once you hit OK you will see the progress of the encryption attribute being set on all the files and subfolders as you have selected.

[NOTES FROM THE FIELD] – Any encrypted file that is moved to or copied to a compressed folder will remain encrypted and will NOT become compressed and hence unencrypted.

If the encrypted file that was moved to that folder is right clicked and has the encryption attribute removed it will NOT become compressed automatically.

The only way to compress that file is to individually right click it and choose to compress it or to MOVE it out of and then back into the folder AFTER the encryption bit has been turned off for that file. Simply copying it out to a temporary location and then back in with the OVERWRITE option will NOT cause it to become compressed even if changes were made to the copied out version.

This means that if an encrypted document is unencrypted in a compressed folder it will be in a normal state, (not encrypted nor compressed). If another copy of that document exists somewhere else on the system and it is in a compressed state and editing is performed on that copy and then saved at that location of the hard drive and then that compressed and updated copy is copied over the older version, that older version will still be uncompressed in that folder that is supposed to compress all new files that are copied in. The updates to the text will be present, but the file will still be uncompressed.

This is because the attributes to the file are not carried over with the changes to the file itself.

This also works for the reverse, from not compressed to compressed.

If you elect to apply changes to the folder and all of the files and subfolders contained within the folder, they will all become encrypted.

If you elect to remove encryption from the folder itself and choose to make the attribute changes to the folder only, all the files in the folder that were encrypted before will remain encrypted and if you copy them within the partition those individual files will remain encrypted. All new files copied to or created in that folder will no longer have the encryption bit set.

When you effect changes to the folder and all of the files subfolders contained within, all of the files will be come decrypted.

[NOTES FROM THE FIELD] – If there is a file within the folder that is to be uncompressed that is in an encrypted state, it will stay encrypted as the encrypted attribute of that file is not affected by the clearing of the compression attributes of the other files around it and the fold it’s in.

You can select to view compressed and encrypted files in different colors so that you know the state of the file by quickly looking at it.

[NOTES FROM THE FIELD] – In the example above, the folders denoted in blue lettering are compressed and the ones in green lettering are encrypted. This can be set by going in to the Windows Explorer and choosing Tools and then Folder Options.

On the View tab of the pop up box is where you would select the Show encrypted of compressed NTFS files in color checkbox to enable this feature.

If you copy an attribute set encrypted file to a FAT16 or a FAT32 partition or to a floppy disk, it will lose its encryption attribute.

Strangely enough, when you perform this same action under Windows 2000 you will not receive this message. You will simply be able to perform your action without the warning.

The overall rules for encryption are as follows (and they are different than compression):

  • When moving or copying a file within the same NTFS volume an encrypted file will not inherit the encryption state of the target folder when that folder is unencrypted. When you copy or move an encrypted file to an unencrypted folder, the file is still encrypted. If you have enabled a folder to encrypt files and you move or copy an unencrypted file to it, it will become encrypted at that point.
  • When copying or moving a file or folder from one NTFS volume to another an encrypted file will not inherit the encryption state of the target folder when that folder is unencrypted. When you copy or move an encrypted file to an unencrypted folder, the file is still encrypted. If you have enabled a folder to encrypt files and you move or copy an unencrypted file to it, across partitions, it will become encrypted at that point.
  • Moving or copying a file or folder to a FAT16 or FAT32 volume – Windows XP Professional supports attribute driven encryption only on the NTFS file system, so when you move or copy an encrypted NTFS file or folder to a FAT volume, (12, 16 or 32) the encryption attribute will be lost.
  • Moving or copying a compressed file or folder to a floppy disk or other removable media – Windows XP Professional supports attribute driven encryption only on the NTFS file system, so when you move or copy an encrypted NTFS file or folder to most types of removable media, the encryption attribute will be lost because most forms of removable media do not support the NTFS file system.

If you should remove encryption from the parent folder only, all the files and subfolders remain encrypted and any new files or folders moved, copied or created in the parent folder will be in an unencrypted state.

The unencrypted folders are shown in black text.

* Originally published at 2000Trainers.com

Click here to sign up for FREE B2B / Tech. newsletters from Murdok!

Jason Zandri has worked as a consultant, systems engineer and technical trainer for a variety of corporate clients in Connecticut over the past five years and currently holds the position of Technical Account Manager for Microsoft Corporation.

He has also written a number of COMPTIA and MICROSOFT prep tests for Boson Software and holds a number of certifications from both companies. Currently, he writes part time for a number of freelance projects, including numerous “HOW TO” and best practices articles for 2000Trainers.com and MCMCSE.com.

Table of contents

Read more

Local News