def sign(self, digest, algo='sha1'): # type: (bytes, str) -> bytes """ Signs a digest with the private key @param digest: A digest created by using the digest method @param algo: The method that created the digest. Legal values like 'sha1','sha224', 'sha256', 'ripemd160', and 'md5'. @return: a string which is the signature """ digest_type = getattr(m2, 'NID_' + algo, None) if digest_type is None: raise ValueError('unknown algorithm', algo) return m2.rsa_sign(self.rsa, digest, digest_type)
def sign(self, digest, algo='sha1'): # type: (bytes, str) -> bytes """ Signs a digest with the private key :param digest: A digest created by using the digest method :param algo: The method that created the digest. Legal values like 'sha1','sha224', 'sha256', 'ripemd160', and 'md5'. :return: a string which is the signature """ digest_type = getattr(m2, 'NID_' + algo, None) if digest_type is None: raise ValueError('unknown algorithm', algo) return m2.rsa_sign(self.rsa, digest, digest_type)