def load_pub_key_params(p, q, g, pub): """Create a DSA_pub object from parameters and key.""" 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.DSA_pub(dsa, 1)
def set_params(p, q, g): # type: (bytes, bytes, bytes) -> DSA """ Factory function that instantiates a DSA object with DSA parameters. :param p: value of p, a "byte string" :param q: value of q, a "byte string" :param g: value of g, a "byte string" :return: instance of DSA. """ dsa = m2.dsa_new() m2.dsa_set_pqg(dsa, p, q, g) return DSA(dsa, 1)
def pub_key_from_params(p, q, g, pub): # type: (bytes, bytes, bytes, bytes) -> DSA_pub """ Factory function that instantiates a DSA_pub object using the parameters and public key specified. :param p: value of p :param q: value of q :param g: value of g :param pub: value of the public key :return: instance of DSA_pub. """ dsa = m2.dsa_new() m2.dsa_set_pqg(dsa, p, q, g) m2.dsa_set_pub(dsa, pub) return DSA_pub(dsa, 1)
def set_params(p, q, g): # type: (bytes, bytes, bytes) -> DSA """ Factory function that instantiates a DSA object with DSA parameters. @param p: value of p, a "byte string" @param q: value of q, a "byte string" @param g: value of g, a "byte string" @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): # type: (bytes, bytes, bytes, bytes) -> DSA_pub """ Factory function that instantiates a DSA_pub object using the parameters and public key specified. @param p: value of p @param q: value of q @param g: value of g @param pub: value of the public key @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)
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)