I don't know why this just occurred to me, but this is only for tests, any
reason not to just use pyasn1?


On Wed, Apr 30, 2014 at 7:21 AM, Alex Stapleton <notifications@github.com>wrote:

> In tests/utils.py:
>
> > @@ -80,6 +80,33 @@ def raises_unsupported_algorithm(reason):
> >      assert exc_info.value._reason is reason
> >
> >
> > +def _int_to_asn1_int(i):
> > +    """
> > +    Used by dss_sig_value to convert python integers to ASN.1 integer bytes.
> > +    """
> > +    if i == 0:
> > +        return b'\x02\x01\x00'
> > +    if i < 0:
> > +        raise ValueError("This only supports positive integers right now.")
> > +    result = []
> > +    while i:
> > +        result.append(six.int2byte(i & 0xFF))
> > +        i >>= 8
> > +    # ASN.1 integers are stored big endian two's complement, so add a byte if
>
> Is this not also the format that we encode stuff to for OpenSSL int_to_bn?
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/pyca/cryptography/pull/980/files#r12145330>
> .
>



-- 
"I disapprove of what you say, but I will defend to the death your right to
say it." -- Evelyn Beatrice Hall (summarizing Voltaire)
"The people's good is the highest law." -- Cicero
GPG Key fingerprint: 125F 5C67 DFE9 4084