def set_params(p, q, g): """ Factory function that instantiates a DSA object with DSA parameters. @type p: str @param p: value of p, a "byte string" @type q: str @param q: value of q, a "byte string" @type g: str @param g: value of g, a "byte string" @rtype: DSA @return: instance of DSA. """ dsa = m2.dsa_new() m2.dsa_set_p(dsa, p) m2.dsa_set_q(dsa, q) m2.dsa_set_g(dsa, g) return DSA(dsa, 1)
def pub_key_from_params(p, q, g, pub): """ Factory function that instantiates a DSA_pub object using the parameters and public key specified. @type p: str @param p: value of p, a "byte string" @type q: str @param q: value of q, a "byte string" @type g: str @param g: value of g, a "byte string" @type pub: str @param pub: value of the public key, a "byte string" @rtype: DSA_pub @return: instance of DSA_pub. """ dsa = m2.dsa_new() m2.dsa_set_p(dsa, p) m2.dsa_set_q(dsa, q) m2.dsa_set_g(dsa, g) m2.dsa_set_pub(dsa, pub) return DSA_pub(dsa, 1)