| Index: third_party/tlslite/tlslite/utils/rsakey.py
|
| diff --git a/third_party/tlslite/tlslite/utils/rsakey.py b/third_party/tlslite/tlslite/utils/rsakey.py
|
| index 3f2100ebc0d09b3d9d96b7be8b4fc9fc2925775a..fb022cc6445d0ad2fa244e147d89ee3f09e93531 100644
|
| --- a/third_party/tlslite/tlslite/utils/rsakey.py
|
| +++ b/third_party/tlslite/tlslite/utils/rsakey.py
|
| @@ -60,7 +60,7 @@ class RSAKey(object):
|
| @return: A PKCS1-SHA1 signature on the passed-in data.
|
| """
|
| hashBytes = SHA1(bytearray(bytes))
|
| - prefixedHashBytes = self._addPKCS1SHA1Prefix(hashBytes)
|
| + prefixedHashBytes = self.addPKCS1SHA1Prefix(hashBytes)
|
| sigBytes = self.sign(prefixedHashBytes)
|
| return sigBytes
|
|
|
| @@ -81,8 +81,8 @@ class RSAKey(object):
|
| hashBytes = SHA1(bytearray(bytes))
|
|
|
| # Try it with/without the embedded NULL
|
| - prefixedHashBytes1 = self._addPKCS1SHA1Prefix(hashBytes, False)
|
| - prefixedHashBytes2 = self._addPKCS1SHA1Prefix(hashBytes, True)
|
| + prefixedHashBytes1 = self.addPKCS1SHA1Prefix(hashBytes, False)
|
| + prefixedHashBytes2 = self.addPKCS1SHA1Prefix(hashBytes, True)
|
| result1 = self.verify(sigBytes, prefixedHashBytes1)
|
| result2 = self.verify(sigBytes, prefixedHashBytes2)
|
| return (result1 or result2)
|
| @@ -221,7 +221,8 @@ class RSAKey(object):
|
| # Helper Functions for RSA Keys
|
| # **************************************************************************
|
|
|
| - def _addPKCS1SHA1Prefix(self, bytes, withNULL=True):
|
| + @staticmethod
|
| + def addPKCS1SHA1Prefix(bytes, withNULL=True):
|
| # There is a long history of confusion over whether the SHA1
|
| # algorithmIdentifier should be encoded with a NULL parameter or
|
| # with the parameter omitted. While the original intention was
|
| @@ -229,8 +230,7 @@ class RSAKey(object):
|
| # specifies the NULL should be included, and this behavior is also
|
| # mandated in recent versions of PKCS #1, and is what tlslite has
|
| # always implemented. Anyways, verification code should probably
|
| - # accept both. However, nothing uses this code yet, so this is
|
| - # all fairly moot.
|
| + # accept both.
|
| if not withNULL:
|
| prefixBytes = bytearray(\
|
| [0x30,0x1f,0x30,0x07,0x06,0x05,0x2b,0x0e,0x03,0x02,0x1a,0x04,0x14])
|
|
|