MacOSX密钥链的PythonAPI,端口为https://github.com/jprichardson/keychain manager
keychain_manager的Python项目详细描述
MacOSX密钥链的PythonAPI。 它是https://github.com/jprichardson/keychain_manager
的端口- 免费软件:BSD许可证
开始
要安装软件包,请执行以下操作:
pip install keychain-manager
用法
生成apple push证书的示例
fromkeychain_managerimportKeychainManagerimportos.pathUSER='youremail@example.com'# let's choose a keychain name, so we won't pollute the 'login' keychainKEYCHAIN='apple_push_keychain'# this is where the file aps_production_identity.cer will be downloadedYOUR_DOWNLOADS_DIR=os.path.expanduser('~/Downloads/')RSA_FILE='/tmp/myrsa.key'KeychainManager.generate_rsa_key(RSA_FILE)CERT_FILE='/tmp/CertificateSigningRequest.certSigningRequest'# 'US' is the country abbreviation.KeychainManager.generate_cert_request(USER,'US',RSA_FILE,CERT_FILE)kcm=KeychainManager(KEYCHAIN)ifkcm.exists():kcm.delete()kcm.create()kcm.import_rsa_key(RSA_FILE)# now from your browser, you'll have downloaded a file from Apple# typically named: aps_production.cerkcm.import_apple_cert(os.path.join(YOUR_DOWNLOADS_DIR,'aps_production.cer'))P12_FILE='/tmp/push_prod.p12'kcm.export_identities(P12_FILE)PEM_FILE='/tmp/push_prod.pem'KeychainManager.convert_p12_to_pem(P12_FILE,PEM_FILE)kcm.delete()
测试
测试只在MacOSX上运行,因为我们需要实际的密钥链 经理。只需在Mac计算机上克隆repo并运行:
python setup.py test
历史记录
0.1.0(2013-09-11)
- pypi上的第一个版本。