首页 > 编程 > BAT > 正文

使用 certutil 实现 Hex2Bin 和 Base64 加解密的方法

2020-06-09 14:01:29
字体:
来源:转载
供稿:网友

应用到: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1, Windows Server 2003 with SP2
Certutil

Certutil.exe 是作为 Windows Server 2003 家族中证书服务的一部分进行安装的命令行程序。
您还可以通过下载并安装 Windows Server 2003 管理工具包来获取 Certutil.exe (http://go.microsoft.com/fwlink/?LinkID=8136)(页面可能为英文)。
可使用 Certutil.exe 转储并显示证书颁发机构 (CA) 配置信息,配置“证书服务”,备份和恢复 CA 组件,还可验证证书、密钥对和证书链。

更详细的资料可以参考这篇文章:https://technet.microsoft.com/zh-cn/library/cc773087(WS.10).aspx


certutil 是 vista 和 win7 自带自带的外部命令,实际上是用于管理证书的,但也有“歪门邪道”的用法
举个例子:

@echo offecho 48 65 6C 6C 6F 2C 57 6F 72 6C 64 21 >hex.txt::生成 hex.txt,机器码对应的内容是 Hallo World!certutil -decodehex hex.txt bin.txt::Hex2Bincertutil -encode bin.txt Encode.txt::Base64_Encodecertutil -decode Encode.txt Decode.txt::Base64_Decodepause

系统帮助如下:
动词:
-dump -- 转储配置信息或文件
-asn -- 分析 ASN.1 文件

-decodehex -- 解码十六进制编码的文件
-decode -- 解码 Base64 编码的文件
-encode -- 将文件编码为 Base64

-deny -- 拒绝挂起的申请
-resubmit -- 重新提交挂起的申请
-setattributes -- 为挂起申请设置属性
-setextension -- 为挂起申请设置扩展
-revoke -- 吊销证书
-isvalid -- 显示当前证书部署

-getconfig -- 获取默认配置字符串
-ping -- Ping Active Directory 证书服务申请接口
-pingadmin -- Ping Active Directory 证书服务管理接口
-CAInfo -- 显示 CA 信息
-ca.cert -- 检索 CA 的证书
-ca.chain -- 检索 CA 的证书链
-GetCRL -- 获取 CRL
-CRL -- 发布新的 CRL [或仅增量 CRL]
-shutdown -- 关闭 Active Directory 证书服务

-installCert -- 安装证书颁发机构证书
-renewCert -- 续订证书颁发机构证书

-schema -- 转储证书架构
-view -- 转储证书视图
-db -- 转储原始数据库
-deleterow -- 删除服务器数据库行

-backup -- 备份 Active Directory 证书服务
-backupDB -- 备份 Active Directory 证书服务数据库
-backupKey -- 备份 Active Directory 证书服务证书和私钥
-restore -- 还原 Active Directory 证书服务
-restoreDB -- 还原 Active Directory 证书服务数据库
-restoreKey -- 还原 Active Directory 证书服务证书和私钥
-importPFX -- 导入证书和私钥
-dynamicfilelist -- 显示动态文件列表
-databaselocations -- 显示数据库位置
-hashfile -- 通过文件生成并显示加密哈希

-store -- 转储证书存储
-addstore -- 将证书添加到存储

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表