Esempio n. 1
0
    def test_enc_sk_file(self, fpath):
        """
        test nacl.enc function
        with sk_file and pk_file set
        """
        with salt.utils.files.fopen(fpath, "w") as wfh:
            wfh.write(self.key)
        with salt.utils.files.fopen(fpath + ".pub", "w") as wfh:
            wfh.write(self.pub)

        kwargs = {
            "opts": {"pki_dir": os.path.dirname(fpath)},
            "sk_file": fpath,
            "pk_file": fpath + ".pub",
        }
        ret = nacl.enc("blah", **kwargs)
        assert isinstance(ret, bytes)
Esempio n. 2
0
    def test_enc_sk_file(self, fpath):
        '''
        test nacl.enc function
        with sk_file and pk_file set
        '''
        with salt.utils.files.fopen(fpath, 'w') as wfh:
            wfh.write(self.key)
        with salt.utils.files.fopen(fpath + '.pub', 'w') as wfh:
            wfh.write(self.pub)

        kwargs = {
            'opts': {
                'pki_dir': os.path.dirname(fpath)
            },
            'sk_file': fpath,
            'pk_file': fpath + '.pub'
        }
        ret = nacl.enc('blah', **kwargs)
        assert isinstance(ret, bytes)