Пример #1
0
 def verify(self, message, signature):
     try:
         bits = signature.split(":")
         padding_scheme = bits[0]
         signature = ":".join(bits[1:])
     except (ValueError, TypeError, IndexError):
         return False
     signature = _rjust(signature, self.size / 8, "\x00")
     encsig = self.encrypt(signature)
     encsig = _rjust(encsig, self.size / 8, "\x00")
     try:
         padder = self._get_padder(padding_scheme)
     except ValueError:
         return False
     return padder.verify(message, encsig)
Пример #2
0
 def verify(self,message,signature):
     try:
         bits = signature.split(":")
         padding_scheme = bits[0]
         signature = ":".join(bits[1:])
     except (ValueError,TypeError,IndexError):
         return False
     signature = _rjust(signature,self.size/8,"\x00")
     encsig = self.encrypt(signature)
     encsig = _rjust(encsig,self.size/8,"\x00")
     try:
         padder = self._get_padder(padding_scheme)
     except ValueError:
         return False
     return padder.verify(message,encsig)
Пример #3
0
 def sign(self, message, padding_scheme=None):
     if padding_scheme is None:
         padding_scheme = self.default_padding_scheme
     if padding_scheme is None:
         padding_scheme = "pss-sha1"
     encsig = self._get_padder(padding_scheme).encode(message)
     signature = self.decrypt(encsig)
     return padding_scheme + ":" + _rjust(signature, self.size / 8, "\x00")
Пример #4
0
 def sign(self,message,padding_scheme=None):
     if padding_scheme is None:
         padding_scheme = self.default_padding_scheme
     if padding_scheme is None:
         padding_scheme = "pss-sha1"
     encsig = self._get_padder(padding_scheme).encode(message)
     signature = self.decrypt(encsig)
     return padding_scheme + ":" + _rjust(signature,self.size/8,"\x00")