Class: Saml::Kit::Certificate
- Inherits:
-
Object
- Object
- Saml::Kit::Certificate
- Defined in:
- lib/saml/kit/certificate.rb
Constant Summary collapse
- BEGIN_CERT =
/-----BEGIN CERTIFICATE-----/- END_CERT =
/-----END CERTIFICATE-----/
Instance Attribute Summary collapse
-
#use ⇒ Object
readonly
Returns the value of attribute use.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
- #encryption? ⇒ Boolean
- #eql?(other) ⇒ Boolean
- #fingerprint ⇒ Object
- #for?(use) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(value, use:) ⇒ Certificate
constructor
A new instance of Certificate.
- #inspect ⇒ Object
- #public_key ⇒ Object
- #signing? ⇒ Boolean
- #stripped ⇒ Object
- #to_h ⇒ Object
- #to_s ⇒ Object
- #x509 ⇒ Object
Constructor Details
#initialize(value, use:) ⇒ Certificate
Returns a new instance of Certificate.
8 9 10 11 |
# File 'lib/saml/kit/certificate.rb', line 8 def initialize(value, use:) @value = value @use = use.downcase.to_sym end |
Instance Attribute Details
#use ⇒ Object (readonly)
Returns the value of attribute use.
6 7 8 |
# File 'lib/saml/kit/certificate.rb', line 6 def use @use end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
6 7 8 |
# File 'lib/saml/kit/certificate.rb', line 6 def value @value end |
Class Method Details
Instance Method Details
#==(other) ⇒ Object
37 38 39 |
# File 'lib/saml/kit/certificate.rb', line 37 def ==(other) self.to_s == other.to_s end |
#encryption? ⇒ Boolean
21 22 23 |
# File 'lib/saml/kit/certificate.rb', line 21 def encryption? for?(:encryption) end |
#eql?(other) ⇒ Boolean
41 42 43 |
# File 'lib/saml/kit/certificate.rb', line 41 def eql?(other) self == other end |
#fingerprint ⇒ Object
13 14 15 |
# File 'lib/saml/kit/certificate.rb', line 13 def fingerprint Fingerprint.new(value) end |
#for?(use) ⇒ Boolean
17 18 19 |
# File 'lib/saml/kit/certificate.rb', line 17 def for?(use) self.use == use.to_sym end |
#hash ⇒ Object
45 46 47 |
# File 'lib/saml/kit/certificate.rb', line 45 def hash value.hash end |
#inspect ⇒ Object
57 58 59 |
# File 'lib/saml/kit/certificate.rb', line 57 def inspect to_h.inspect end |
#public_key ⇒ Object
33 34 35 |
# File 'lib/saml/kit/certificate.rb', line 33 def public_key x509.public_key end |
#signing? ⇒ Boolean
25 26 27 |
# File 'lib/saml/kit/certificate.rb', line 25 def signing? for?(:signing) end |
#stripped ⇒ Object
61 62 63 |
# File 'lib/saml/kit/certificate.rb', line 61 def stripped value.to_s.gsub(BEGIN_CERT, '').gsub(END_CERT, '').gsub(/\n/, '') end |
#to_h ⇒ Object
53 54 55 |
# File 'lib/saml/kit/certificate.rb', line 53 def to_h { use: @use, x509: @value } end |
#to_s ⇒ Object
49 50 51 |
# File 'lib/saml/kit/certificate.rb', line 49 def to_s value end |
#x509 ⇒ Object
29 30 31 |
# File 'lib/saml/kit/certificate.rb', line 29 def x509 self.class.to_x509(value) end |