簡體   English   中英

Windows上的Apache可以使用什么熵源?

[英]What source of entropy can I use with Apache on Windows?

SSLRandomSeed指令需要/ dev / random類型的文件或輸出隨機字節的可執行文件。 如果我正在編寫程序,則可以在Windows上使用提供熵的功能,但是是否有可供使用的源代碼? 還是我可以從網上下載?

我希望得到比我更了解安全隱患的人進行復習,但是這就是我想出的解決方案。 (它也承載與許可證的片段,並已編譯的二進制這里 )。

// To compile run:
// csc entropy.cs
// If csc is not on your path, it is probably somewhere like C:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc.exe
using System;
using System.Security.Cryptography;

namespace Entropy
{
    class Program
    {
        static void Main(string[] args)
        {
            int numberOfArgs = args.Length;
            int bytesToOutput = 1024;
            if (numberOfArgs > 1)
            {
                Console.WriteLine("Too many arguments. Expected either none, or the number of bytes to output");
                Environment.Exit(-1);
            }
            else if (numberOfArgs == 1)
            {
                bytesToOutput = int.Parse(args[0]);
            }

            byte[] output = new byte[bytesToOutput];
            var provider = RNGCryptoServiceProvider.Create();
            provider.GetBytes(output);
            using (var stdout = Console.OpenStandardOutput())
            {
                stdout.Write(output, 0, bytesToOutput);
            }
        }
    }
}

如果您願意信任該代碼的安全性(不附帶任何保證),則可以獲取二進制版本或自己編譯代碼,然后將其復制到apache目錄中。 然后將這些行添加到您的SSL conf:

SSLRandomSeed startup exec:entropy.exe 512
SSLRandomSeed connect exec:entropy.exe 512

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM