lib/ccrypto/ruby/keybundle_store/pkcs12.rb in ccrypto-ruby-0.1.0 vs lib/ccrypto/ruby/keybundle_store/pkcs12.rb in ccrypto-ruby-0.1.1
- old
+ new
@@ -9,26 +9,27 @@
include DataConversion
class PKCS12StoreException < KeyBundleStorageException; end
module ClassMethods
+
def from_pkcs12(input, &block)
raise PKCS12StoreException, "Input cannot be empty" if is_empty?(input)
raise PKCS12StoreException, "Block is required" if not block
inForm = block.call(:in_format)
case inForm
when :b64
- inp = from_b64(bin)
+ inp = from_b64(input)
when :hex
- inp = from_hex(bin)
+ inp = from_hex(input)
else
inp = input
end
- pass = block.call(:p12_pass)
+ pass = block.call(:store_pass)
raise PKCS12StoreException, "Password cannot be empty" if is_empty?(pass)
begin
p12 = OpenSSL::PKCS12.new(inp, pass)
case p12.key
@@ -78,13 +79,13 @@
else
c
end
end
- pass = block.call(:p12_pass)
+ pass = block.call(:store_pass)
raise PKCS12StoreException, "Password is required" if is_empty?(pass)
- name = block.call(:p12_name)
+ name = block.call(:key_name)
name = "Ccrypto KeyBundle" if is_empty?(name)
keypair = block.call(:keypair)
raise PKCS12StoreException, "Keypair is required" if is_empty?(keypair)