Sha256: 704b9565b3d2c64db8ba12e2a8c0992ce384f61574b037fd78c481945df148c5
Contents?: true
Size: 1.09 KB
Versions: 10
Compression:
Stored size: 1.09 KB
Contents
class ::ECDSA::Signature # convert signature to der string. def to_der ECDSA::Format::SignatureDerString.encode(self) end end class ::ECDSA::Point def to_hex(compression = true) ECDSA::Format::PointOctetString.encode(self, compression: compression).bth end end module ::ECDSA::Format::PointOctetString def self.decode(string, group, allow_hybrid: false) string = string.dup.force_encoding('BINARY') raise ECDSA::Format::DecodeError, 'Point octet string is empty.' if string.empty? case string[0].ord when 0 check_length string, 1 return group.infinity when 2 decode_compressed string, group, 0 when 3 decode_compressed string, group, 1 when 4 decode_uncompressed string, group when 6..7 unless allow_hybrid raise ECDSA::Format::DecodeError, 'Unrecognized start byte for point octet string: 0x%x' % string[0].ord end decode_uncompressed string, group if allow_hybrid else raise ECDSA::Format::DecodeError, 'Unrecognized start byte for point octet string: 0x%x' % string[0].ord end end end
Version data entries
10 entries across 10 versions & 1 rubygems