/// <summary>
            /// ValidateKeyV1 method implmentation
            /// </summary>
            public override bool ValidateKey(string upn)
            {
                if (string.IsNullOrEmpty(upn))
                {
                    return(false);
                }
                string lupn = upn.ToLower();
                string key  = ReadKey(lupn);

                if (string.IsNullOrEmpty(key))
                {
                    return(false);
                }
                if (HasStorageInfos(key))
                {
                    using (var prov = new AES128Encryption(XORSecret, KeySize))
                    {
                        byte[] crypted = StripStorageInfos(key);
                        if (crypted == null)
                        {
                            return(false);
                        }
                        byte[] cleared = prov.GetDecryptedKey(crypted, lupn);

                        if (cleared == null)
                        {
                            return(false); // Key corrupted
                        }
                        if (prov.CheckSum == null)
                        {
                            return(false); // Key corrupted
                        }
                        if (prov.CheckSum.SequenceEqual(CheckSumEncoding.CheckSum(lupn)))
                        {
                            return(true);  // OK
                        }
                        else
                        {
                            return(false); // Key corrupted
                        }
                    }
                }
                else
                {
                    return(false);
                }
            }
            /// <summary>
            /// NewKey method implementation
            /// </summary>
            public override string NewKey(string upn)
            {
                if (string.IsNullOrEmpty(upn))
                {
                    return(null);
                }
                string lupn = upn.ToLower();

                byte[] crypted = null;
                using (var prov = new AES128Encryption(XORSecret, KeySize))
                {
                    crypted = prov.NewEncryptedKey(lupn);
                    if (crypted == null)
                    {
                        return(null);
                    }
                }
                string outkey = AddStorageInfos(crypted);

                return(KeysStorage.NewUserKey(lupn, outkey));
            }
            /// <summary>
            /// EncodedKey method implementation
            /// </summary>
            public override string EncodedKey(string upn)
            {
                if (string.IsNullOrEmpty(upn))
                {
                    return(null);
                }
                string lupn = upn.ToLower();
                string key  = ReadKey(lupn);

                if (string.IsNullOrEmpty(key))
                {
                    return(null);
                }

                byte[] cleared = null;
                using (var prov = new AES128Encryption(XORSecret, KeySize))
                {
                    byte[] crypted = StripStorageInfos(key);
                    if (crypted == null)
                    {
                        return(null);
                    }

                    cleared = prov.GetDecryptedKey(crypted, lupn);
                    if (cleared == null)
                    {
                        return(null);
                    }
                }
                if (cleared.Length > MAX_PROBE_LEN)
                {
                    byte[] buffer = new byte[MAX_PROBE_LEN];
                    Buffer.BlockCopy(cleared, 0, buffer, 0, MAX_PROBE_LEN);
                    return(Base32.Encode(buffer));
                }
                else
                {
                    return(Base32.Encode(cleared));
                }
            }
            /// <summary>
            /// ProbeKeyV1 method implmentation
            /// </summary>
            public override byte[] ProbeKey(string upn)
            {
                if (string.IsNullOrEmpty(upn))
                {
                    return(null);
                }
                string lupn = upn.ToLower();
                string key  = ReadKey(lupn);

                if (string.IsNullOrEmpty(key))
                {
                    return(null);
                }

                byte[] probed  = null;
                byte[] crypted = StripStorageInfos(key);
                if (crypted == null)
                {
                    return(null);
                }
                using (var prov = new AES128Encryption(XORSecret))
                {
                    probed = prov.GetDecryptedKey(crypted, lupn);
                    if (probed == null)
                    {
                        return(null);
                    }
                }
                if (probed.Length > MAX_PROBE_LEN)
                {
                    byte[] buffer = new byte[MAX_PROBE_LEN];
                    Buffer.BlockCopy(probed, 0, buffer, 0, MAX_PROBE_LEN);
                    return(buffer);
                }
                else
                {
                    return(probed);
                }
            }