Skip to content
This repository was archived by the owner on Feb 28, 2024. It is now read-only.

Commit bf3c64a

Browse files
committed
Fixed OpenSSL::PKey::PKeyError and OpenSSL::PKCS12::PKCS12Error on Windows
1 parent a06cf10 commit bf3c64a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/mcapi/encryption/crypto/crypto.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ class Crypto
2020
def initialize(config)
2121
valid_config?(config)
2222
@encoding = config['dataEncoding']
23-
@cert = OpenSSL::X509::Certificate.new(File.read(config['encryptionCertificate']))
23+
@cert = OpenSSL::X509::Certificate.new(IO.binread(config['encryptionCertificate']))
2424
if config['privateKey']
25-
@private_key = OpenSSL::PKey.read(File.new(config['privateKey']))
25+
@private_key = OpenSSL::PKey.read(IO.binread(config['privateKey']))
2626
elsif config['keyStore']
27-
@private_key = OpenSSL::PKCS12.new(File.read(config['keyStore']), config['keyStorePassword']).key
27+
@private_key = OpenSSL::PKCS12.new(IO.binread(config['keyStore']), config['keyStorePassword']).key
2828
end
2929
@oaep_hashing_alg = config['oaepPaddingDigestAlgorithm']
3030
@encrypted_value_field_name = config['encryptedValueFieldName']

0 commit comments

Comments
 (0)