The problem is in the middle of Main at the line that reads

```
if ((byte[])Dts.Variables["User::EncryptionKey"].Value == noKey)

```

When GetEncryptionKey 'fails' and returns noKey, the 'if' still takes the 'else' path and I don't see why. I tried this with identical results. 

```
if (noKey.Equals((byte[])Dts.Variables["User::EncryptionKey"].Value))

```

Unless every reference to noKey is somehow instantiating a new copy of byte[0] I don't see how they can be unequal. I've stepped thru numerous times and they certainly look equal.

```
    private static byte[] noKey = new byte[0];

    public void Main()
    {
        int keyLen = 32;
            Dts.Variables["User::EncryptionKey"].Value =
                GetEncryptionKey((string)Dts.Variables["User::EncryptionKeyAsHex"].Value, keyLen);

        if ((byte[])Dts.Variables["User::EncryptionKey"].Value == noKey)
        {
            Dts.TaskResult = (int)ScriptResults.Failure;
        }
        else
        {
            Dts.TaskResult = (int)ScriptResults.Success;
        }
    }

    private static byte[] GetEncryptionKey(string hexString,int numBytes)
    {
            return noKey;  //<-this definitely does get hit!
    }

```