python从keystore文件导出证书公钥与私钥代码
代码语言:python
所属分类:其他
代码描述:python从keystore文件导出证书公钥与私钥代码
代码标签: python keystore 文件 导出 证书 公钥 私钥 代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
#!/usr/local/python3/bin/python3 # -*- coding: utf-8 -* import subprocess import re keystore_file = "/path/to/keystore.keystore" keystore_password = "your_keystore_password" key_alias = "your_key_alias" key_password = "your_key_password" # 构建命令行命令 command = [ "keytool", "-exportcert", "-rfc", "-keystore", keystore_file, "-storepass", keystore_password, "-alias", key_alias, "-keypass", key_password ] # 构建命令行命令 command2 = [ "openssl", "pkcs12", "-in", keystore_file, "-nodes", "-password", "pass:" + keystore_password ] try: # 执行命令行命令并获取输出 output = subprocess.check_output(command, stderr=subprocess.STDOUT) output = output.decode("utf-8&q.........完整代码请登录后点击上方下载按钮下载查看
网友评论0