V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
wwwwzf
V2EX  ›  PowerShell

PowerShell 如何导入已有的 SSL 证书

  •  
  •   wwwwzf · 2019-11-02 12:43:38 +08:00 · 3763 次点击
    这是一个创建于 1609 天前的主题,其中的信息可能已经有所发展或是发生改变。

    一个 IIS 导出的 SSL 安全证书,如名叫:test.pfx 它包含密码,比如叫:123456

    如何用 powershell 将他导到另一台服务器上呢? 因为操作系统是 windows core 模式,没有视窗界面,然后卡在这上面了,呜呜,求大佬帮忙。

    4 条回复    2019-11-04 18:06:34 +08:00
    wwwwzf
        1
    wwwwzf  
    OP
       2019-11-02 12:53:55 +08:00
    找到了一个命令行方法,是:
    certutil -f -p 密码 -importpfx 文件名.pfx
    holinhot
        2
    holinhot  
       2019-11-03 10:22:37 +08:00 via iPhone
    Windows core 好处是什么?节约内存?
    ps1aniuge
        3
    ps1aniuge  
       2019-11-04 18:02:21 +08:00
    powershell 玩转 自签名证书

    makecert.exe 是旧版 win 中创建自己签名证书的工具。这个工具在 powershell 中已经废弃,并由 New-SelfSignedCertificate 命令代替。
    此命令属于 pki 模块,win8 及以上 win 可用。win7 的话,即使安装 powershell5.0 也没有此命令。

    get-command -module pki
    CommandType Name Version Source
    ----------- ---- ------- ------
    Cmdlet Add-CertificateEnrollmentPolicyServer 1.0.0.0 pki
    Cmdlet Export-Certificate 1.0.0.0 pki
    Cmdlet Export-PfxCertificate 1.0.0.0 pki
    Cmdlet Get-Certificate 1.0.0.0 pki
    Cmdlet Get-CertificateAutoEnrollmentPolicy 1.0.0.0 pki
    Cmdlet Get-CertificateEnrollmentPolicyServer 1.0.0.0 pki
    Cmdlet Get-CertificateNotificationTask 1.0.0.0 pki
    Cmdlet Get-PfxData 1.0.0.0 pki
    powershell 传教士 整理,分享
    Cmdlet Import-Certificate 1.0.0.0 pki
    Cmdlet Import-PfxCertificate 1.0.0.0 pki
    Cmdlet New-CertificateNotificationTask 1.0.0.0 pki
    Cmdlet New-SelfSignedCertificate 1.0.0.0 pki
    Cmdlet Remove-CertificateEnrollmentPolicyServer 1.0.0.0 pki
    Cmdlet Remove-CertificateNotificationTask 1.0.0.0 pki
    Cmdlet Set-CertificateAutoEnrollmentPolicy 1.0.0.0 pki
    Cmdlet Switch-Certificate 1.0.0.0 pki
    Cmdlet Test-Certificate 1.0.0.0 pki


    手册:
    https://docs.microsoft.com/zh-cn/powershell/module/pkiclient/?view=win10-ps

    看到 import 打头的命令了么?
    @wwwwzf
    ps1aniuge
        4
    ps1aniuge  
       2019-11-04 18:06:34 +08:00   ❤️ 1
    @holinhot 节约内存,安装完开机,占内存 600mb。
    另外,补丁很少,很少需要重启。

    msdn 微软官方原版 win2019
    含 [standard 无 gui 版] , [standard 有 gui 版] , [datacenter 无 gui 版] , [datacenter 有 gui 版] 。
    发布日期:2019-08-21
    cn_windows_server_2019_updated_aug_2019_x64_dvd_ff2d0e8b.iso

    ed2k://|file|cn_windows_server_2019_updated_aug_2019_x64_dvd_ff2d0e8b.iso|5601777664|57641B95146337A3D703EA1C3DB64267|h=XBXCBXABOX66Z7MQGDGXXORIL4OWJDFL|/

    SHA1: 54298C0704B85E31F5E5020BFFFAD8B4C5440066

    https://pan.baidu.com/s/1AYPN2zZ_7eW9VY6sYCZR4A 提取码:vem9
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2660 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 15:26 · PVG 23:26 · LAX 08:26 · JFK 11:26
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.