Module: JOSE::JWA::Curve448

Extended by:
Curve448
Included in:
Curve448
Defined in:
lib/jose/jwa/curve448.rb

Constant Summary collapse

MUTEX =
Mutex.new

Instance Method Summary collapse

Instance Method Details

#__config_change__(lock = true) ⇒ Object


30
31
32
33
34
35
# File 'lib/jose/jwa/curve448.rb', line 30

def __config_change__(lock = true)
  MUTEX.lock if lock
  @__implementation__ ||= nil
  @__implementation__ = __pick_best_implementation__ if @__implementation__.nil? or @__implementation__.__ruby__? or not @__implementation__.__supported__?
  MUTEX.unlock if lock
end

#__implementation__Object


10
11
12
# File 'lib/jose/jwa/curve448.rb', line 10

def __implementation__
  return MUTEX.synchronize { @__implementation__ ||= __pick_best_implementation__ }
end

#__implementation__=(implementation) ⇒ Object


14
15
16
# File 'lib/jose/jwa/curve448.rb', line 14

def __implementation__=(implementation)
  return MUTEX.synchronize { @__implementation__ = implementation }
end

#__register__(implementation, ruby = false) ⇒ Object


18
19
20
21
22
23
24
25
26
27
28
# File 'lib/jose/jwa/curve448.rb', line 18

def __register__(implementation, ruby = false)
  MUTEX.synchronize {
    if ruby
      @__ruby_implementations__.unshift(implementation)
    else
      @__implementations__.unshift(implementation)
    end
    __config_change__(false)
    implementation
  }
end

#ed448_keypair(secret = nil) ⇒ Object


37
38
39
# File 'lib/jose/jwa/curve448.rb', line 37

def ed448_keypair(secret = nil)
  return (@__implementation__ || __implementation__).ed448_keypair(secret)
end

#ed448_secret_to_public(sk) ⇒ Object


41
42
43
# File 'lib/jose/jwa/curve448.rb', line 41

def ed448_secret_to_public(sk)
  return (@__implementation__ || __implementation__).ed448_secret_to_public(sk)
end

#ed448_sign(m, sk) ⇒ Object


45
46
47
# File 'lib/jose/jwa/curve448.rb', line 45

def ed448_sign(m, sk)
  return (@__implementation__ || __implementation__).ed448_sign(m, sk)
end

#ed448_verify(sig, m, pk) ⇒ Object


49
50
51
# File 'lib/jose/jwa/curve448.rb', line 49

def ed448_verify(sig, m, pk)
  return (@__implementation__ || __implementation__).ed448_verify(sig, m, pk)
end

#ed448ph_keypair(secret = nil) ⇒ Object


53
54
55
# File 'lib/jose/jwa/curve448.rb', line 53

def ed448ph_keypair(secret = nil)
  return (@__implementation__ || __implementation__).ed448ph_keypair(secret)
end

#ed448ph_secret_to_public(sk) ⇒ Object


57
58
59
# File 'lib/jose/jwa/curve448.rb', line 57

def ed448ph_secret_to_public(sk)
  return (@__implementation__ || __implementation__).ed448ph_secret_to_public(sk)
end

#ed448ph_sign(m, sk) ⇒ Object


61
62
63
# File 'lib/jose/jwa/curve448.rb', line 61

def ed448ph_sign(m, sk)
  return (@__implementation__ || __implementation__).ed448ph_sign(m, sk)
end

#ed448ph_verify(sig, m, pk) ⇒ Object


65
66
67
# File 'lib/jose/jwa/curve448.rb', line 65

def ed448ph_verify(sig, m, pk)
  return (@__implementation__ || __implementation__).ed448ph_verify(sig, m, pk)
end

#x448_keypair(secret = nil) ⇒ Object


69
70
71
# File 'lib/jose/jwa/curve448.rb', line 69

def x448_keypair(secret = nil)
  return (@__implementation__ || __implementation__).x448_keypair(secret)
end

#x448_secret_to_public(sk) ⇒ Object


73
74
75
# File 'lib/jose/jwa/curve448.rb', line 73

def x448_secret_to_public(sk)
  return (@__implementation__ || __implementation__).x448_secret_to_public(sk)
end

#x448_shared_secret(pk, sk) ⇒ Object


77
78
79
# File 'lib/jose/jwa/curve448.rb', line 77

def x448_shared_secret(pk, sk)
  return (@__implementation__ || __implementation__).x448_shared_secret(pk, sk)
end