Class: Ccrypto::Java::RSAKeyBundle
- Inherits:
-
Object
- Object
- Ccrypto::Java::RSAKeyBundle
show all
- Includes:
- RSAKeyBundle, TR::CondUtils, TeLogger::TeLogHelper
- Defined in:
- lib/ccrypto/java/engines/rsa_engine.rb
Overview
Instance Method Summary
collapse
Constructor Details
Returns a new instance of RSAKeyBundle.
104
105
106
|
# File 'lib/ccrypto/java/engines/rsa_engine.rb', line 104
def initialize(kp)
@nativeKeypair = kp
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(mtd, *args, &block) ⇒ Object
159
160
161
162
|
# File 'lib/ccrypto/java/engines/rsa_engine.rb', line 159
def method_missing(mtd, *args, &block)
teLogger.debug "Sending to native #{mtd}"
@nativeKeypair.send(mtd, *args, &block)
end
|
Instance Method Details
#equal?(kp) ⇒ Boolean
150
151
152
153
154
155
156
157
|
# File 'lib/ccrypto/java/engines/rsa_engine.rb', line 150
def equal?(kp)
case kp
when Ccrypto::RSAKeyBundle
private_key.encoded == kp.private_key.encoded
else
false
end
end
|
#private_key ⇒ Object
115
116
117
118
119
120
|
# File 'lib/ccrypto/java/engines/rsa_engine.rb', line 115
def private_key
if @privKey.nil?
@privKey = RSAPrivateKey.new(@nativeKeypair.private)
end
@privKey
end
|
#public_key ⇒ Object
108
109
110
111
112
113
|
# File 'lib/ccrypto/java/engines/rsa_engine.rb', line 108
def public_key
if @pubKey.nil?
@pubKey = RSAPublicKey.new(@nativeKeypair.public)
end
@pubKey
end
|
#respond_to_missing?(mtd, incPriv = false) ⇒ Boolean
164
165
166
167
|
# File 'lib/ccrypto/java/engines/rsa_engine.rb', line 164
def respond_to_missing?(mtd, incPriv = false)
teLogger.debug "Respond to missing #{mtd}"
@nativeKeypair.respond_to?(mtd)
end
|
#write_keystore(type, &block) ⇒ Object
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
|
# File 'lib/ccrypto/java/engines/rsa_engine.rb', line 122
def write_keystore(type, &block)
ksType = Keystore.map_keystore_type(type)
case ksType
when :pkcs12
Keystore::PKCS12Keystore.to_p12 do |key, *val|
case key
when :keypair
@nativeKeypair
else
block.call(key) if block
end
end
when :jks
Keystore::JKSKeystore.to_jks do |key, *val|
case key
when :keypair
@nativeKeypair
else
block.call(key) if block
end
end
else
raise Ccrypto::Keystore::KeystoreException, "Unsupported keystore type '#{type}' for engine '#{self.class.name}'"
end
end
|