参考链接
简略步骤
根据链接1,操作到步骤2.4完成
根据链接2,从步骤2.5开始操作直到完成
注意事项
电脑的主板必须支持修改安全启动的Platform Key(PK),我的华硕主板比较麻烦,需要先关闭安全启动,清除所有安全密钥,然后重启到bios,可以看到PK未加载。然后打开安全启动,加载自己的PK,不要忘了把下面的KEK等加载为主板的默认设置
如果使用
ssde_enable.exe
导致电脑无限重启(一般5次以上才算),参考链接2的办法,找一个U盘,用Rufus装个恢复镜像,从U盘进入,选择命令提示符,输入regedit
,选择Windows\System32\config\SYSTEM
,随便打个名字,设置Setup/CmdLine
为空,Setup/SetupType
为0加载注册表的时候可能出现
加载配置单元
灰色的情况,此时点击HKEY_LOCAL_MACHINE
既可。如果选择用恢复镜像手动设置
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\CI\Protected\Licensed
为1的话,一般来说要尝试3次以上才能成功注意操作的顺序,我的电脑必须先使用
ssde_query.exe
查看返回值为1后,再启动ssde服务,不能把顺序颠倒了。但是虚拟机可以把顺序颠倒。最好先把ssde.sys
签名后再操作记得把
ssde.sys
放到%windir%\system32\drivers\
中需要在命令行中运行
ssde_query.exe
才能看到输出,系统会很快的修改注册表的数值,因此要一开机立马查询,只要输出是1就是成功了,可以执行1
sc create ssde binpath=%windir%\system32\drivers\ssde.sys type=kernel start=boot error=normal
可以使用
sc delete ssde
,sc query ssde
来删除和查询ssde服务(仅限CMD)
详细步骤
创建根证书localhost-root-ca
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
$cert_params = @{ Type = 'Custom' Subject = 'CN=Localhost Root Certification Authority' FriendlyName = 'Localhost Root Certification Authority' TextExtension = '2.5.29.19={text}CA=1' HashAlgorithm = 'sha512' KeyLength = 4096 KeyAlgorithm = 'RSA' KeyUsage = 'CertSign','CRLSign' KeyExportPolicy = 'Exportable' NotAfter = (Get-Date).AddYears(100) CertStoreLocation = 'Cert:\LocalMachine\My' } $root_cert = New-SelfSignedCertificate @cert_params
创建内核代码证书localhost-km
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
$cert_params = @{ Type = 'CodeSigningCert' Subject = 'CN=Localhost Kernel Mode Driver Certificate' FriendlyName = 'Localhost Kernel Mode Driver Certificate' TextExtension = '2.5.29.19={text}CA=0' Signer = $root_cert HashAlgorithm = 'sha256' KeyLength = 2048 KeyAlgorithm = 'RSA' KeyUsage = 'DigitalSignature' KeyExportPolicy = 'Exportable' NotAfter = (Get-Date).AddYears(10) CertStoreLocation = 'Cert:\LocalMachine\My' } $km_cert = New-SelfSignedCertificate @cert_params
创建UEFI Plaform Key证书localhost-pk
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
$cert_params = @{ Type = 'Custom' Subject = 'CN=Localhost UEFI Platform Key Certificate' FriendlyName = 'Localhost UEFI Platform Key Certificate' TextExtension = '2.5.29.19={text}CA=0' Signer = $root_cert HashAlgorithm = 'sha256' KeyLength = 2048 KeyAlgorithm = 'RSA' KeyUsage = 'DigitalSignature' KeyExportPolicy = 'Exportable' NotAfter = (Get-Date).AddYears(10) CertStoreLocation = 'Cert:\LocalMachine\My' } $pk_cert = New-SelfSignedCertificate @cert_params
在
certlm.msc
的个人\证书
中导出生成的三份证书设置UEFI KEY 在VMware的vmx文件中加入,删除nvram文件
1 2
uefi.allowAuthBypass = "TRUE" uefi.secureBoot.PKDefault.file0 = "localhost-pk.der"
创建内核代码证书规则 在Windows企业版中运行以下命令得到
SiPolicy.bin
1 2 3
New-CIPolicy -FilePath SiPolicy.xml -Level RootCertificate -ScanPath C:\windows\System32\ Add-SignerRule -FilePath .\SiPolicy.xml -CertificatePath .\localhost-km.der -Kernel ConvertFrom-CIPolicy -XmlFilePath .\SiPolicy.xml -BinaryFilePath .\SiPolicy.bin
签名并导入规则
1 2 3 4
signtool sign /fd sha256 /p7co 1.3.6.1.4.1.311.79.1 /p7 . /f .\localhost-pk.pfx /p <localhost-pk.pfx的密码> SiPolicy.bin mv .\SiPolicy.bin.p7 .\SiPolicy.p7b mountvol x: /s cp .\SiPolicy.p7b X:\EFI\Microsoft\Boot\
CustomKernelSigners持久化
- 签名
ssde.sys
1
signtool sign /fd sha256 /a /ac .\localhost-root-ca.der /f .\localhost-km.pfx /p <localhost-km.pfx的密码> ssde.sys
把
ssde.sys
放入%windir%\system32\drivers\
中使用
ssde_enable.exe
或者进行如下步骤制作一个Windows安装U盘
从安装Windows界面进入,选择命令提示符,输入
regedit
点击
HKEY_LOCAL_MACHINE
点击
加载配置单元
,选择Windows\System32\config\SYSTEM
设置
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\CI\Protected\Licensed
为1正常启动电脑
进入系统后立刻用
cmd
打开ssde_query.exe
结果是1则运行以下命令,否则回到2
1
sc create ssde binpath=%windir%\system32\drivers\ssde.sys type=kernel start=boot error=normal
- 签名
检查结果
cmd
运行sc query ssde
,检查是否运行既可