From ac431c59614f2b85484e5a296ae87e26f0d37e65 Mon Sep 17 00:00:00 2001 From: munagekar Date: Fri, 17 Jan 2020 15:36:05 +0900 Subject: [PATCH] Fix Return Type for to_pem: str->bytes --- src/ecdsa/keys.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/ecdsa/keys.py b/src/ecdsa/keys.py index 28277db4..a8cefb94 100644 --- a/src/ecdsa/keys.py +++ b/src/ecdsa/keys.py @@ -531,7 +531,10 @@ def to_pem(self, point_encoding="uncompressed"): implementations, it is as big as "uncompressed". :return: portable encoding of the public key - :rtype: str + :rtype: bytes + + .. warning:: The PEM is encoded to US-ASCII, it needs to be + re-encoded if the system is incompatible (e.g. uses UTF-16) """ return der.topem(self.to_der(point_encoding), "PUBLIC KEY") @@ -937,7 +940,10 @@ def to_pem(self, point_encoding="uncompressed"): :param str point_encoding: format to use for encoding public point :return: PEM encoded private key - :rtype: str + :rtype: bytes + + .. warning:: The PEM is encoded to US-ASCII, it needs to be + re-encoded if the system is incompatible (e.g. uses UTF-16) """ # TODO: "BEGIN ECPARAMETERS" return der.topem(self.to_der(point_encoding), "EC PRIVATE KEY")