def check(buffer: bytes, **kwargs):
     try:
         priv, _ = parse_openssh_key(buffer, SSH_PUBLIC_HEADER,
                                     RSAPublicKey, RSAPrivateKey,
                                     kwargs.get('passphrase'))
         return priv is not None and SSH_PUBLIC_HEADER in buffer
     except ValueError as _:
         return False
Beispiel #2
0
    def decode(buffer: bytes, **kwargs):
        from samson.public_key.eddsa import EdDSA
        from samson.math.algebra.curves.named import EdwardsCurve25519
        _, pub = parse_openssh_key(buffer, SSH_PUBLIC_HEADER, EdDSAPublicKey,
                                   EdDSAPrivateKey, None)

        a, h = pub.a, 0
        eddsa = EdDSA(curve=EdwardsCurve25519, h=h, a=a, d=0, clamp=False)

        return eddsa
    def decode(buffer: bytes, **kwargs):
        from samson.public_key.eddsa import EdDSA
        from samson.math.algebra.curves.named import EdwardsCurve25519
        priv, _ = parse_openssh_key(buffer, SSH_PUBLIC_HEADER, EdDSAPublicKey,
                                    EdDSAPrivateKey, kwargs.get('passphrase'))

        a, h = priv.a, priv.h
        eddsa = EdDSA(curve=EdwardsCurve25519, h=h, a=a, d=0, clamp=False)

        return eddsa
    def decode(buffer: bytes, **kwargs):
        from samson.public_key.rsa import RSA
        _, pub = parse_openssh_key(buffer, SSH_PUBLIC_HEADER, RSAPublicKey, RSAPrivateKey, None)

        n, e, p, q = pub.n, pub.e, 2, 3

        rsa = RSA(8, p=p, q=q, e=e)
        rsa.n = n

        return rsa
    def decode(buffer: bytes, **kwargs):
        from samson.public_key.rsa import RSA
        priv, _ = parse_openssh_key(buffer, SSH_PUBLIC_HEADER, RSAPublicKey,
                                    RSAPrivateKey, kwargs.get('passphrase'))

        n, e, p, q = priv.n, priv.e, priv.p, priv.q

        rsa = RSA(8, p=p, q=q, e=e)
        rsa.n = n

        return rsa
    def decode(buffer: bytes, **kwargs):
        from samson.public_key.dsa import DSA
        _, pub = parse_openssh_key(buffer, SSH_PUBLIC_HEADER, DSAPublicKey,
                                   DSAPrivateKey, None)

        p, q, g, y, x = pub.p, pub.q, pub.g, pub.y, 0

        dsa = DSA(None, p=p, q=q, g=g, x=x)
        dsa.y = y

        return dsa
    def decode(buffer: bytes, **kwargs):
        from samson.public_key.dsa import DSA
        priv, _ = parse_openssh_key(buffer, SSH_PUBLIC_HEADER, DSAPublicKey,
                                    DSAPrivateKey, kwargs.get('passphrase'))

        p, q, g, y, x = priv.p, priv.q, priv.g, priv.y, priv.x

        dsa = DSA(None, p=p, q=q, g=g, x=x)
        dsa.y = y

        return dsa
Beispiel #8
0
    def decode(buffer: bytes, **kwargs):
        from samson.public_key.ecdsa import ECDSA
        _, pub = parse_openssh_key(buffer, SSH_PUBLIC_HEADER, ECDSAPublicKey,
                                   ECDSAPrivateKey, None)

        curve, x_y_bytes, d = pub.curve, pub.x_y_bytes, 1
        curve = SSH_INVERSE_CURVE_LOOKUP[curve.decode()]

        ecdsa = ECDSA(G=curve.G, hash_obj=None, d=d)
        ecdsa.Q = curve(*ECDSA.decode_point(x_y_bytes))

        return ecdsa