草庐IT

openssl_public_encrypt

全部标签

ruby - RVM 和 OpenSSL 的问题

正在尝试为同事设置新的macbook。进展不顺利。首先我安装OpenSSL:Heathers-MacBook-Pro:~heather$rvmpkginstallopensslFetchingopenssl-1.0.1c.tar.gzto/Users/heather/.rvm/archives########################################################################100.0%Extractingopensslto/Users/heather/.rvm/src/openssl-1.0.1cConfiguringope

ruby-on-rails - "Certificate verify failed"使用 Ruby 1.9.3 时出现 OpenSSL 错误

我在MacOS10.6.8(使用rvm安装)上使用Ruby1.9.3p0。当我尝试使用applicationtemplatehostedonGitHub创建一个新的Rails应用程序时,用这个(例如):$railsnewmyapp-mhttps://github.com/RailsApps/rails3-application-templates/raw/master/rails3-mongoid-devise-template.rb-T-O我收到此错误消息:/Users/me/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/net/http.rb:7

ruby - Ruby 的 send 和 public_send 方法有什么区别?

我很好奇send和public_send有什么区别。例如:classKlassdefhello(*args)"Hello"+args.join('')endendk=Klass.newk.send:hello,"gentle","readers"#=>"Hellogentlereaders"k.public_send:hello,"gentle","readers"#=>"Hellogentlereaders" 最佳答案 Unlikesend,public_sendcallspublicmethodsonly.Source例子:cl

ruby - 如何在carrierwave中将文件存储在公共(public)文件夹之外?

默认情况下,Carrierwave接收由store_dir在uploader中生成的url,并将路径添加到Rails应用程序的公共(public)文件夹并存储文件。例如如果defstore_dir"uploads/#{model.id}"end然后文件存储在public/uploads/:attachment_id如果尝试将存储的文件移出公用文件夹,它仍会保存在公用文件夹中。有谁知道如何将文件存储在公用文件夹之外?? 最佳答案 最简洁的方法是设置CarrierWave根选项CarrierWave.configuredo|config

ruby - OpenSSL、RVM、Brew、冲突错误

当我在终端中运行brewdoctor时:我收到以下错误:Warning:Somekeg-onlyformulaarelinkedintotheCellar.Youmaywishto`brewunlink`thesebrews:openssl如果我取消链接,然后输入rvmrequirements:我将收到以下错误。Checkingrequirementsforosx.dyld:Librarynotloaded:@@HOMEBREW_CELLAR@@/openssl/1.0.1f/lib/libssl.1.0.0.dylibReferencedfrom:/usr/local/opt/ope

ruby - 我如何确保 Ruby 使用不易受到 Heartbleed 攻击的 OpenSSL?

继Heartbleed错误之后,thispostonruby-lang.org描述了如何检查漏洞和升级。它包括这个建议:要验证您链接到Ruby的OpenSSL库版本,请使用以下命令:ruby-v-ropenssl-rfiddle-e'putsFiddle::Function.new(Fiddle.dlopen(nil)["SSLeay_version"],[Fiddle::TYPE_INT],Fiddle::TYPE_VOIDP).call(0)'要验证当前随Ruby安装的OpenSSL版本,请使用以下命令:ruby-ropenssl-e'putsOpenSSL::OPENSSL_VE

ruby - 在 Ruby 上获取 OpenSSL::X509::CertificateError 嵌套 asn1 错误

我有来自Apple的.p12文件,并尝试使用以下命令将其转换为.pem文件:opensslpkcs12-incert.p12-outapple_push_notification_development.pem-nodes-clcerts尝试创建新的OpenSSL::X509::Certificate对象时OpenSSL::X509::Certificate.new(File.read('apple_push_notification_development.pem'))我收到以下错误:OpenSSL::X509::CertificateError:nestedasn1errorfro

ruby - 在没有 ssh-keygen 的情况下生成 SSH key 对(私有(private)/公共(public))

我正在开发需要生成SSHkey对的Ruby/Rack应用程序。尽管我很想从应用程序中调用ssh-keygen,但我不能,因为它是为在Heroku上运行而设计的,它们不支持调用该命令。我已经能够使用Ruby标准库中的OpenSSL获取私有(private)/公共(public)RSAkey,执行以下操作:key=OpenSSL::PKey::RSA.generate(2048)#=>-----BEGINRSAPRIVATEKEY-----....key.public_key#=>-----BEGINRSAPUBLICKEY-----....不幸的是,RSA公钥和SSH公钥不是一回事,即使

ruby-on-rails - 如何使用 OpenSSL::Cipher 加密 UTF-8 字符串中的数据?

在Rails3.0(Ruby1.9.2)应用程序中,我正在尝试使用如下方式加密一些数据:cipher=OpenSSL::Cipher.new'aes-256-cbc'cipher.encryptcipher.key=cipher.random_keycipher.iv=cipher.random_ivencrypted=cipher.update'mostsecretdataintheworld'encrypted这将进入UTF-8数据库。我的问题是>encrypted.encoding=>#>encrypted.encode'utf-8'Encoding::UndefinedConv

ruby-on-rails - 什么应该从 Ruby on Rails 的公共(public)源代码控制中删除?

我一直在网上搜索,但找不到关于从新的公共(public)Rails应用程序中排除什么的任何好的/最近的例子。我希望在GitHub上开源我的应用程序,并且想知道应从源代码管理中删除哪些类型的数据。据我所知,应该有一个包含私有(private)信息的config/config.yml文件。我一直在查看其他文件,它看起来像config/database.yml、config/intializers/secret_token.rb和config/initializers/session_store.rb也应该被排除在外?最好的做法是分别排除所有这些文件吗?或者有没有办法在config/conf