Class: CryptoGost3410::Group
- Inherits:
-
Object
- Object
- CryptoGost3410::Group
- Defined in:
- lib/crypto_gost3410/group.rb,
lib/crypto_gost3410/group/gost256tc26a.rb,
lib/crypto_gost3410/group/gost256tc26b.rb,
lib/crypto_gost3410/group/gost256tc26c.rb,
lib/crypto_gost3410/group/gost256tc26d.rb,
lib/crypto_gost3410/group/gost512tc26a.rb,
lib/crypto_gost3410/group/gost512tc26b.rb,
lib/crypto_gost3410/group/gost512tc26c.rb,
lib/crypto_gost3410/group/gost256tc26test.rb,
lib/crypto_gost3410/group/gost512tc26test.rb
Overview
Group
Constant Summary collapse
- NAMES =
%w[ Gost256tc26test Gost256tc26a Gost256tc26b Gost256tc26c Gost256tc26d Gost512tc26test Gost512tc26a Gost512tc26b Gost512tc26c ].freeze
- Gost256tc26a =
new( name: 'gost256tc26a', id: 'id-tc26-gost-3410-2012-256-paramSetA', oid: '1.2.643.7.1.2.1.1.1', der_oid: "\x06\x09\x2a\x85\x03\x07\x01\x02\x01\x01\x01", coord_size: 32, p: 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD97, a: 0xC2173F1513981673AF4892C23035A27CE25E2013BF95AA33B22C656F277E7335, b: 0x295F9BAE7428ED9CCC20E7C359A9D41A22FCCD9108E17BF7BA9337A6F8AE9513, gx: 0x91E38443A5E82C0D880923425712B2BB658B9196932E02C78B2582FE742DAA28, gy: 0x32879423AB1A0375895786C4BB46E9565FDE0B5344766740AF268ADB32322E5C, n: 0x400000000000000000000000000000000FD8CDDFC87B6635C115AF556C360C67, h: 0x4 )
- Gost256tc26b =
new( name: 'gost256tc26b', id: 'id-tc26-gost-3410-2012-256-paramSetB', # former id-GostR3410-2001-CryptoPro-A-ParamSet oid: '1.2.643.7.1.2.1.1.2', # former 1.2.643.2.2.35.1 der_oid: "\x06\x09\x2a\x85\x03\x07\x01\x02\x01\x01\x02", cp_id: 'id-GostR3410-2001-CryptoPro-A-ParamSet', cp_oid: '1.2.643.2.2.35.1', cp_der_oid: "\x06\x07\x2a\x85\x03\x02\x02\x23\x01", coord_size: 32, p: 115792089237316195423570985008687907853269984665640564039457584007913129639319, a: 115792089237316195423570985008687907853269984665640564039457584007913129639316, b: 166, gx: 1, gy: 64033881142927202683649881450433473985931760268884941288852745803908878638612, n: 115792089237316195423570985008687907853073762908499243225378155805079068850323, h: 1 )
- Gost256tc26c =
new( name: 'gost256tc26c', id: 'id-tc26-gost-3410-2012-256-paramSetC', # former id-GostR3410-2001-CryptoPro-B-ParamSet oid: '1.2.643.7.1.2.1.1.3', # former 1.2.643.2.2.35.2 der_oid: "\x06\x09\x2a\x85\x03\x07\x01\x02\x01\x01\x03", cp_id: 'id-GostR3410-2001-CryptoPro-B-ParamSet', cp_oid: '1.2.643.2.2.35.2', cp_der_oid: "\x06\x07\x2a\x85\x03\x02\x02\x23\x02", coord_size: 32, p: 57896044618658097711785492504343953926634992332820282019728792003956564823193, a: 57896044618658097711785492504343953926634992332820282019728792003956564823190, b: 28091019353058090096996979000309560759124368558014865957655842872397301267595, gx: 1, gy: 28792665814854611296992347458380284135028636778229113005756334730996303888124, n: 57896044618658097711785492504343953927102133160255826820068844496087732066703, h: 1 )
- Gost256tc26d =
new( name: 'gost256tc26d', id: 'id-tc26-gost-3410-2012-256-paramSetD', # former id-GostR3410-2001-CryptoPro-C-ParamSet oid: '1.2.643.7.1.2.1.1.4', # former 1.2.643.2.2.35.3 der_oid: "\x06\x09\x2a\x85\x03\x07\x01\x02\x01\x01\x04", cp_id: 'id-GostR3410-2001-CryptoPro-C-ParamSet', cp_oid: '1.2.643.2.2.35.3', cp_der_oid: "\x06\x07\x2a\x85\x03\x02\x02\x23\x03", coord_size: 32, p: 70390085352083305199547718019018437841079516630045180471284346843705633502619, a: 70390085352083305199547718019018437841079516630045180471284346843705633502616, b: 32858, gx: 0, gy: 29818893917731240733471273240314769927240550812383695689146495261604565990247, n: 70390085352083305199547718019018437840920882647164081035322601458352298396601, h: 1 )
- Gost512tc26a =
new( name: 'gost512tc26a', id: 'id-tc26-gost-3410-2012-512-paramSetA', oid: '1.2.643.7.1.2.1.2.1', der_oid: "\x06\x09\x2a\x85\x03\x07\x01\x02\x01\x02\x01", coord_size: 64, p: 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFDC7, a: 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFDC4, b: 0xE8C2505DEDFC86DDC1BD0B2B6667F1DA34B82574761CB0E879BD081CFD0B6265EE3CB090F30D27614CB4574010DA90DD862EF9D4EBEE4761503190785A71C760, gx: 0x3, gy: 0x7503CFE87A836AE3A61B8816E25450E6CE5E1C93ACF1ABC1778064FDCBEFA921DF1626BE4FD036E93D75E6A50E3A41E98028FE5FC235F5B889A589CB5215F2A4, n: 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF27E69532F48D89116FF22B8D4E0560609B4B38ABFAD2B85DCACDB1411F10B275, h: 1 )
- Gost512tc26b =
new( name: 'gost512tc26b', id: 'id-tc26-gost-3410-2012-512-paramSetB', oid: '1.2.643.7.1.2.1.2.2', der_oid: "\x06\x09\x2a\x85\x03\x07\x01\x02\x01\x02\x02", coord_size: 64, p: 0x8000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006F, a: 0x8000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006C, b: 0x687D1B459DC841457E3E06CF6F5E2517B97C7D614AF138BCBF85DC806C4B289F3E965D2DB1416D217F8B276FAD1AB69C50F78BEE1FA3106EFB8CCBC7C5140116, gx: 0x2, gy: 0x1A8F7EDA389B094C2C071E3647A8940F3C123B697578C213BE6DD9E6C8EC7335DCB228FD1EDF4A39152CBCAAF8C0398828041055F94CEEEC7E21340780FE41BD, n: 0x800000000000000000000000000000000000000000000000000000000000000149A1EC142565A545ACFDB77BD9D40CFA8B996712101BEA0EC6346C54374F25BD, h: 1 )
- Gost512tc26c =
new( name: 'gost512tc26c', id: 'id-tc26-gost-3410-2012-512-paramSetC', oid: '1.2.643.7.1.2.1.2.3', der_oid: "\x06\x09\x2a\x85\x03\x07\x01\x02\x01\x02\x03", coord_size: 64, p: 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFDC7, a: 0xDC9203E514A721875485A529D2C722FB187BC8980EB866644DE41C68E143064546E861C0E2C9EDD92ADE71F46FCF50FF2AD97F951FDA9F2A2EB6546F39689BD3, b: 0xB4C4EE28CEBC6C2C8AC12952CF37F16AC7EFB6A9F69F4B57FFDA2E4F0DE5ADE038CBC2FFF719D2C18DE0284B8BFEF3B52B8CC7A5F5BF0A3C8D2319A5312557E1, gx: 0xE2E31EDFC23DE7BDEBE241CE593EF5DE2295B7A9CBAEF021D385F7074CEA043AA27272A7AE602BF2A7B9033DB9ED3610C6FB85487EAE97AAC5BC7928C1950148, gy: 0xF5CE40D95B5EB899ABBCCFF5911CB8577939804D6527378B8C108C3D2090FF9BE18E2D33E3021ED2EF32D85822423B6304F726AA854BAE07D0396E9A9ADDC40F, n: 0x3FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC98CDBA46506AB004C33A9FF5147502CC8EDA9E7A769A12694623CEF47F023ED, h: 0x4 )
- Gost256tc26test =
new( name: 'gost256tc26test', id: 'id-tc26-gost-3410-2012-256-paramSetTest', # former id-GostR3410-2001-TestParamSet oid: '1.2.643.7.1.2.1.1.0', # former 1.2.643.2.2.35.0 der_oid: "\x06\x09\x2a\x85\x03\x07\x01\x02\x01\x01\x00", cp_id: 'id-GostR3410-2001-TestParamSet', cp_oid: '1.2.643.2.2.35.0', cp_der_oid: "\x06\x07\x2a\x85\x03\x02\x02\x23\x00", coord_size: 32, p: 0x8000000000000000000000000000000000000000000000000000000000000431, a: 0x7, b: 0x5FBFF498AA938CE739B8E022FBAFEF40563F6E6A3472FC2A514C0CE9DAE23B7E, gx: 0x2, gy: 0x8E2A8A0E65147D4BD6316030E16D19C85C97F0A9CA267122B96ABBCEA7E8FC8, n: 0x8000000000000000000000000000000150FE8A1892976154C59CFC193ACCF5B3, h: 1 )
- Gost512tc26test =
new( name: 'gost512tc26test', id: 'id-tc26-gost-3410-2012-512-paramSetTest', oid: '1.2.643.7.1.2.1.2.0', der_oid: "\x06\x09\x2a\x85\x03\x07\x01\x02\x01\x02\x00", coord_size: 64, p: 0x4531ACD1FE0023C7550D267B6B2FEE80922B14B2FFB90F04D4EB7C09B5D2D15DF1D852741AF4704A0458047E80E4546D35B8336FAC224DD81664BBF528BE6373, a: 0x7, b: 0x1CFF0806A31116DA29D8CFA54E57EB748BC5F377E49400FDD788B649ECA1AC4361834013B2AD7322480A89CA58E0CF74BC9E540C2ADD6897FAD0A3084F302ADC, gx: 0x24D19CC64572EE30F396BF6EBBFD7A6C5213B3B3D7057CC825F91093A68CD762FD60611262CD838DC6B60AA7EEE804E28BC849977FAC33B4B530F1B120248A9A, gy: 0x2BB312A43BD2CE6E0D020613C857ACDDCFBF061E91E5F2C3F32447C259F39B2C83AB156D77F1496BF7EB3351E1EE4E43DC1A18B91B24640B6DBB92CB1ADD371E, n: 0x4531ACD1FE0023C7550D267B6B2FEE80922B14B2FFB90F04D4EB7C09B5D2D15DA82F2D7ECB1DBAC719905C5EECC423F1D86E25EDBE23C595D644AAF187E6E6DF, h: 1 )
Instance Attribute Summary collapse
-
#a ⇒ Object
readonly
Returns the value of attribute a.
-
#b ⇒ Object
readonly
Returns the value of attribute b.
-
#generator ⇒ Object
readonly
Returns the value of attribute generator.
-
#gx ⇒ Object
readonly
Returns the value of attribute gx.
-
#gy ⇒ Object
readonly
Returns the value of attribute gy.
-
#opts ⇒ Object
readonly
Returns the value of attribute opts.
-
#order ⇒ Object
readonly
Returns the value of attribute order.
-
#p ⇒ Object
readonly
Returns the value of attribute p.
Class Method Summary collapse
- .findByDerOid(der_oid) ⇒ Object
- .findById(id) ⇒ Object
- .findByName(name) ⇒ Object
- .findByOid(oid) ⇒ Object
Instance Method Summary collapse
- #generate_public_key(private_key) ⇒ Object
-
#initialize(opts) ⇒ Group
constructor
A new instance of Group.
Constructor Details
#initialize(opts) ⇒ Group
Returns a new instance of Group.
8 9 10 11 12 13 14 15 16 17 18 19 |
# 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 |
Instance Attribute Details
#a ⇒ Object (readonly)
Returns the value of attribute a.
6 7 8 |
# File 'lib/crypto_gost3410/group.rb', line 6 def a @a end |
#b ⇒ Object (readonly)
Returns the value of attribute b.
6 7 8 |
# File 'lib/crypto_gost3410/group.rb', line 6 def b @b end |
#generator ⇒ Object (readonly)
Returns the value of attribute generator.
6 7 8 |
# File 'lib/crypto_gost3410/group.rb', line 6 def generator @generator end |
#gx ⇒ Object (readonly)
Returns the value of attribute gx.
6 7 8 |
# File 'lib/crypto_gost3410/group.rb', line 6 def gx @gx end |
#gy ⇒ Object (readonly)
Returns the value of attribute gy.
6 7 8 |
# File 'lib/crypto_gost3410/group.rb', line 6 def gy @gy end |
#opts ⇒ Object (readonly)
Returns the value of attribute opts.
6 7 8 |
# File 'lib/crypto_gost3410/group.rb', line 6 def opts @opts end |
#order ⇒ Object (readonly)
Returns the value of attribute order.
6 7 8 |
# File 'lib/crypto_gost3410/group.rb', line 6 def order @order end |
#p ⇒ Object (readonly)
Returns the value of attribute p.
6 7 8 |
# File 'lib/crypto_gost3410/group.rb', line 6 def p @p end |
Class Method Details
.findByDerOid(der_oid) ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# 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) ⇒ Object
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# 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) ⇒ Object
85 86 87 88 89 90 91 92 93 94 95 |
# 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) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# 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 |
Instance Method Details
#generate_public_key(private_key) ⇒ Object
97 98 99 |
# File 'lib/crypto_gost3410/group.rb', line 97 def generate_public_key(private_key) generator * private_key end |