Ejemplo n.º 1
0
        //Implements IEncryptionMachine.PreserveKeyfile
        //Returns true on success, false on failure. On failure sets LastErrorMessage
        public bool PreserveKeyfile(FortKeyFile keyFile, string path)
        {
            if (!keyFile.Preserve(path))
            {
                this._LastErrorMessage = keyFile.LastErrorMessage;
                return(false);
            }

            return(true);
        }
Ejemplo n.º 2
0
        //Implements IEncryptionMachine.GetNewKeyFile
        //Returns new instance of FortKeyFile
        public FortKeyFile GetNewKeyFile(uint length)
        {
            FortKeyFile kfile;

            byte[] data;

            data = this.GenerateRandomData(length);

            kfile = new FortKeyFile(data, length);

            return(kfile);
        }
Ejemplo n.º 3
0
        //Implements IEncryptionMachine.LoadKeyfileFromDisk
        //On failure, returns null and sets the LastErrorMessage
        public FortKeyFile LoadKeyfileFromDisk(string path)
        {
            FortKeyFile keyFile;

            keyFile = FortKeyFile.LoadFromDisk(path);

            if (keyFile == null)
            {
                this._LastErrorMessage = "Unable to read the key file from disk.";
                return(null);
            }

            if (!keyFile.Validate(keyFile.Data))
            {
                this._LastErrorMessage = "Invalid keyfile data.";
                return(null);
            }

            return(keyFile);
        }