예제 #1
0
    def sign(self, dist):
        self._reprepro('export %s' % dist)

        gpg = GPG()
        filename = os.path.join(self.path, 'dists/%s/Release' % dist)
        detach_file = filename + '.gpg'
        try:
            os.unlink(detach_file)
        except: pass
        result = gpg.sign_file(file(filename, 'r'), keyid=conf('repository.signkey'), outputfile=detach_file)
예제 #2
0
    def sign(self, dist):
        self._reprepro('export %s' % dist)

        gpg = GPG(gnupghome=conf('repository.gpghome'))
        filename = os.path.join(self.path, 'dists/%s/Release' % dist)
        detach_file = filename + '.gpg'
        try:
            os.unlink(detach_file)
        except: pass
        result = gpg.sign_file(file(filename, 'r'), keyid=conf('repository.signkey'), outputfile=detach_file)
예제 #3
0
def sign(config, s_filename):
    """sign the package"""
    gpg_home = config.get('gpg_dir', '/var/lib/sachannelupdate/gnupg')
    gpg_pass = config.get('gpg_passphrase')
    gpg_keyid = config.get('gpg_keyid')
    gpg = GPG(gnupghome=gpg_home)
    try:
        plaintext = open(s_filename, 'rb')
        signature = gpg.sign_file(
            plaintext, keyid=gpg_keyid, passphrase=gpg_pass, detach=True)
        with open('%s.asc' % s_filename, 'wb') as handle:
            handle.write(str(signature))
    finally:
        if 'plaintext' in locals():
            plaintext.close()
예제 #4
0
def sign(config, s_filename):
    """sign the package"""
    gpg_home = config.get('gpg_dir', '/var/lib/sachannelupdate/gnupg')
    gpg_pass = config.get('gpg_passphrase')
    gpg_keyid = config.get('gpg_keyid')
    gpg = GPG(gnupghome=gpg_home)
    try:
        plaintext = open(s_filename, 'rb')
        signature = gpg.sign_file(plaintext,
                                  keyid=gpg_keyid,
                                  passphrase=gpg_pass,
                                  detach=True)
        with open('%s.asc' % s_filename, 'wb') as handle:
            handle.write(str(signature))
    finally:
        if 'plaintext' in locals():
            plaintext.close()
예제 #5
0
def sign_content(path, keyring, key, passphrase, output_dir, output_ext='sig'):
    """ Sign the content at specified path using provided keyring
    :param path:        path of the content file
    :param keyring:     keyring path to use
    :param key:         key id
    :param passphrase:  key passphrase
    :param output_dir:  directory in which to write the signed file
    :param output_ext:  extension of the signed file
    """
    name = os.path.splitext(os.path.basename(path))[0]
    gpg = GPG(gnupghome=keyring)
    with open(path, 'rb') as content:
        signed = gpg.sign_file(content, keyid=key, passphrase=passphrase,
                               binary=True, clearsign=False)
    new_path = os.path.join(output_dir, name + '.' + output_ext)
    with open(new_path, 'wb') as output:
        output.write(signed.data)
    return new_path
예제 #6
0
def sign_content(path, keyring, key, passphrase, output_dir, output_ext='sig'):
    """ Sign the content at specified path using provided keyring
    :param path:        path of the content file
    :param keyring:     keyring path to use
    :param key:         key id
    :param passphrase:  key passphrase
    :param output_dir:  directory in which to write the signed file
    :param output_ext:  extension of the signed file
    """
    name = os.path.splitext(os.path.basename(path))[0]
    gpg = GPG(gnupghome=keyring)
    with open(path, 'rb') as content:
        signed = gpg.sign_file(content,
                               keyid=key,
                               passphrase=passphrase,
                               binary=True,
                               clearsign=False)
    new_path = os.path.join(output_dir, name + '.' + output_ext)
    with open(new_path, 'wb') as output:
        output.write(signed.data)
    return new_path