Yodlee API PKI,尝试使用 rails/ruby 加密数据 rsa/ecb/pkcs1padding

Yodlee API PKI, trying to encrypt data rsa/ecb/pkcs1padding using rails/ruby

我正在使用 yodlee api 创建一个应用程序,到目前为止一切正常,但现在,我遇到了与 yodlee 的 PKI 功能相关的块。我无法按照他们的要求使用 "RSA/ECB/PKCS1Padding" 加密数据,到目前为止我发现的只是 java 示例,任何有代码片段的人,或在 [=18 上实现此目的的参考=]?

我猜你指的是这个 manual to integrate Yodlee API with PKI feature

查看 ruby 的 OpenSSL classes. Encryption using RSA is possible with the OpenSSL::PKey::RSA class, see also this intro doc. Basically you have to load the public key returned from the API, and use the public_encrypt method to encrypt the data and hex-encode it in the end. The encryption uses 默认情况下 PKCS1_PADDING,这正是您想要的。

this SO answer 中提供了完整示例。