How can I find out if the iPhone user currently has a passcode set and encryption enabled?

Disclaimer: This answer was valid until ios 4.3.3 If data protection is turned on, a newly created file will have a nil NSFileProtectionKey by default. If data protection is turned off, a newly created file will have a NSFileProtectionNone NSFileProtectionKey by default. Thus, you could detect the presence of file protection with the following code: … Read more

How to encrypt one entry in web.config

You could put the password into a separate section and encrypt this section only. For example: <?xml version=”1.0″ encoding=”utf-8″ ?> <configuration> <configSections> <section name=”secureAppSettings” type=”System.Configuration.NameValueSectionHandler, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089″ /> </configSections> <appSettings> <add key=”Host” value=”www.foo.com” /> <add key=”Token” value=”qwerqwre” /> <add key=”AccountId” value=”123″ /> <add key=”DepartmentId” value=”456″ /> <add key=”SessionEmail” value=”foo@foo.com” /> <add key=”DefaultFolder” value=”789″ … Read more

How does a cryptographically secure random number generator work?

A cryptographically secure number random generator, as you might use for generating encryption keys, works by gathering entropy – that is, unpredictable input – from a source which other people can’t observe. For instance, /dev/random(4) on Linux collects information from the variation in timing of hardware interrupts from sources such as hard disks returning data, … Read more

AES Encryption – Key versus IV

As you can see from the other answers, having a unique IV per encrypted file is crucial, but why is that? First – let’s review why a unique IV per encrypted file is important. (Wikipedia on IV). The IV adds randomness to your start of your encryption process. When using a chained block encryption mode … Read more