Exemplo n.º 1
0
        private static void CreateSignatureFile(string filePath, string signatureFilePath, byte[] signatureFileBytes, byte[] globalSignature)
        {
            const int offset = 0;

            if (string.IsNullOrEmpty(signatureFilePath))
            {
                signatureFilePath = filePath + Constants.SignatureExtension;
            }
            FileHandling.SetFileAttributesNormal(signatureFilePath);
            using var signatureFile = new FileStream(signatureFilePath, FileMode.Create, FileAccess.ReadWrite, FileShare.Read, Constants.FileStreamBufferSize, FileOptions.SequentialScan);
            signatureFile.Write(signatureFileBytes, offset, signatureFileBytes.Length);
            signatureFile.Write(globalSignature, offset, globalSignature.Length);
            File.SetAttributes(signatureFilePath, FileAttributes.ReadOnly);
        }
Exemplo n.º 2
0
 private static void CreateKeyFile(string filePath, string asymmetricKey)
 {
     FileHandling.SetFileAttributesNormal(filePath);
     File.WriteAllText(filePath, asymmetricKey);
     File.SetAttributes(filePath, FileAttributes.ReadOnly);
 }