5555 Abstract Syntax Notation 1 is a standard description language for
5656 specifying serialisation and deserialisation of data structures in a
5757 portable and cross-platform way.
58+
59+ bytes-like object
60+ All the types that implement the buffer protocol. That includes
61+ ``str`` (only on python2), ``bytes``, ``bytesarray``, ``array.array`
62+ and ``memoryview`` of those objects.
63+ Please note that ``array.array` serialisation (converting it to byte
64+ string) is endianess dependant! Signature computed over ``array.array``
65+ of integers on a big-endian system will not be verified on a
66+ little-endian system and vice-versa.
5867"""
5968
6069import binascii
7079from .util import string_to_number , number_to_string , randrange
7180from .util import sigencode_string , sigdecode_string
7281from .util import oid_ecPublicKey , encoded_oid_ecPublicKey , MalformedSignature
82+ from ._compat import normalise_bytes
7383
7484
7585__all__ = ["BadSignatureError" , "BadDigestError" , "VerifyingKey" , "SigningKey" ,
@@ -231,8 +241,8 @@ def from_string(cls, string, curve=NIST192p, hashfunc=sha1,
231241 Python 2 days when there were no binary strings. In Python 3 the
232242 input needs to be a bytes-like object.
233243
234- :param string: :term:`raw encoding` of the public key
235- :type string: bytes-like object
244+ :param string: single point encoding of the public key
245+ :type string: :term:` bytes-like object`
236246 :param curve: the curve on which the public key is expected to lie
237247 :type curve: ecdsa.curves.Curve
238248 :param hashfunc: The default hash function that will be used for
@@ -245,6 +255,7 @@ def from_string(cls, string, curve=NIST192p, hashfunc=sha1,
245255 :return: Initialised VerifyingKey object
246256 :rtype: VerifyingKey
247257 """
258+ string = normalise_bytes (string )
248259 sig_len = len (string )
249260 if sig_len == curve .verifying_key_length :
250261 point = cls ._from_raw_encoding (string , curve , validate_point )
0 commit comments