Class: JWK::OctKey
Instance Method Summary
collapse
Methods inherited from Key
from_json, from_openssl, from_pem, #to_json, validate_kty!, #x5t_s256
Constructor Details
#initialize(key) ⇒ OctKey
5
6
7
8
|
# File 'lib/jwk/oct_key.rb', line 5
def initialize(key)
@key = key
validate
end
|
Instance Method Details
#k ⇒ Object
34
35
36
|
# File 'lib/jwk/oct_key.rb', line 34
def k
Utils.decode_ub64(@key['k'])
end
|
#private? ⇒ Boolean
14
15
16
|
# File 'lib/jwk/oct_key.rb', line 14
def private?
true
end
|
#public? ⇒ Boolean
10
11
12
|
# File 'lib/jwk/oct_key.rb', line 10
def public?
true
end
|
#to_openssl_key ⇒ Object
26
27
28
|
# File 'lib/jwk/oct_key.rb', line 26
def to_openssl_key
raise NotImplementedError, 'Oct Keys cannot be converted to OpenSSL::PKey.'
end
|
#to_pem ⇒ Object
22
23
24
|
# File 'lib/jwk/oct_key.rb', line 22
def to_pem
raise NotImplementedError, 'Oct Keys cannot be converted to PEM.'
end
|
#to_s ⇒ Object
30
31
32
|
# File 'lib/jwk/oct_key.rb', line 30
def to_s
k
end
|
#validate ⇒ Object
18
19
20
|
# File 'lib/jwk/oct_key.rb', line 18
def validate
raise JWK::InvalidKey, 'Invalid RSA key.' unless @key['k']
end
|