Пример #1
0
 public static byte[] GetAdditionalData(FileStream inputFile, byte[] ephemeralPublicKey)
 {
     byte[] ciphertextLength = BitConversion.GetBytes(inputFile.Length - Constants.FileHeadersLength);
     byte[] magicBytes       = FileHeaders.ReadMagicBytes(inputFile);
     byte[] formatVersion    = FileHeaders.ReadFileFormatVersion(inputFile);
     FileHeaders.ValidateFormatVersion(formatVersion, Constants.EncryptionVersion);
     return(Arrays.Concat(ciphertextLength, magicBytes, formatVersion, ephemeralPublicKey));
 }
Пример #2
0
        public static byte[] GetAdditionalData(string inputFilePath)
        {
            byte[] magicBytes    = FileHeaders.ReadMagicBytes(inputFilePath);
            byte[] formatVersion = FileHeaders.ReadFileFormatVersion(inputFilePath);
            FileHeaders.ValidateFormatVersion(inputFilePath, formatVersion, Constants.EncryptionVersion);
            long fileLength    = FileHandling.GetFileLength(inputFilePath);
            int  headersLength = FileHeaders.GetHeadersLength();

            byte[] ciphertextLength = BitConverter.GetBytes(fileLength - headersLength);
            return(Utilities.ConcatArrays(magicBytes, formatVersion, ciphertextLength));
        }