18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/pkernel_jce/provider.rb', line 18
def Provider::add_provider(prov)
if prov != nil
if prov.is_a?(String) and not prov.empty?
case prov
when BCProvider.name
provInst = BCProvider
if not java.security.Security.get_providers.to_a.include?(provInst)
PkernelJce::GConf.instance.glog.debug "Adding security provider '#{provInst.name}'"
java.security.Security.add_provider(provInst)
end
prov
else
PkernelJce::GConf.instance.glog.error "Unknown provider by string '#{prov}'. Please use provider object."
raise Exception, "Unknown provider by string '#{prov}'. Please use provider object."
end
elsif prov.is_a?(java.security.Provider)
if prov != nil
if not java.security.Security.get_providers.to_a.include?(prov)
PkernelJce::GConf.instance.glog.debug "Adding security provider '#{prov.name}'"
java.security.Security.add_provider(prov)
end
prov
else
raise Exception, "Unknown provider object #{prov.inspect}"
end
end
end
end
|