class CryptoGost3410::Group

Group

@author vblazhnovgit

Constants

Gost256tc26a
Gost256tc26b
Gost256tc26c
Gost256tc26d
Gost256tc26test
Gost512tc26a
Gost512tc26b
Gost512tc26c
Gost512tc26test
NAMES

Attributes

a[R]
b[R]
generator[R]
gx[R]
gy[R]
opts[R]
order[R]
p[R]

Public Class Methods

findByDerOid(der_oid) click to toggle source
# File lib/crypto_gost3410/group.rb, line 53
def self.findByDerOid(der_oid)
  group = nil
  NAMES.each do |n|
    g = Object.const_get("CryptoGost3410::Group::#{n}")
    if g.opts[:der_oid] == der_oid then
      group = g
      break
    end
    if (g.opts[:cp_der_oid] != nil) && (g.opts[:cp_der_oid] == der_oid) then
      group = g
      break
    end
  end
  group
end
findById(id) click to toggle source
# File lib/crypto_gost3410/group.rb, line 69
def self.findById(id)
  group = nil
  NAMES.each do |n|
    g = Object.const_get("CryptoGost3410::Group::#{n}")
    if g.opts[:id] == id then
      group = g
      break
    end
    if (g.opts[:cp_id] != nil) && (g.opts[:cp_id] == id) then
      group = g
      break
    end
  end
  group
end
findByName(name) click to toggle source
# File lib/crypto_gost3410/group.rb, line 85
def self.findByName(name)
  group = nil
  NAMES.each do |n|
    g = Object.const_get("CryptoGost3410::Group::#{n}")
    if g.opts[:name] == name then
      group = g
      break
    end
  end
  group
end
findByOid(oid) click to toggle source
# File lib/crypto_gost3410/group.rb, line 37
def self.findByOid(oid)
  group = nil
  NAMES.each do |n|
    g = Object.const_get("CryptoGost3410::Group::#{n}")
    if g.opts[:oid] == oid then
      group = g
      break
    end
    if (g.opts[:cp_oid] != nil) && (g.opts[:cp_oid] == oid) then
      group = g
      break
    end
  end
  group
end
new(opts) click to toggle source
# File lib/crypto_gost3410/group.rb, line 8
def initialize(opts)
  @opts = opts
  @name = opts.fetch(:name)
  @p = opts[:p]
  @a = opts[:a]
  @b = opts[:b]
  @gx = opts[:gx]
  @gy = opts[:gy]
  @order = opts[:n]
  @cofactor = opts[:h]
  @generator = CryptoGost3410::Point.new self, [gx, gy]
end

Public Instance Methods

generate_public_key(private_key) click to toggle source
# File lib/crypto_gost3410/group.rb, line 97
def generate_public_key(private_key)
  generator * private_key
end