com.didisoft.pgp
Class RevocationLib

java.lang.Object
  extended by com.didisoft.pgp.bc.BaseLib
      extended by com.didisoft.pgp.RevocationLib

public class RevocationLib
extends com.didisoft.pgp.bc.BaseLib

OpenPGP Key Revocation Library for Java.


Field Summary
static byte REASON_KEY_COMPROMISED
          Revocation code: Key has been compromised
static byte REASON_KEY_NO_LONGER_USED
          Revocation code: Key is no longer used
static byte REASON_KEY_SUPERSEDED
          Revocation code: Key is superseded
static byte REASON_NO_REASON
          Revocation code: No reason specified
static byte REASON_USER_NO_LONGER_USED
          Revocation code: User Id is no longer used
 
Fields inherited from class com.didisoft.pgp.bc.BaseLib
BOUNCY_CASTLE_PROVIDER
 
Constructor Summary
RevocationLib()
          Constructor that initializes the revocation library class.
 
Method Summary
 void assignDesignatedRevoker(KeyStore keyStore, long keyId, java.lang.String privateKeyPassword, long revokerKeyId)
          Authorizes the specified key as designated revoker for this key.
 void assignDesignatedRevoker(KeyStore keyStore, java.lang.String userId, java.lang.String privateKeyPassword, java.lang.String revokerUserId)
          Authorizes the specified key as designated revoker for this key.
 void assignDesignatedRevoker(java.lang.String publicKeyFileName, java.lang.String privateKeyFileName, java.lang.String privateKeyPassword, java.lang.String revokerPublicKeyFileName)
          Authorizes the specified key as a designated revoker for this key.
 void createRevocationCertificateInFile(KeyStore keyStore, long keyId, java.lang.String privateKeyPassword, byte reason, java.lang.String description, java.lang.String outputFileName)
          Creates a key revocation certificate for a given OpenPGP key located in a KeyStore and stores it in a file.
 void createRevocationCertificateInFile(KeyStore keyStore, java.lang.String userId, java.lang.String privateKeyPassword, byte reason, java.lang.String description, java.lang.String outputFileName)
          Creates a key revocation certificate for a given OpenPGP key located in a KeyStore and stores it in a file.
 void createRevocationCertificateInFile(java.lang.String privateKeyFileName, java.lang.String privateKeyPassword, byte reason, java.lang.String description, java.lang.String outputFileName)
          Creates a key revocation certificate for a given OpenPGP key file and stores it in a file.
 java.lang.String createRevocationCertificateText(KeyStore keyStore, long keyId, java.lang.String privateKeyPassword, byte reason, java.lang.String description)
          Creates a revocation certificate for a given OpenPGP key in ASCII armored string format.
 java.lang.String createRevocationCertificateText(KeyStore keyStore, java.lang.String userId, java.lang.String privateKeyPassword, byte reason, java.lang.String description)
          Creates a revocation certificate for a given OpenPGP key in ASCII armored string format.
 java.lang.String createRevocationCertificateText(java.lang.String privateKeyFileName, java.lang.String privateKeyPassword, byte reason, java.lang.String description)
          Creates a revocation certificate in ASCII armored string format for a given OpenPGP key.
 java.lang.String getAsciiVersionHeader()
          Returns the Version comment text that is printed in ASCII armored output
 void revokeKey(KeyStore keyStore, long keyId, java.lang.String privateKeyPassword, byte reason, java.lang.String description)
          Revokes a public key or sub key from a KeyStore.
 void revokeKey(KeyStore keyStore, java.lang.String userId, java.lang.String privateKeyPassword, byte reason, java.lang.String description)
          Revokes a public key or sub key from a KeyStore.
 void revokeKey(java.lang.String publicKeyFileName, java.lang.String privateKeyFileName, java.lang.String privateKeyPassword, byte reason, java.lang.String description)
          Revokes a public key.
 void revokeKeyWithDesignatedRevoker(KeyStore keyStore, long keyId, long revokerKeyId, java.lang.String revokerPassword, byte reason, java.lang.String description)
          Revokes an OpenPGP public key located in a KeyStore with a designated revoker.
 void revokeKeyWithDesignatedRevoker(KeyStore keyStore, java.lang.String userId, java.lang.String revokerUserId, java.lang.String revokerPassword, byte reason, java.lang.String description)
          Revokes an OpenPGP public key located in a KeyStore with a designated revoker.
 void revokeKeyWithDesignatedRevoker(java.lang.String publicKeyFileName, java.lang.String revokerPrivateKeyFileName, java.lang.String revokerPassword, byte reason, java.lang.String description)
          Revokes an OpenPGP public key with a designated revoker private key file.
 void revokeKeyWithRevocationCertificateFile(KeyStore keyStore, java.lang.String certificateFileName)
          Revokes a key or subkey from an OpenPGP key ring located in a KeyStore.
 void revokeKeyWithRevocationCertificateFile(java.lang.String publicKeyFileName, java.lang.String certificateFileName)
          Revokes a key or subkey from an OpenPGP key ring file (*.asc, *.pkr) using a revocation certificate file.
 void revokeKeyWithRevocationCertificateText(KeyStore keyStore, java.lang.String certificateText)
          Revokes a key or subkey located in an OpenPGP KeyStore using a revocation certificate supplied as text.
 void revokeKeyWithRevocationCertificateText(java.lang.String publicKeyFileName, java.lang.String certificateText)
          Revokes a key or subkey from an OpenPGP key ring file (*.asc, *.pkr) using a revocation certificate supplied as text.
 void revokeUserIdSignature(KeyStore keyStore, long keyId, java.lang.String userId, java.lang.String privateKeyPassword, byte reason, java.lang.String description)
          Revokes a User Id signature binding from an OpenPGP public key located in a KeyStore
Note: the corresponding private key must also exist in this KeyStore in order the signature to be produced.
 void revokeUserIdSignature(KeyStore keyStore, java.lang.String userId, java.lang.String privateKeyPassword, byte reason, java.lang.String description)
          Revokes a User Id signature binding from an OpenPGP public key located in a KeyStore
Note: if more than one key has this User ID signature use @link revokeUserIdSignature(KeyStore, long, String, String, byte, String) instead

Equivalent GPG command:
gpg --edit-key [userId]
revsig
 void revokeUserIdSignature(java.lang.String publicKeyFileName, java.lang.String privateKeyFileName, java.lang.String privateKeyPassword, java.lang.String userId, byte reason, java.lang.String description)
          Revokes a User Id signature binding from an OpenPGP public key file.
 void setAsciiVersionHeader(java.lang.String creator)
          Sets the Version comment text that is printed in ASCII armored output

Example usage:
 
Methods inherited from class com.didisoft.pgp.bc.BaseLib
extractPrivateKey, isForVerification, replaceAll
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REASON_NO_REASON

public static final byte REASON_NO_REASON
Revocation code: No reason specified

See Also:
Constant Field Values

REASON_KEY_SUPERSEDED

public static final byte REASON_KEY_SUPERSEDED
Revocation code: Key is superseded

See Also:
Constant Field Values

REASON_KEY_COMPROMISED

public static final byte REASON_KEY_COMPROMISED
Revocation code: Key has been compromised

See Also:
Constant Field Values

REASON_KEY_NO_LONGER_USED

public static final byte REASON_KEY_NO_LONGER_USED
Revocation code: Key is no longer used

See Also:
Constant Field Values

REASON_USER_NO_LONGER_USED

public static final byte REASON_USER_NO_LONGER_USED
Revocation code: User Id is no longer used

See Also:
Constant Field Values
Constructor Detail

RevocationLib

public RevocationLib()
Constructor that initializes the revocation library class.

Method Detail

getAsciiVersionHeader

public java.lang.String getAsciiVersionHeader()
Returns the Version comment text that is printed in ASCII armored output

Returns:
string of the form "Version: XXX"

setAsciiVersionHeader

public void setAsciiVersionHeader(java.lang.String creator)
Sets the Version comment text that is printed in ASCII armored output

Example usage:
 RevocationLib revlib = new RevocationLib();
 revlib.setAsciiVersionHeader("My Application 1.1"); 
 // Now in ASCII armored output will be printed "Version: My Application 1.1"  
 

Parameters:
creator - Program name and version that will be written in ASCII armored output Version: field

createRevocationCertificateText

public java.lang.String createRevocationCertificateText(java.lang.String privateKeyFileName,
                                                        java.lang.String privateKeyPassword,
                                                        byte reason,
                                                        java.lang.String description)
                                                 throws PGPException,
                                                        java.io.IOException
Creates a revocation certificate in ASCII armored string format for a given OpenPGP key.

Key revocation certificates are especially useful if we have forgotten the pass phrase to our private key and we need some way to "disable" or revoke that key.

Equivalent GPG command:
gpg --gen-revoke [UserId]

Example program:

 import com.didisoft.pgp.*;
 
 public static void main(String[] args) throws Exception {
   RevocationLib lib = new RevocationLib();
   String revocationCertificateText = 
           lib.createRevocationCertificate("c:\\private_key.asc", "private key password", 
                                           RevocationReason.REASON_KEY_COMPROMISED,
                                           "Key has been compromised");
 }
 

Parameters:
privateKeyFileName - File name containing the Private key (absolute or relative path)
privateKeyPassword - Password of the private key
reason - Revocation reason code (use the REASON_ constants in this class)
description - Revocation description
Returns:
revocation certificate in ASCII armored string format
Throws:
PGPException
java.io.IOException
See Also:
revokeKeyWithRevocationCertificateText(String, String)

createRevocationCertificateText

public java.lang.String createRevocationCertificateText(KeyStore keyStore,
                                                        long keyId,
                                                        java.lang.String privateKeyPassword,
                                                        byte reason,
                                                        java.lang.String description)
                                                 throws PGPException,
                                                        java.io.IOException
Creates a revocation certificate for a given OpenPGP key in ASCII armored string format.

Key revocation certificates are especially useful if we have forgotten the pass phrase to our private key and we need some way to "disable" or revoke that key

Equivalent GPG command:
gpg --gen-revoke [keyId]

Parameters:
keyStore - KeyStore instance containing the key for which we want to create a revocation certificate
keyId - Key ID of the target key
privateKeyPassword - corresponding private key password for this key
reason - Revocation reason code (use the REASON_ constants in this class)
description - Revocation description
Returns:
revocation certificate in ASCII armored string format
Throws:
PGPException
java.io.IOException

createRevocationCertificateText

public java.lang.String createRevocationCertificateText(KeyStore keyStore,
                                                        java.lang.String userId,
                                                        java.lang.String privateKeyPassword,
                                                        byte reason,
                                                        java.lang.String description)
                                                 throws PGPException,
                                                        java.io.IOException
Creates a revocation certificate for a given OpenPGP key in ASCII armored string format.

Key revocation certificates are especially useful if we have forgotten the pass phrase to our private key and we need some way to "disable" or revoke that key

Equivalent GPG command:
gpg --gen-revoke [UserId]

Parameters:
keyStore - KeyStore holding the key for which we want to create a revocation certificate
userId - User ID of the target key
privateKeyPassword - corresponding private key password for this key
reason - Revocation reason code (use the REASON_ constants in this class)
description - Revocation description
Returns:
revocation certificate in ASCII armored format
Throws:
PGPException
java.io.IOException

createRevocationCertificateInFile

public void createRevocationCertificateInFile(java.lang.String privateKeyFileName,
                                              java.lang.String privateKeyPassword,
                                              byte reason,
                                              java.lang.String description,
                                              java.lang.String outputFileName)
                                       throws PGPException,
                                              java.io.IOException
Creates a key revocation certificate for a given OpenPGP key file and stores it in a file.

Key revocation certificates are especially useful if we have forgotten the pass phrase to our private key and we need some way to "disable" or revoke that key

Equivalent GPG command:
gpg --gen-revoke [UserId] --output [outputFileName]

Example program:

 import com.didisoft.pgp.*;
 
 public static void main(String[] args) throws Exception {
   RevocationLib lib = new RevocationLib();
   lib.createRevocationCertificateInFile("c:\\private_key.asc", 
                                          "private key password", 
                                          RevocationReason.REASON_KEY_COMPROMISED,
                                          "Key has been compromised",
                                          "c:\\Revocation_Certificate.txt");
 }
 

Parameters:
privateKeyFileName - File name containing the Private key (absolute or relative path)
privateKeyPassword - Password of the private key
reason - Revocation reason code (use the REASON_ constants from this class)
description - Revocation description
outputFileName - Output file name where the revocation certificate will be stored (absolute or relative path)
Throws:
PGPException
java.io.IOException
See Also:
revokeKeyWithRevocationCertificateFile(String, String), createRevocationCertificateText(String, String, byte, String)

createRevocationCertificateInFile

public void createRevocationCertificateInFile(KeyStore keyStore,
                                              long keyId,
                                              java.lang.String privateKeyPassword,
                                              byte reason,
                                              java.lang.String description,
                                              java.lang.String outputFileName)
                                       throws PGPException,
                                              java.io.IOException
Creates a key revocation certificate for a given OpenPGP key located in a KeyStore and stores it in a file.

Key revocation certificates are especially useful if we have forgotten the pass phrase to our private key and we need some way to "disable" or revoke that key

Equivalent GPG command:
gpg --gen-revoke [keyId] --output [outputFileName]

Parameters:
keyStore - KeyStore holding the target key (absolute or relative path)
keyId - Key ID of the target key
privateKeyPassword - Password of the private key
reason - Revocation reason code (use the REASON_ constants from this class)
description - Revocation description
outputFileName - Output file name where the revocation certificate will be stored (absolute or relative path)
Throws:
PGPException
java.io.IOException
See Also:
revokeKeyWithRevocationCertificateFile(KeyStore, String)

createRevocationCertificateInFile

public void createRevocationCertificateInFile(KeyStore keyStore,
                                              java.lang.String userId,
                                              java.lang.String privateKeyPassword,
                                              byte reason,
                                              java.lang.String description,
                                              java.lang.String outputFileName)
                                       throws PGPException,
                                              java.io.IOException
Creates a key revocation certificate for a given OpenPGP key located in a KeyStore and stores it in a file.

Key revocation certificates are especially useful if we have forgotten the pass phrase to our private key and we need some way to "disable" or revoke that key

Equivalent GPG command:
gpg --gen-revoke [UserId] --output [outputFileName]

Parameters:
keyStore - KeyStore holding the target key (absolute or relative path)
userId - User ID of the target key
privateKeyPassword - Password of the private key
reason - Revocation reason code (use the REASON_ constants from this class)
description - Revocation description
outputFileName - Output file name where the revocation certificate will be stored (absolute or relative path)
Throws:
PGPException
java.io.IOException
See Also:
revokeKeyWithRevocationCertificateFile(KeyStore, String)

assignDesignatedRevoker

public void assignDesignatedRevoker(java.lang.String publicKeyFileName,
                                    java.lang.String privateKeyFileName,
                                    java.lang.String privateKeyPassword,
                                    java.lang.String revokerPublicKeyFileName)
                             throws PGPException,
                                    java.io.IOException
Authorizes the specified key as a designated revoker for this key.

This method writes changes in the file publicKeyFileName.

Equivalent GPG command:
gpg --edit-key [keyId]
addrevoker [revokerKeyId]

Example usage:
 import com.didisoft.pgp.*;
 
 public static void main(String[] args) throws Exception {
   RevocationLib lib = new RevocationLib();
   
   lib.assignDesignatedRevoker("c:\\my_public_key.asc",
                               "c:\\my_secret_key.asc", 
                               "my secret key password", 
                               "c:\\other_person_public_key.asc");
 }          
 

Parameters:
publicKeyFileName - Target public key file name (absolute or relative path)
privateKeyFileName - Corresponding private key file
(can be the same as publicKeyFileName if both keys are in one file)
privateKeyPassword - private key password
revokerPublicKeyFileName - Key file that will be a designated revoker (absolute or relative path)
Throws:
PGPException
java.io.IOException
See Also:
revokeKeyWithDesignatedRevoker(String, String, String, byte, String)

assignDesignatedRevoker

public void assignDesignatedRevoker(KeyStore keyStore,
                                    long keyId,
                                    java.lang.String privateKeyPassword,
                                    long revokerKeyId)
                             throws PGPException,
                                    java.io.IOException
Authorizes the specified key as designated revoker for this key.
Note that the corresponding private key of the key that authorizes must also be in this KeyStore.

Equivalent GPG command:
gpg --edit-key [keyId]
addrevoker [revokerKeyId]

Parameters:
keyStore - KeyStore containing the keys
keyId - Key ID of the key that authorizes the designated revoker
privateKeyPassword - private key password of the key that authorizes the designated revoker
revokerKeyId - Key ID of the designated revoker
Throws:
PGPException
java.io.IOException
See Also:
revokeKeyWithDesignatedRevoker(KeyStore, long, long, String, byte, String)

assignDesignatedRevoker

public void assignDesignatedRevoker(KeyStore keyStore,
                                    java.lang.String userId,
                                    java.lang.String privateKeyPassword,
                                    java.lang.String revokerUserId)
                             throws PGPException,
                                    java.io.IOException
Authorizes the specified key as designated revoker for this key.
Note that the corresponding private key of the key that authorizes must also be in this KeyStore.

Equivalent GPG command:
gpg --edit-key [userId]
addrevoker [revokerUserId]

Parameters:
keyStore - KeyStore containing the keys
userId - User ID of the key that authorizes the designated revoker
privateKeyPassword - private key password of the key that authorizes the designated revoker
revokerUserId - User ID of the designated revoker
Throws:
PGPException
java.io.IOException
See Also:
revokeKeyWithDesignatedRevoker(KeyStore, String, String, String, byte, String)

revokeKeyWithRevocationCertificateText

public void revokeKeyWithRevocationCertificateText(java.lang.String publicKeyFileName,
                                                   java.lang.String certificateText)
                                            throws java.io.IOException,
                                                   PGPException
Revokes a key or subkey from an OpenPGP key ring file (*.asc, *.pkr) using a revocation certificate supplied as text.

Parameters:
publicKeyFileName - file name containing the target OpenPGP key (absolute or relative path)
certificateText - revocation certificate in ASCII armored string format
Throws:
java.io.IOException - if there is a problem reading the public key file
PGPException - if the revocation certificate is not applicable for this key ring
See Also:
createRevocationCertificateText(String, String, byte, String)

revokeKeyWithRevocationCertificateText

public void revokeKeyWithRevocationCertificateText(KeyStore keyStore,
                                                   java.lang.String certificateText)
                                            throws PGPException
Revokes a key or subkey located in an OpenPGP KeyStore using a revocation certificate supplied as text.

Equivalent GPG command:
gpg --import [certificateFile]

Parameters:
keyStore - KeyStore instance containing the target OpenPGP key
certificateText - revocation certificate in ASCII armored string format
Throws:
PGPException - If no key was found that matches the issuer key ID recorded in this revocation certificate
or if the revocation certificate is corrupted
See Also:
#createRevocationCertificate(String, String, byte, String)

revokeKeyWithRevocationCertificateFile

public void revokeKeyWithRevocationCertificateFile(java.lang.String publicKeyFileName,
                                                   java.lang.String certificateFileName)
                                            throws java.io.IOException,
                                                   PGPException
Revokes a key or subkey from an OpenPGP key ring file (*.asc, *.pkr) using a revocation certificate file.

Parameters:
publicKeyFileName - file name containing the target OpenPGP key (absolute or relative path)
certificateFileName - revocation certificate file name (absolute or relative path)
Throws:
java.io.IOException - if there is a problem reading the public key file or the certificate file
PGPException - If no key was found that matches the issuer key ID recorded in this revocation certificate
or if the revocation certificate is corrupted
See Also:
createRevocationCertificateInFile(String, String, byte, String, String)

revokeKeyWithRevocationCertificateFile

public void revokeKeyWithRevocationCertificateFile(KeyStore keyStore,
                                                   java.lang.String certificateFileName)
                                            throws java.io.IOException,
                                                   PGPException
Revokes a key or subkey from an OpenPGP key ring located in a KeyStore.

Equivalent GPG command:
gpg --import [certificateFileName]

Parameters:
keyStore - KeyStore containing the target OpenPGP key
certificateFileName - revocation certificate file name (absolute or relative path)
Throws:
java.io.IOException - if there is a problem reading the certificate file
PGPException - If no key was found that matches the issuer key ID recorded in this revocation certificate
or if the revocation certificate is corrupted
See Also:
createRevocationCertificateInFile(String, String, byte, String, String)

revokeKey

public void revokeKey(KeyStore keyStore,
                      long keyId,
                      java.lang.String privateKeyPassword,
                      byte reason,
                      java.lang.String description)
               throws PGPException
Revokes a public key or sub key from a KeyStore.
Note: The corresponding private key of this key must also be in the same KeyStore object.

Equivalent GPG command:
gpg --edit-key [userId]
revkey

Parameters:
keyStore - KeyStore object containing the key to be revoked
keyId - Key ID of the key or sub key to be revoked
privateKeyPassword - private key password of the key to be revoked
reason - revocation reason code (use the REASON_ constants in this class)
description - revocation description (plain text)
Throws:
PGPException

revokeKey

public void revokeKey(KeyStore keyStore,
                      java.lang.String userId,
                      java.lang.String privateKeyPassword,
                      byte reason,
                      java.lang.String description)
               throws PGPException
Revokes a public key or sub key from a KeyStore.
Note: The corresponding private key of this key must also be in the same KeyStore object.

Equivalent GPG command:
gpg --edit-key [userId]
revkey

Parameters:
keyStore - KeyStore object containing the key to be revoked
userId - User ID of the key or sub key to be revoked
privateKeyPassword - private key password of the key to be revoked
reason - revocation reason code (use the REASON_ constants in this class)
description - revocation description
Throws:
PGPException - Bug in the library.

revokeKey

public void revokeKey(java.lang.String publicKeyFileName,
                      java.lang.String privateKeyFileName,
                      java.lang.String privateKeyPassword,
                      byte reason,
                      java.lang.String description)
               throws java.io.IOException,
                      PGPException
Revokes a public key.

Example program:
 import com.didisoft.pgp.*;
 
 public static void main(String[] args) throws Exception {
    RevocationLib lib = new RevocationLib();
    lib.revokeKey("c:\\public_key.asc", 
                  "c:\\private_key.asc", 
                  "private key password here", 
                  RevocationLib.REASON_KEY_NO_LONGER_USED, 
                  "this pgp key is not used any more");
 }   
 

Parameters:
publicKeyFileName - public key file that will be revoked (absolute or relative path)
privateKeyFileName - corresponding private key file (absolute or relative path)
Note: may be the same file as publicKeyFileName
privateKeyPassword - private key password
reason - revocation reason code (use the REASON_ constants in this class)
description - revocation description
Throws:
java.io.IOException - If there is a problem reading or writing the key files
PGPException - Bug in the library.

revokeUserIdSignature

public void revokeUserIdSignature(java.lang.String publicKeyFileName,
                                  java.lang.String privateKeyFileName,
                                  java.lang.String privateKeyPassword,
                                  java.lang.String userId,
                                  byte reason,
                                  java.lang.String description)
                           throws java.io.IOException,
                                  PGPException
Revokes a User Id signature binding from an OpenPGP public key file.
One reason to do this is if this User Id is no longer connected to this key, for example have left the company.

Example program:
 import com.didisoft.pgp.*;
 
 public static void main(String[] args) throws Exception {
    RevocationLib lib = new RevocationLib();
    lib.revokeUserIdSignature("c:\\public_key.asc", 
                              "c:\\private_key.asc", 
                              "private key password here", 
                              "revoked_user@company.com", 
                              RevocationLib.REASON_USER_NO_LONGER_USED, 
                              "User ID revocation test");
 }   
 

Parameters:
publicKeyFileName - public key file that contains the User Id to be revoked (absolute or relative path)
privateKeyFileName - corresponding private key file (absolute or relative path)
Note: may be the same file as publicKeyFileName
privateKeyPassword - private key password
userId - User Id to be revoked
reason - revocation reason code (use the REASON_ constants in this class)
description - revocation description
Throws:
java.io.IOException - If there is a problem reading or writing the key files
PGPException - Bug in the library

revokeUserIdSignature

public void revokeUserIdSignature(KeyStore keyStore,
                                  long keyId,
                                  java.lang.String userId,
                                  java.lang.String privateKeyPassword,
                                  byte reason,
                                  java.lang.String description)
                           throws PGPException
Revokes a User Id signature binding from an OpenPGP public key located in a KeyStore
Note: the corresponding private key must also exist in this KeyStore in order the signature to be produced.

Equivalent GPG command:
gpg --edit-key [keyId]
revsig

Parameters:
keyStore - KeyStore holding the public key
keyId - Key ID of the key with the signature
userId - User ID signature to be revoked
privateKeyPassword - private key password of this key
reason - revocation reason code (use the REASON_ constants in this class)
description - revocation description
Throws:
PGPException - Bug in the library
See Also:
revokeUserIdSignature(KeyStore, String, String, byte, String)

revokeUserIdSignature

public void revokeUserIdSignature(KeyStore keyStore,
                                  java.lang.String userId,
                                  java.lang.String privateKeyPassword,
                                  byte reason,
                                  java.lang.String description)
                           throws PGPException
Revokes a User Id signature binding from an OpenPGP public key located in a KeyStore
Note: if more than one key has this User ID signature use @link revokeUserIdSignature(KeyStore, long, String, String, byte, String) instead

Equivalent GPG command:
gpg --edit-key [userId]
revsig

Parameters:
keyStore - KeyStore holding the public key
userId - User ID signature to be revoked
privateKeyPassword - private key password of this key
reason - revocation reason code
description - revocation description (plain text)
Throws:
PGPException

revokeKeyWithDesignatedRevoker

public void revokeKeyWithDesignatedRevoker(java.lang.String publicKeyFileName,
                                           java.lang.String revokerPrivateKeyFileName,
                                           java.lang.String revokerPassword,
                                           byte reason,
                                           java.lang.String description)
                                    throws PGPException,
                                           java.io.IOException
Revokes an OpenPGP public key with a designated revoker private key file.

Example program:
 import com.didisoft.pgp.*;
 
 public static void main(String[] args) throws Exception {
   RevocationLib lib = new RevocationLib();
   lib.revokeKeyWithDesignatedRevoker("c:\\my_public_key.asc", 
                                      "c:\\designated_revoker_secret_key.asc", 
                                      "designated revoker password here",
                                      RevocationLib.REASON_KEY_COMPROMISED,
                                      "pgp compromised reason test");
 }
 

Parameters:
publicKeyFileName - the public key that we want to revoke (absolute or relative path)
revokerPrivateKeyFileName - designated revoker secret key file (absolute or relative path)
revokerPassword - designated revoker secret key password
reason - revocation reason code (use the REASON_ constants in this class)
description - revocation description
Throws:
PGPException - If the specified designated revoker key has not been assigned as such for this key
java.io.IOException - If there is a problem reading or writing the key files
See Also:
assignDesignatedRevoker(String, String, String, String)

revokeKeyWithDesignatedRevoker

public void revokeKeyWithDesignatedRevoker(KeyStore keyStore,
                                           long keyId,
                                           long revokerKeyId,
                                           java.lang.String revokerPassword,
                                           byte reason,
                                           java.lang.String description)
                                    throws PGPException
Revokes an OpenPGP public key located in a KeyStore with a designated revoker.
Note: the designated revoker private key must also exist in the same KeyStore object.

Equivalent GPG command:
gpg --desig-revoke [keyId]

Parameters:
keyStore - KeyStore containing the keys
keyId - Key ID of the public key to be revoked
revokerKeyId - designated revoker key ID
revokerPassword - designated revoker secret key password
reason - revocation reason code
description - revocation description
Throws:
PGPException - If the specified designated revoker key has not been assigned as such for this key
See Also:
assignDesignatedRevoker(KeyStore, long, String, long)

revokeKeyWithDesignatedRevoker

public void revokeKeyWithDesignatedRevoker(KeyStore keyStore,
                                           java.lang.String userId,
                                           java.lang.String revokerUserId,
                                           java.lang.String revokerPassword,
                                           byte reason,
                                           java.lang.String description)
                                    throws PGPException
Revokes an OpenPGP public key located in a KeyStore with a designated revoker.
Note: the designated revoker private key must also exist in the same KeyStore object.

Equivalent GPG command:
gpg --desig-revoke [userId]

Parameters:
keyStore - KeyStore containing the keys
userId - User ID of the public key to be revoked
revokerUserId - designated revoker key User ID
revokerPassword - designated revoker secret key password
reason - revocation reason code
description - revocation description (plain text)
Throws:
PGPException
See Also:
assignDesignatedRevoker(String, String, String, String)


Copyright © 2006-2013 DidiSoft Ltd. All Rights Reserved.