OpenSSL

OpenSSL

https://www.openssl.org/

https://github.com/openssl/openssl

不想自己编译可到此处下载:http://slproweb.com/products/Win32OpenSSL.html

编译:

使用libcur中的build-openssl.bat编译

安装ActiveState Perl

https://www.perl.org/

ActivePerl-5.24.1.2402-MSWin32-x86-64int-401627.exe

https://www.activestate.com/products/perl/downloads/thank-you/?dl=https://cli-msi.s3.amazonaws.com/ActivePerl-5.28.msi

Strawberry: https://strawberryperl.com/releases.html

Perl 在 Window 平台上有 ActiveStatePerl 和 Strawberry Perl 编译器。

ActiveState Perl和 Strawberry Perl最大的区别是 Strawberry Perl 里面有多包含一些 CPAN 里的模块, 所以Strawberry Perl 下载的安装文件有 80多M, 而ActiveState Perl 只有20M 左右。

使用libcur中的build-openssl.bat编译

需要注意%PE%路径与VS真是路径

build-openssl.rar

使用方法

使用SVN\3rdparty\openssl目录的openssl

build-openssl.bat放到openssl根目录

build-openssl.bat vc14.2 x86 release -VSpath "D:\Program Files (x86)\Microsoft Visual Studio\2019\Community"
build-openssl.bat vc14.3 x86 release -VSpath "C:\Program Files\Microsoft Visual Studio\2022\Community"

bat内容

@echo off
rem ***************************************************************************
rem *                                  _   _ ____  _
rem *  Project                     ___| | | |  _ \| |
rem *                             / __| | | | |_) | |
rem *                            | (__| |_| |  _ <| |___
rem *                             \___|\___/|_| \_\_____|
rem *
rem * Copyright (C) 2012 - 2019, Steve Holme, <steve_holme@hotmail.com>.
rem *
rem * This software is licensed as described in the file COPYING, which
rem * you should have received as part of this distribution. The terms
rem * are also available at https://curl.haxx.se/docs/copyright.html.
rem *
rem * You may opt to use, copy, modify, merge, publish, distribute and/or sell
rem * copies of the Software, and permit persons to whom the Software is
rem * furnished to do so, under the terms of the COPYING file.
rem *
rem * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
rem * KIND, either express or implied.
rem *
rem ***************************************************************************

:begin
  rem Check we are running on a Windows NT derived OS
  if not "%OS%" == "Windows_NT" goto nodos

  rem Set our variables
  setlocal ENABLEDELAYEDEXPANSION
  set VC_VER=
  set BUILD_PLATFORM=
  set BUILD_CONFIG=

  rem Ensure we have the required arguments
  if /i "%~1" == "" goto syntax

  rem Calculate the program files directory
  if defined PROGRAMFILES (
    set "PF=%PROGRAMFILES%"
    set OS_PLATFORM=x86
  )
  if defined PROGRAMFILES(x86) (
    set "PF=%PROGRAMFILES(x86)%"
    set OS_PLATFORM=x64
  )

:parseArgs
  if not "%~1" == "" (
    if /i "%~1" == "vc6" (
      set VC_VER=6.0
      set VC_DESC=VC6
      set "VC_PATH=Microsoft Visual Studio\VC98"
    ) else if /i "%~1" == "vc7" (
      set VC_VER=7.0
      set VC_DESC=VC7
      set "VC_PATH=Microsoft Visual Studio .NET\Vc7"
    ) else if /i "%~1" == "vc7.1" (
      set VC_VER=7.1
      set VC_DESC=VC7.1
      set "VC_PATH=Microsoft Visual Studio .NET 2003\Vc7"
    ) else if /i "%~1" == "vc8" (
      set VC_VER=8.0
      set VC_DESC=VC8
      set "VC_PATH=Microsoft Visual Studio 8\VC"
    ) else if /i "%~1" == "vc9" (
      set VC_VER=9.0
      set VC_DESC=VC9
      set "VC_PATH=Microsoft Visual Studio 9.0\VC"
    ) else if /i "%~1" == "vc10" (
      set VC_VER=10.0
      set VC_DESC=VC10
      set "VC_PATH=Microsoft Visual Studio 10.0\VC"
    ) else if /i "%~1" == "vc11" (
      set VC_VER=11.0
      set VC_DESC=VC11
      set "VC_PATH=Microsoft Visual Studio 11.0\VC"
    ) else if /i "%~1" == "vc12" (
      set VC_VER=12.0
      set VC_DESC=VC12
      set "VC_PATH=Microsoft Visual Studio 12.0\VC"
    ) else if /i "%~1" == "vc14" (
      set VC_VER=14.0
      set VC_DESC=VC14
      set "VC_PATH=Microsoft Visual Studio 14.0\VC"
    ) else if /i "%~1" == "vc14.1" (
      set VC_VER=14.1
      set VC_DESC=VC14.1

      rem Determine the VC14.1 path based on the installed edition in descending
      rem order (Enterprise, then Professional and finally Community)
      if exist "%PF%\Microsoft Visual Studio\2017\Enterprise\VC" (
        set "VC_PATH=Microsoft Visual Studio\2017\Enterprise\VC"
      ) else if exist "%PF%\Microsoft Visual Studio\2017\Professional\VC" (
        set "VC_PATH=Microsoft Visual Studio\2017\Professional\VC"
      ) else (
        set "VC_PATH=Microsoft Visual Studio\2017\Community\VC"
      )
    ) else if /i "%~1" == "vc14.2" (
      set VC_VER=14.2
      set VC_DESC=VC14.2

      rem Determine the VC14.2 path based on the installed edition in descending
      rem order (Enterprise, then Professional and finally Community)
      if exist "%PF%\Microsoft Visual Studio\2019\Enterprise\VC" (
        set "VC_PATH=Microsoft Visual Studio\2019\Enterprise\VC"
      ) else if exist "%PF%\Microsoft Visual Studio\2019\Professional\VC" (
        set "VC_PATH=Microsoft Visual Studio\2019\Professional\VC"
      ) else (
        set "VC_PATH=Microsoft Visual Studio\2019\Community\VC"
      )
    )else if /i "%~1" == "vc14.3" (
      set VC_VER=14.3
      set VC_DESC=VC14.3

      rem Determine the VC14.3 path based on the installed edition in descending
      rem order (Enterprise, then Professional and finally Community)
      if exist "%PF%\Microsoft Visual Studio\2022\Enterprise\VC" (
        set "VC_PATH=Microsoft Visual Studio\2022\Enterprise\VC"
      ) else if exist "%PF%\Microsoft Visual Studio\2022\Professional\VC" (
        set "VC_PATH=Microsoft Visual Studio\2022\Professional\VC"
      ) else (
        set "VC_PATH=Microsoft Visual Studio\2022\Community\VC"
      )
    )else if /i "%~1%" == "x86" (
      set BUILD_PLATFORM=x86
    ) else if /i "%~1%" == "x64" (
      set BUILD_PLATFORM=x64
    ) else if /i "%~1%" == "debug" (
      set BUILD_CONFIG=debug
    ) else if /i "%~1%" == "release" (
      set BUILD_CONFIG=release
    ) else if /i "%~1" == "-?" (
      goto syntax
    ) else if /i "%~1" == "-h" (
      goto syntax
    ) else if /i "%~1" == "-help" (
      goto syntax
    ) else if /i "%~1" == "-VSpath" (
      if "%~2" == "" (
        echo.
        echo Error. Please provide VS Path.
        goto error
      ) else (
        set "ABS_VC_PATH=%~2\VC"
        shift
      )
    ) else if /i "%~1" == 
06-03
### OpenSSL 使用指南与技术文档 OpenSSL 是一个强大的开源库,提供了加密算法、证书处理和密钥生成功能,广泛应用于网络通信安全[^1]。以下是一些关于 OpenSSL 的使用指南和技术文档的详细信息: #### 1. 安装 OpenSSL 在 Windows 环境下,可以使用轻量级版本 `Win64OpenSSL_Light-1_1_1b` 来安装 OpenSSL。下载并解压后,将可执行文件路径添加到系统的环境变量中以便全局调用[^1]。 #### 2. 常用命令行工具 OpenSSL 提供了一系列命令行工具,用于生成证书、处理私钥以及进行 SSL/TLS 操作。以下是几个常用的命令示例: - **生成私钥**: ```bash openssl genpkey -algorithm RSA -out private_key.pem -pkeyopt rsa_keygen_bits:2048 ``` 该命令会生成一个 2048 位的 RSA 私钥[^1]。 - **生成自签名证书**: ```bash openssl req -x509 -new -nodes -key private_key.pem -sha256 -days 365 -out certificate.crt ``` 此命令基于已有的私钥生成一个有效期为 365 天的自签名证书[^1]。 - **验证证书**: ```bash openssl x509 -in certificate.crt -text -noout ``` 通过此命令可以查看证书的详细信息。 #### 3. 配置 HTTPS 服务 在开发 HTTPS 服务时,可以使用 OpenSSL 生成的证书和私钥配置服务器。例如,在 Nginx 中,可以通过以下配置启用 HTTPS: ```nginx server { listen 443 ssl; server_name example.com; ssl_certificate /path/to/certificate.crt; ssl_certificate_key /path/to/private_key.pem; location / { proxy_pass http://localhost:8080; } } ``` #### 4. 技术文档与资源 为了更深入地了解 OpenSSL,可以参考以下资源: - [OpenSSL 官方文档](https://www.openssl.org/docs/) - [OpenSSL Wiki](https://wiki.openssl.org/index.php/Main_Page) - [OpenSSL Cookbook](https://www.feistyduck.com/books/openssl-cookbook/) 这些资源提供了从基础到高级的全面指导,涵盖了证书管理、加密算法实现以及 TLS 协议的具体应用。 --- ###
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

赤龙绕月

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值