码迷,mamicode.com
首页 > 其他好文 > 详细

PowerShe 使用证书签名 ll脚本

时间:2017-06-07 12:50:42      阅读:302      评论:0      收藏:0      [点我收藏+]

标签:dag   files   ida   bag   dex   aaaaa   自签名   pdm   microsoft   

1.创建自签名证书(如需要)

1  PS C:\Windows\system32> New-SelfSignedCertificate -DnsName www.mycard.com -CertStoreLocation Cert:\CurrentUser\My
2  
3     目录: Microsoft.PowerShell.Security\Certificate::CurrentUser\My
4  
5 Thumbprint                                Subject
6 ----------                                -------
7 313C6D95807E577BBD62D3F0A31077C911B72EB6  CN=www.mycard.com

2.获取证书

1  PS C:\Windows\system32> Get-PSDrive
2 Name           Used (GB)     Free (GB) Provider      Root
3 ----           ---------     --------- --------      ----
4 Alias                                  Alias
5 C                  44.32         16.86 FileSystem    C:6 Cert                                   Certificate   \
1  PS C:\Windows\system32> dir Cert:\CurrentUser\My -OutVariable x
2     目录: Microsoft.PowerShell.Security\Certificate::CurrentUser\My
3  
4 Thumbprint                                Subject
5 ----------                                -------
6 C744543541A7B9E5E0085F38351727765A716415  CN=domain\user
7 313C6D95807E577BBD62D3F0A31077C911B72EB6  CN=www.mycard.com
1  PS C:\Windows\system32> $x[0]
2     目录: Microsoft.PowerShell.Security\Certificate::CurrentUser\My
3  
4 Thumbprint                                Subject
5 ----------                                -------
6 C744543541A7B9E5E0085F38351727765A716415  CN=domain\user

3.脚本签名前后  

    a)签名前

 PS C:\Windows\system32> cat E:\1.ps1
Get-Variable

    b)签名

1  PS C:\Windows\system32> Set-AuthenticodeSignature -Certificate $x[0] -FilePath ‘E:\1.ps1‘
2     目录: E:3 SignerCertificate                                                 Status            Path
4 -----------------                                                   ------             ----
5 FBD0E44E1011C4C992CD5004D73137A3EC0E5AE4  Valid             1.ps1                  

    c)签名后

 1 PS C:\Windows\system32> cat E:\1.ps1
 2 Get-Variable
 3 # SIG # Begin signature block
 4 # MIIHfgYJKoZIhvcNAQcCoIIHbzCCB2sCAQExCzAJBgUrDgMCGgUAMGkGC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20WulypLqfzGCAW4wggFqAgEBME4wQDETMBEGCgmSJomT8ixkARkW
37 # A2NvbTEVMBMGCgmSJomT8ixkARkWBWNucGRjMRIwEAYDVQQDEwlDTlBEQ2NlcnQC
38 # ChNwdZ8AAAAAZkAwCQYFKw4DAhoFAKB4MBgGCisGAQQBgjcCAQwxCjAIoAKAAKEC
39 # gAAwGQYJKoZIhvcNAQkDMQwGCisGAQQBgjcCAQQwHAYKKwYBBAGCNwIBCzEOMAwG
40 # CisGAQQBgjcCARUwIwYJKoZIhvcNAQkEMRYEFHwOQIGZoxKLrIov7cZ1wBhrMA57
41 # MA0GCSqGSIb3DQEBAQUABIGAEmp+D25Uxjxuof3PzPuOagbWurKjYYnds8ThTCuj
42 # lswYU6DMnXyp37HLbl0tvNMYnXk71GUX/p4KC/EN9RDUWtipZUrCtydwlfPQPEAw
43 # KGaz0eKD0h2TAwLliTcHRM+WhjgSur2N5Or4z3EXCca8mJjesVZJj5eZfNPK97sX
44 # TeU=
45 # SIG # End signature block

 

PowerShe 使用证书签名 ll脚本

标签:dag   files   ida   bag   dex   aaaaa   自签名   pdm   microsoft   

原文地址:http://www.cnblogs.com/lixiaonuohao/p/6956136.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!