问题描述
我能够存储.pem文件,但不能存储.p12文件.当我运行命令
I am able to store a .pem file but not a .p12 file. When I run the command
heroku config:set P12_CERTIFICATE="$(cat /Users/Brian/certs/pass.com.gym.p12)"
我收到错误
invalid byte sequence in UTF-8
/Users/Brian/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/optparse.rb:1355:in `==='
/Users/Brian/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/optparse.rb:1355:in `block in parse_in_order'
/Users/Brian/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/optparse.rb:1351:in `catch'
/Users/Brian/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/optparse.rb:1351:in `parse_in_order'
/Users/Brian/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/optparse.rb:1345:in `order!'
/Users/Brian/.heroku/client/lib/heroku/command.rb:168:in `prepare_run'
/Users/Brian/.heroku/client/lib/heroku/command.rb:222:in `run'
/Users/Brian/.heroku/client/lib/heroku/cli.rb:45:in `start'
/usr/local/Cellar/heroku-toolbelt/3.0.1/libexec/bin/heroku:24:in `<main>'
根据几年前的接受的答案,过去可能用于p12文件.我真的需要能够将p12文件存储在config var中,以便动态签署通行证.感谢您的帮助.
According to this accepted answer from a couple of years ago, this used to be possible for p12 files. I really need to be able to store the p12 file in a config var in order to sign passes dynamically. Any help is appreciated.
推荐答案
.p12(PKCS#12)使用二进制文件格式,因此您将不能将其包含为Heroku配置变量.
.p12 (PKCS#12) uses a binary file format so you won't be able to include that as a Heroku configuration variable.
一个选项是将p12转换为密钥和证书的独立PEM文件,如
One option is to convert the p12 to separate PEM files for the key and the cert as detailed in this answer
然后可以将密钥文件和证书的内容添加为heroku配置变量.您可以改用这些文件签名文档,甚至可以使用OpenSSL即时创建(我认为)PKCS12文件:
You could then add the contents of the key file and the cert as heroku config variables. You could sign documents using those instead or even create (I think) a PKCS12 file on the fly with OpenSSL:
p12 = OpenSSL::PKCS12.create('pass', 'descriptor',
OpenSSL::PKey.read(ENV['PRIVATE_KEY']),
OpenSSL::X509::Certificate.new(ENV['CERT']))
p12_binary = p12.to_der
这篇关于在Heroku配置变量中存储.p12文件时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!