예제 #1
0
파일: __init__.py 프로젝트: bjorand/dxf
def _jwk_to_key(jwk):
    if jwk['kty'] != 'EC':
        raise exceptions.DXFUnexpectedKeyTypeError(jwk['kty'], 'EC')
    if jwk['crv'] != 'P-256':
        raise exceptions.DXFUnexpectedKeyTypeError(jwk['crv'], 'P-256')
    # pylint: disable=bad-continuation
    return ecdsa.VerifyingKey.from_public_point(
        ecdsa.ellipticcurve.Point(ecdsa.NIST256p.curve,
                                  _base64_to_num(jwk['x']),
                                  _base64_to_num(jwk['y'])), ecdsa.NIST256p)
예제 #2
0
파일: __init__.py 프로젝트: treescale/dxf
def _import_key(expkey):
    if expkey['kty'] != 'EC':
        raise exceptions.DXFUnexpectedKeyTypeError(expkey['kty'], 'EC')
    if expkey['crv'] != 'P-256':
        raise exceptions.DXFUnexpectedKeyTypeError(expkey['crv'], 'P-256')
    return jwk.JWK(kty='EC', crv='P-256', x=expkey['x'], y=expkey['y'])