|
38 | 38 | HASH_ASN1 = { |
39 | 39 | 'MD5': b'\x30\x20\x30\x0c\x06\x08\x2a\x86\x48\x86\xf7\x0d\x02\x05\x05\x00\x04\x10', |
40 | 40 | 'SHA-1': b'\x30\x21\x30\x09\x06\x05\x2b\x0e\x03\x02\x1a\x05\x00\x04\x14', |
| 41 | + 'SHA-224': b'\x30\x2d\x30\x0d\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x04\x05\x00\x04\x1c', |
41 | 42 | 'SHA-256': b'\x30\x31\x30\x0d\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x01\x05\x00\x04\x20', |
42 | 43 | 'SHA-384': b'\x30\x41\x30\x0d\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x02\x05\x00\x04\x30', |
43 | 44 | 'SHA-512': b'\x30\x51\x30\x0d\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x03\x05\x00\x04\x40', |
|
46 | 47 | HASH_METHODS = { |
47 | 48 | 'MD5': hashlib.md5, |
48 | 49 | 'SHA-1': hashlib.sha1, |
| 50 | + 'SHA-224': hashlib.sha224, |
49 | 51 | 'SHA-256': hashlib.sha256, |
50 | 52 | 'SHA-384': hashlib.sha384, |
51 | 53 | 'SHA-512': hashlib.sha512, |
@@ -255,7 +257,7 @@ def sign_hash(hash_value, priv_key, hash_method): |
255 | 257 | None if needing to hash and sign message. |
256 | 258 | :param priv_key: the :py:class:`rsa.PrivateKey` to sign with |
257 | 259 | :param hash_method: the hash method used on the message. Use 'MD5', 'SHA-1', |
258 | | - 'SHA-256', 'SHA-384' or 'SHA-512'. |
| 260 | + 'SHA-224', SHA-256', 'SHA-384' or 'SHA-512'. |
259 | 261 | :return: a message signature block. |
260 | 262 | :raise OverflowError: if the private key is too small to contain the |
261 | 263 | requested hash. |
@@ -290,7 +292,7 @@ def sign(message, priv_key, hash_method): |
290 | 292 | file-like object. |
291 | 293 | :param priv_key: the :py:class:`rsa.PrivateKey` to sign with |
292 | 294 | :param hash_method: the hash method used on the message. Use 'MD5', 'SHA-1', |
293 | | - 'SHA-256', 'SHA-384' or 'SHA-512'. |
| 295 | + 'SHA-224', SHA-256', 'SHA-384' or 'SHA-512'. |
294 | 296 | :return: a message signature block. |
295 | 297 | :raise OverflowError: if the private key is too small to contain the |
296 | 298 | requested hash. |
|
0 commit comments