class RestPki::SignatureAlgorithm
Attributes
digest_algorithm[R]
name[R]
oid[R]
pk_algorithm[R]
xml_uri[R]
Public Class Methods
MD5_WITH_RSA()
click to toggle source
# File lib/rest_pki/pk_algorithms.rb, line 13 def self.MD5_WITH_RSA; RSASignatureAlgorithm.new(DigestAlgorithm.MD5) end
SHA1_WITH_RSA()
click to toggle source
# File lib/rest_pki/pk_algorithms.rb, line 14 def self.SHA1_WITH_RSA; RSASignatureAlgorithm.new(DigestAlgorithm.SHA1) end
SHA256_WITH_RSA()
click to toggle source
# File lib/rest_pki/pk_algorithms.rb, line 15 def self.SHA256_WITH_RSA; RSASignatureAlgorithm.new(DigestAlgorithm.SHA256) end
SHA384_WITH_RSA()
click to toggle source
# File lib/rest_pki/pk_algorithms.rb, line 16 def self.SHA384_WITH_RSA; RSASignatureAlgorithm.new(DigestAlgorithm.SHA384) end
SHA512_WITH_RSA()
click to toggle source
# File lib/rest_pki/pk_algorithms.rb, line 17 def self.SHA512_WITH_RSA; RSASignatureAlgorithm.new(DigestAlgorithm.SHA512) end
algorithms()
click to toggle source
# File lib/rest_pki/pk_algorithms.rb, line 19 def self.algorithms [ SignatureAlgorithm.MD5_WITH_RSA, SignatureAlgorithm.SHA1_WITH_RSA, SignatureAlgorithm.SHA256_WITH_RSA, SignatureAlgorithm.SHA384_WITH_RSA, SignatureAlgorithm.SHA512_WITH_RSA ] end
get_instance_by_api_model(model)
click to toggle source
# File lib/rest_pki/pk_algorithms.rb, line 64 def self.get_instance_by_api_model(model) algorithm = model['algorithm'] case algorithm when 'MD5WithRSA' return SignatureAlgorithm.MD5_WITH_RSA when 'SHA1WithRSA' return SignatureAlgorithm.SHA1_WITH_RSA when 'SHA256WithRSA' return SignatureAlgorithm.SHA256_WITH_RSA when 'SHA384WithRSA' return SignatureAlgorithm.SHA384_WITH_RSA when 'SHA512WithRSA' return SignatureAlgorithm.SHA512_WITH_RSA else raise "Unsupported signature algorithm: #{algorithm}" end end
get_instance_by_name(name)
click to toggle source
# File lib/rest_pki/pk_algorithms.rb, line 37 def self.get_instance_by_name(name) begin sig = SignatureAlgorithm._algorithms.find{ |s| s.name == name} rescue => exception raise "Unrecognized digest algorithm name: #{name}" end sig end
get_instance_by_oid(oid)
click to toggle source
# File lib/rest_pki/pk_algorithms.rb, line 46 def self.get_instance_by_oid(oid) begin sig = SignatureAlgorithm._algorithms.find{ |s| s.oid == oid} rescue => exception raise "Unrecognized digest algorithm oid: #{oid}" end sig end
get_instance_by_xml_uri(xml_uri)
click to toggle source
# File lib/rest_pki/pk_algorithms.rb, line 55 def self.get_instance_by_xml_uri(xml_uri) begin sig = SignatureAlgorithm._algorithms.find{ |s| s.xml_uri == xml_uri} rescue => exception raise "Unrecognized digest algorithm XML URI: #{xml_uri}" end sig end
new(name, oid, xml_uri, digest_algorithm, pk_algorithm)
click to toggle source
# File lib/rest_pki/pk_algorithms.rb, line 5 def initialize(name, oid, xml_uri, digest_algorithm, pk_algorithm) @name = name @oid = oid @xml_uri = xml_uri @digest_algorithm = digest_algorithm @pk_algorithm = pk_algorithm end
safe_algorithms()
click to toggle source
# File lib/rest_pki/pk_algorithms.rb, line 29 def self.safe_algorithms [ SignatureAlgorithm.SHA256_WITH_RSA, SignatureAlgorithm.SHA384_WITH_RSA, SignatureAlgorithm.SHA512_WITH_RSA ] end