Windows 10客户端及Windows server 2016 服务器可以使用powershell 命令获得系统支持的密码套件列表,禁用启用相应的密码套件。

#命令链接:https://technet.microsoft.com/zh-cn/library/dn931990.aspx
#win10 server2016获得系统支持的套件的列表
Get-TlsCipherSuite |ft name
#win10 server2016启用密码套件
Enable-TlsCipherSuite -name ""
#win10 server2016禁用密码套件
Disable-TlsCipherSuite -name ""

Windows server 2016之前版本微软并没有给出相应的powershell 命令来获取密码套件列表,但在msdn上给出了c++代码

msdn链接:https://msdn.microsoft.com/en-us/library/windows/desktop/bb870930(v=vs.85).aspx

 #include <stdio.h>
#include <windows.h>
#include <bcrypt.h> void main()
{ HRESULT Status = ERROR_SUCCESS;
DWORD cbBuffer = ;
PCRYPT_CONTEXT_FUNCTIONS pBuffer = NULL; Status = BCryptEnumContextFunctions(
CRYPT_LOCAL,
L"SSL",
NCRYPT_SCHANNEL_INTERFACE,
&cbBuffer,
&pBuffer);
if(FAILED(Status))
{
printf_s("\n**** Error 0x%x returned by BCryptEnumContextFunctions\n", Status);
goto Cleanup;
} if(pBuffer == NULL)
{
printf_s("\n**** Error pBuffer returned from BCryptEnumContextFunctions is null");
goto Cleanup;
} printf_s("\n\n Listing Cipher Suites ");
for(UINT index = ; index < pBuffer->cFunctions; ++index)
{
printf_s("\n%S", pBuffer->rgpszFunctions[index]);
} Cleanup:
if (pBuffer != NULL)
{
BCryptFreeBuffer(pBuffer);
}
}

获得密码套件列表

 #include <stdio.h>
#include <windows.h>
#include <bcrypt.h> void main()
{
SECURITY_STATUS Status = ERROR_SUCCESS;
LPWSTR wszCipher =(L “RSA_EXPORT1024_DES_CBC_SHA”);
Status = BCryptAddContextFunction(
CRYPT_LOCAL,
L “SSL”,
NCRYPT_SCHANNEL_INTERFACE,
wszCipher,
CRYPT_PRIORITY_TOP);
}

添加某个密码套件到优先顶部

 #include <stdio.h>
#include <windows.h>
#include <bcrypt.h> void main()
{
SECURITY_STATUS Status = ERROR_SUCCESS;
LPWSTR wszCipher =(L “TLS_RSA_WITH_RC4_128_SHA”);
Status = BCryptRemoveContextFunction(
CRYPT_LOCAL,
L “SSL”,
NCRYPT_SCHANNEL_INTERFACE,
wszCipher);
}

删除某个密码套件

stackoverflow.上有人将获得密码套件列表的代码改成了c#,然后利用powershell 命令可以直接调用这些代码(add-type),也可以将这些代码利用csc.exe编译成.dll或者.exe,建议编译成exe,可以直接在其他的终端cmd控制台调用。

stackoverflow.链接:https://stackoverflow.com/questions/19695623/how-to-call-schannel-functions-from-net-c

 using System;
using System.Text;
using System.Runtime.InteropServices; namespace ConsoleApplication1
{
class Program
{
[DllImport("Bcrypt.dll", CharSet = CharSet.Unicode)]
static extern uint BCryptEnumContextFunctions(uint dwTable, string pszContext, uint dwInterface, ref uint pcbBuffer, ref IntPtr ppBuffer); [DllImport("Bcrypt.dll")]
static extern void BCryptFreeBuffer(IntPtr pvBuffer); [DllImport("Bcrypt.dll", CharSet = CharSet.Unicode)]
static extern uint BCryptAddContextFunction(uint dwTable, string pszContext, uint dwInterface, string pszFunction, uint dwPosition); [DllImport("Bcrypt.dll", CharSet = CharSet.Unicode)]
static extern uint BCryptRemoveContextFunction(uint dwTable, string pszContext, uint dwInterface, string pszFunction); [StructLayout(LayoutKind.Sequential)]
public struct CRYPT_CONTEXT_FUNCTIONS
{
public uint cFunctions;
public IntPtr rgpszFunctions;
} const uint CRYPT_LOCAL = 0x00000001;
const uint NCRYPT_SCHANNEL_INTERFACE = 0x00010002;
const uint CRYPT_PRIORITY_TOP = 0x00000000;
const uint CRYPT_PRIORITY_BOTTOM = 0xFFFFFFFF; public static void DoStuff()
{
uint cbBuffer = ;
IntPtr ppBuffer = IntPtr.Zero;
uint Status = BCryptEnumContextFunctions(
CRYPT_LOCAL,
"SSL",
NCRYPT_SCHANNEL_INTERFACE,
ref cbBuffer,
ref ppBuffer);
if (Status == )
{
CRYPT_CONTEXT_FUNCTIONS functions = (CRYPT_CONTEXT_FUNCTIONS)Marshal.PtrToStructure(ppBuffer, typeof(CRYPT_CONTEXT_FUNCTIONS));
Console.WriteLine(functions.cFunctions);
IntPtr pStr = functions.rgpszFunctions;
for (int i = ; i < functions.cFunctions; i++)
{
Console.WriteLine(Marshal.PtrToStringUni(Marshal.ReadIntPtr(pStr)));
pStr += IntPtr.Size;
}
BCryptFreeBuffer(ppBuffer);
}
} static void Main(string[] args)
{
DoStuff();
Console.ReadLine();
}
}
}

密码套件列表

openssl 也可以获得密码套件列表:

opessl ciphers -v

微软也给出了各操作系统版本中默认启用的密码套件列表以及相应的设置

各操作系统支持密码套件的列表:https://msdn.microsoft.com/en-us/library/windows/desktop/aa374757%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396

TLS/SSL设置:https://technet.microsoft.com/zh-cn/library/dn786418%28v=ws.11%29.aspx?f=255&MSPPError=-2147217396#BKMK_SchannelTR_SSL30

检查windows系统支持的密码套件的更多相关文章

  1. DOS下windows系统查看wifi密码

    DOS下windows系统查看wifi密码 首先,按win+R键,win键如下 弹出框中输入cmd 在弹出界面输入 netsh wlan show profiles 你可以看到你链接过的所有wifi名 ...

  2. windows系统远程修改密码

    1.需求:公司需要短时间.批量修改一些windows系统的管理员密码: 2.准备工作: a.下载软件:链接:https://pan.baidu.com/s/1kV52DqE1_4siPuxS5Mosc ...

  3. Docker学习笔记-Windows系统支持(一)

    Docker对windows的支持情况: 一.Docker for Windows ServerDocker Enterprise Edition for Windows Server 2016htt ...

  4. 安装Cnario提示.Net 3.5安装错误, 检查Windows系统更新提示无法检查到更新, 安装.Net 3.5提示"Windows无法完成请求的更改, 错误代码:0x800F081F"

    症状: Windows检查系统更新时提示无法完成, 尝试安装.Net 3.5等组件时都无法完成, 错误代码: 0x800F081F 原因: 可能时设置了禁止Windows自动更新, 需要重新打开 解决 ...

  5. Windows系统中CreateFileMapping实现的共享内存及用法

    在32位的Windows系统中,每一个进程都有权访问他自己的4GB(232=4294967296)平面地址空间,没有段,没有选择符,没有near和far指针,没有near和far函数调用,也没有内存模 ...

  6. IBM AppScan 安全扫描:支持弱 SSL 密码套件 分类: 数据安全 2014-06-28 11:34 1844人阅读 评论(0) 收藏

    问题描述: ​ 解决方法: 1.Server 2008(R2) 根据appScan的修订建议访问地址:http://msdn.microsoft.com/en-us/library/windows/d ...

  7. [源码]一键获取windows系统登陆密码vc6版源码

    [源码]一键获取windows系统登陆密码vc6版源码支持:XP/2000/2003/WIN7/2008等 此版本编译出来的程序体积较小几十KB... 而vs版则1点几M,体积整整大了2-30倍对某些 ...

  8. Windows系统服务器IIS7.5 Asp.net支持10万请求的设置方法

    问题现象 ECS Windows系统服务器基于IIS搭建的网站由于IIS默认的配置,服务器最多只能处理5000个同时请求,访问量大时很容易导致报错: Error Summary:  HTTP Erro ...

  9. 通过PowerShell获取Windows系统密码Hash

    当你拿到了系统控制权之后如何才能更长的时间内控制已经拿到这台机器呢?作为白帽子,已经在对手防线上撕开一个口子,如果你需要进一步扩大战果,你首先需要做的就是潜伏下来,收集更多的信息便于你判断,便于有更大 ...

随机推荐

  1. Installing haproxy load balancing for http and https--转载

    This example will guide you through a simple IP based load balancing solution that handles ssl traff ...

  2. ruby冒泡算法删除店铺下的重复评论

    Shop.each do |shop| if !shop.comments.blank? n = shop.comments.length for i in 0..n-1 for j in i+1.. ...

  3. ruby中Regexp用法

    Regexp 正则表达式的类.正则表达式的字面值是以双斜线内夹表达式的形式生成的. /^this is regexp/ 还可以使用Regexp.new(string)来动态地生成正则表达式对象. 超类 ...

  4. vuex中怎么把‘库’中的状态对象赋值给内部对象(三种方法)

    一.通过computed的计算属性直接赋值 import store from '@/store/store' export default{ name: 'count', data(){ retur ...

  5. centos6.5下yum安装mysql5.5

    第一步就是看linu是否安装了mysql,经过rpm -qa|grep mysql查看到centos下安装了mysql5.1,那就开始卸载咯 2 接下来就是卸载mysql5.1了,命令:rpm -e ...

  6. Xamarin学习

    慧都视频:http://training.evget.com/video/5384 极客学院视频:http://www.jikexueyuan.com/course/364.html

  7. C# 数组中的 indexOf 方法

    var array=['REG','2018','2018']; array.indexOf(‘REG’) // 0 array.indexOf(‘R’) // -1 array.indexOf(’2 ...

  8. [C语言] 数据结构-预备知识跨函数使用内存

    跨函数使用内存 一个函数运行结束,使用malloc函数分配的内存,如果不调用free,就不会释放 在另一个函数中还可以继续使用 #include <stdio.h> #include &l ...

  9. CentOS 忘记root密码(重置root密码)

    首先开机选择Advanced options for ****这一行按回车: 然后选中最后是(recovery mode)这一行按"E"进入编辑页面: 将ro recovery改为 ...

  10. Spring系列之——Spring事务以及两大核心IOC和AOP

    1 Spring事务 1.1 Spring事务是什么(百度) 事务是对一系列的数据库操作(比如插入多条数据)进行统一的提交或是回滚操作,如果插入成功,那么一起成功,如果中间一条出现异常,那么回滚之前的 ...