Class: NetPGP::PublicKeyAlgorithm

Inherits:
Object
  • Object
show all
Defined in:
lib/netpgp/highlevel/constants.rb

Constant Summary collapse

NONE =
0
RSA =
1
RSA_ENCRYPT_ONLY =
2
RSA_SIGN_ONLY =
3
ELGAMAL =
16
DSA =
17
ECDH =
18
ECDSA =
19
FORMERLY_ELGAMAL =
20

Class Method Summary collapse

Class Method Details

.from_native(alg) ⇒ Object



16
17
18
19
# File 'lib/netpgp/highlevel/constants.rb', line 16

def self.from_native(alg)
  raise if alg.class != Symbol
  LibNetPGP::PGP_PUBKEY_ALG_T[alg]
end

.to_native(alg) ⇒ Object



21
22
23
24
25
26
27
28
29
# File 'lib/netpgp/highlevel/constants.rb', line 21

def self.to_native(alg)
  # avoid a warning on newer versions of ruby
  if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.4.0')
    raise if alg.class != Integer
  else
    raise if alg.class != Fixnum
  end
  LibNetPGP::PGP_PUBKEY_ALG_T[alg]
end