How to use the libnacl.crypto_sign_seed_keypair function in libnacl

To help you get started, we’ve selected a few libnacl examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hyperledger / indy-plenum / plenum / common / z_util.py View on Github external
def createEncAndSigKeys(enc_key_dir, sig_key_dir, name, seed=None):
    seed = seed or randomSeed()
    if isinstance(seed, str):
        seed = seed.encode()
    # ATTENTION: Passing `seed` encoded to bytes or not in
    # `crypto_sign_seed_keypair` will generate different keypairs
    verif_key, sig_key = crypto_sign_seed_keypair(seed)
    createCertsFromKeys(sig_key_dir, name, z85.encode(verif_key),
                        z85.encode(sig_key[:32]))
    public_key, secret_key = ep2c(verif_key), es2c(sig_key)
    createCertsFromKeys(enc_key_dir, name, z85.encode(public_key),
                        z85.encode(secret_key))
    return (public_key, secret_key), (verif_key, sig_key)
github hyperledger / indy-plenum / stp_core / crypto / nacl_wrappers.py View on Github external
def __init__(self, seed, encoder=encoding.RawEncoder):
        # Decode the seed
        seed = encoder.decode(seed)

        # Verify that our seed is the proper size
        if len(seed) != libnacl.crypto_sign_SEEDBYTES:
            raise ValueError(
                "The seed must be exactly %d bytes long" %
                libnacl.crypto_sign_SEEDBYTES
            )

        public_key, secret_key = libnacl.crypto_sign_seed_keypair(seed)

        self._seed = seed
        self._signing_key = secret_key
        self.verify_key = VerifyKey(public_key)
github saltstack / libnacl / libnacl / sign.py View on Github external
def __init__(self, seed=None):
        '''
        Create a signing key, if not seed it supplied a keypair is generated
        '''
        if seed:
            if len(seed) != libnacl.crypto_sign_SEEDBYTES:
                raise ValueError('Invalid seed bytes')
            self.vk, self.sk = libnacl.crypto_sign_seed_keypair(seed)
        else:
            seed = libnacl.randombytes(libnacl.crypto_sign_SEEDBYTES)
            self.vk, self.sk = libnacl.crypto_sign_seed_keypair(seed)
        self.seed = seed
github JoinMarket-Org / joinmarket / lib / libnacl / sign.py View on Github external
def __init__(self, seed=None):
        '''
        Create a signing key, if not seed it supplied a keypair is generated
        '''
        if seed:
            if len(seed) != libnacl.crypto_sign_SEEDBYTES:
                raise ValueError('Invalid seed bytes')
            self.vk, self.sk = libnacl.crypto_sign_seed_keypair(seed)
        else:
            seed = libnacl.randombytes(libnacl.crypto_sign_SEEDBYTES)
            self.vk, self.sk = libnacl.crypto_sign_seed_keypair(seed)
        self.seed = seed
github saltstack / raet / raet / nacling.py View on Github external
def __init__(self, seed, encoder=encoding.RawEncoder):
        # Decode the seed
        seed = encoder.decode(seed)

        # Verify that our seed is the proper size
        if len(seed) != libnacl.crypto_sign_SEEDBYTES:
            raise ValueError(
                "The seed must be exactly %d bytes long" %
                libnacl.crypto_sign_SEEDBYTES
            )

        public_key, secret_key = libnacl.crypto_sign_seed_keypair(seed)

        self._seed = seed
        self._signing_key = secret_key
        self.verify_key = VerifyKey(public_key)
github saltstack / libnacl / libnacl / sign.py View on Github external
def __init__(self, seed=None):
        '''
        Create a signing key, if not seed it supplied a keypair is generated
        '''
        if seed:
            if len(seed) != libnacl.crypto_sign_SEEDBYTES:
                raise ValueError('Invalid seed bytes')
            self.vk, self.sk = libnacl.crypto_sign_seed_keypair(seed)
        else:
            seed = libnacl.randombytes(libnacl.crypto_sign_SEEDBYTES)
            self.vk, self.sk = libnacl.crypto_sign_seed_keypair(seed)
        self.seed = seed
github hyperledger / indy-plenum / stp_zmq / util.py View on Github external
def createEncAndSigKeys(enc_key_dir, sig_key_dir, name, seed=None):
    seed = seed or randomSeed()
    if isinstance(seed, str):
        seed = seed.encode()
    # ATTENTION: Passing `seed` encoded to bytes or not in
    # `crypto_sign_seed_keypair` will generate different keypairs
    verif_key, sig_key = crypto_sign_seed_keypair(seed)
    createCertsFromKeys(sig_key_dir, name, z85.encode(verif_key),
                        z85.encode(sig_key[:32]))
    public_key, secret_key = ep2c(verif_key), es2c(sig_key)
    createCertsFromKeys(enc_key_dir, name, z85.encode(public_key),
                        z85.encode(secret_key))
    return (public_key, secret_key), (verif_key, sig_key)