public function deletePublicKey($keyId)
    {
        $fingerprint = $this->getFingerprint($keyId);

        if ($fingerprint === null) {
            throw new Crypt_GPG_KeyNotFoundException(
                'Public key not found: ' . $keyId,
                self::ERROR_KEY_NOT_FOUND,
                $keyId
            );
        }

        $operation = '--delete-key ' . escapeshellarg($fingerprint);
        $arguments = array(
            '--batch',
            '--yes'
        );

        $this->engine->reset();
        $this->engine->setOperation($operation, $arguments);
        $this->engine->run();
    }
public function deletePublicKey($keyId)
    {
        $fingerprint = $this->getFingerprint($keyId);

        if ($fingerprint === null) {
            throw new Crypt_GPG_KeyNotFoundException(
                'Public key not found: ' . $keyId,
                self::ERROR_KEY_NOT_FOUND,
                $keyId
            );
        }

        $operation = '--delete-key ' . escapeshellarg($fingerprint);
        $arguments = array(
            '--batch',
            '--yes'
        );

        $this->engine->reset();
        $this->engine->setOperation($operation, $arguments);
        $this->engine->run();
    }
public function deletePublicKey ( $ keyId ) { $ fingerprint = $ this -> getFingerprint ( $ keyId ) ; if ( $ fingerprint === null ) { throw new Crypt_GPG_KeyNotFoundException ( 'Public key not found: ' . $ keyId , self :: ERROR_KEY_NOT_FOUND , $ keyId ) ; } $ operation = '--delete-key ' . escapeshellarg ( $ fingerprint ) ; $ arguments = array ( '--batch' , '--yes' ) ; $ this -> engine -> reset ( ) ; $ this -> engine -> setOperation ( $ operation , $ arguments ) ; $ this -> engine -> run ( ) ; }
Deletes a public key from the keyring

If more than one key fingerprint is available for the specified
<kbd>$keyId</kbd> (for example, if you use a non-unique uid) only the
first public key is deleted.

The private key must be deleted first or an exception will be thrown.
In GnuPG >= 2.1 this limitation does not exist.
See {@link Crypt_GPG::deletePrivateKey()}.

@param string $keyId either the full uid of the public key, the email
part of the uid of the public key or the key id of
the public key. For example,
"Test User (example) <test@example.com>",
"test@example.com" or a hexadecimal string.

@return void

@throws Crypt_GPG_KeyNotFoundException if a public key with the given
<kbd>$keyId</kbd> is not found.

@throws Crypt_GPG_DeletePrivateKeyException if the specified public key
has an associated private key on the keyring. The private key
must be deleted first (when using GnuPG < 2.1).

@throws Crypt_GPG_Exception if an unknown or unexpected error occurs.
Use the <kbd>debug</kbd> option and file a bug report if these
exceptions occur.
Deletes a public key from the keyring