|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.didisoft.pgp.bc.BaseLib
com.didisoft.pgp.RevocationLib
public class RevocationLib
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 |
---|
public static final byte REASON_NO_REASON
public static final byte REASON_KEY_SUPERSEDED
public static final byte REASON_KEY_COMPROMISED
public static final byte REASON_KEY_NO_LONGER_USED
public static final byte REASON_USER_NO_LONGER_USED
Constructor Detail |
---|
public RevocationLib()
Method Detail |
---|
public java.lang.String getAsciiVersionHeader()
public void setAsciiVersionHeader(java.lang.String creator)
RevocationLib revlib = new RevocationLib(); revlib.setAsciiVersionHeader("My Application 1.1"); // Now in ASCII armored output will be printed "Version: My Application 1.1"
creator
- Program name and version that will be written in ASCII armored output Version: fieldpublic java.lang.String createRevocationCertificateText(java.lang.String privateKeyFileName, java.lang.String privateKeyPassword, byte reason, java.lang.String description) throws PGPException, java.io.IOException
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"); }
privateKeyFileName
- File name containing the Private key (absolute or relative path)privateKeyPassword
- Password of the private keyreason
- Revocation reason code (use the REASON_ constants in this class)description
- Revocation description
PGPException
java.io.IOException
revokeKeyWithRevocationCertificateText(String, String)
public java.lang.String createRevocationCertificateText(KeyStore keyStore, long keyId, java.lang.String privateKeyPassword, byte reason, java.lang.String description) throws PGPException, java.io.IOException
keyStore
- KeyStore instance containing the key for which we want to create a revocation certificatekeyId
- Key ID of the target keyprivateKeyPassword
- corresponding private key password for this keyreason
- Revocation reason code (use the REASON_ constants in this class)description
- Revocation description
PGPException
java.io.IOException
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
keyStore
- KeyStore holding the key for which we want to create a revocation certificateuserId
- User ID of the target keyprivateKeyPassword
- corresponding private key password for this keyreason
- Revocation reason code (use the REASON_ constants in this class)description
- Revocation description
PGPException
java.io.IOException
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
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"); }
privateKeyFileName
- File name containing the Private key (absolute or relative path)privateKeyPassword
- Password of the private keyreason
- Revocation reason code (use the REASON_ constants from this class)description
- Revocation descriptionoutputFileName
- Output file name where the revocation certificate will be stored (absolute or relative path)
PGPException
java.io.IOException
revokeKeyWithRevocationCertificateFile(String, String)
,
createRevocationCertificateText(String, String, byte, String)
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
keyStore
- KeyStore holding the target key (absolute or relative path)keyId
- Key ID of the target keyprivateKeyPassword
- Password of the private keyreason
- Revocation reason code (use the REASON_ constants from this class)description
- Revocation descriptionoutputFileName
- Output file name where the revocation certificate will be stored (absolute or relative path)
PGPException
java.io.IOException
revokeKeyWithRevocationCertificateFile(KeyStore, String)
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
keyStore
- KeyStore holding the target key (absolute or relative path)userId
- User ID of the target keyprivateKeyPassword
- Password of the private keyreason
- Revocation reason code (use the REASON_ constants from this class)description
- Revocation descriptionoutputFileName
- Output file name where the revocation certificate will be stored (absolute or relative path)
PGPException
java.io.IOException
revokeKeyWithRevocationCertificateFile(KeyStore, String)
public void assignDesignatedRevoker(java.lang.String publicKeyFileName, java.lang.String privateKeyFileName, java.lang.String privateKeyPassword, java.lang.String revokerPublicKeyFileName) throws PGPException, java.io.IOException
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"); }
publicKeyFileName
- Target public key file name (absolute or relative path)privateKeyFileName
- Corresponding private key fileprivateKeyPassword
- private key passwordrevokerPublicKeyFileName
- Key file that will be a designated revoker (absolute or relative path)
PGPException
java.io.IOException
revokeKeyWithDesignatedRevoker(String, String, String, byte, String)
public void assignDesignatedRevoker(KeyStore keyStore, long keyId, java.lang.String privateKeyPassword, long revokerKeyId) throws PGPException, java.io.IOException
keyStore
- KeyStore containing the keyskeyId
- Key ID of the key that authorizes the designated revokerprivateKeyPassword
- private key password of the key that authorizes the designated revokerrevokerKeyId
- Key ID of the designated revoker
PGPException
java.io.IOException
revokeKeyWithDesignatedRevoker(KeyStore, long, long, String, byte, String)
public void assignDesignatedRevoker(KeyStore keyStore, java.lang.String userId, java.lang.String privateKeyPassword, java.lang.String revokerUserId) throws PGPException, java.io.IOException
keyStore
- KeyStore containing the keysuserId
- User ID of the key that authorizes the designated revokerprivateKeyPassword
- private key password of the key that authorizes the designated revokerrevokerUserId
- User ID of the designated revoker
PGPException
java.io.IOException
revokeKeyWithDesignatedRevoker(KeyStore, String, String, String, byte, String)
public void revokeKeyWithRevocationCertificateText(java.lang.String publicKeyFileName, java.lang.String certificateText) throws java.io.IOException, PGPException
publicKeyFileName
- file name containing the target OpenPGP key (absolute or relative path)certificateText
- revocation certificate in ASCII armored string format
java.io.IOException
- if there is a problem reading the public key file
PGPException
- if the revocation certificate is not applicable for this key ringcreateRevocationCertificateText(String, String, byte, String)
public void revokeKeyWithRevocationCertificateText(KeyStore keyStore, java.lang.String certificateText) throws PGPException
keyStore
- KeyStore instance containing the target OpenPGP keycertificateText
- revocation certificate in ASCII armored string format
PGPException
- If no key was found that matches the issuer key ID recorded in this revocation certificate#createRevocationCertificate(String, String, byte, String)
public void revokeKeyWithRevocationCertificateFile(java.lang.String publicKeyFileName, java.lang.String certificateFileName) throws java.io.IOException, PGPException
publicKeyFileName
- file name containing the target OpenPGP key (absolute or relative path)certificateFileName
- revocation certificate file name (absolute or relative path)
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 certificatecreateRevocationCertificateInFile(String, String, byte, String, String)
public void revokeKeyWithRevocationCertificateFile(KeyStore keyStore, java.lang.String certificateFileName) throws java.io.IOException, PGPException
keyStore
- KeyStore containing the target OpenPGP keycertificateFileName
- revocation certificate file name (absolute or relative path)
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 certificatecreateRevocationCertificateInFile(String, String, byte, String, String)
public void revokeKey(KeyStore keyStore, long keyId, java.lang.String privateKeyPassword, byte reason, java.lang.String description) throws PGPException
keyStore
- KeyStore object containing the key to be revokedkeyId
- Key ID of the key or sub key to be revokedprivateKeyPassword
- private key password of the key to be revokedreason
- revocation reason code (use the REASON_ constants in this class)description
- revocation description (plain text)
PGPException
public void revokeKey(KeyStore keyStore, java.lang.String userId, java.lang.String privateKeyPassword, byte reason, java.lang.String description) throws PGPException
keyStore
- KeyStore object containing the key to be revokeduserId
- User ID of the key or sub key to be revokedprivateKeyPassword
- private key password of the key to be revokedreason
- revocation reason code (use the REASON_ constants in this class)description
- revocation description
PGPException
- Bug in the library.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
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"); }
publicKeyFileName
- public key file that will be revoked (absolute or relative path)privateKeyFileName
- corresponding private key file (absolute or relative path) privateKeyPassword
- private key passwordreason
- revocation reason code (use the REASON_ constants in this class)description
- revocation description
java.io.IOException
- If there is a problem reading or writing the key files
PGPException
- Bug in the library.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
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"); }
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) privateKeyPassword
- private key passworduserId
- User Id to be revokedreason
- revocation reason code (use the REASON_ constants in this class)description
- revocation description
java.io.IOException
- If there is a problem reading or writing the key files
PGPException
- Bug in the librarypublic void revokeUserIdSignature(KeyStore keyStore, long keyId, java.lang.String userId, java.lang.String privateKeyPassword, byte reason, java.lang.String description) throws PGPException
keyStore
- KeyStore holding the public keykeyId
- Key ID of the key with the signatureuserId
- User ID signature to be revokedprivateKeyPassword
- private key password of this keyreason
- revocation reason code (use the REASON_ constants in this class)description
- revocation description
PGPException
- Bug in the libraryrevokeUserIdSignature(KeyStore, String, String, byte, String)
public void revokeUserIdSignature(KeyStore keyStore, java.lang.String userId, java.lang.String privateKeyPassword, byte reason, java.lang.String description) throws PGPException
revokeUserIdSignature(KeyStore, long, String, String, byte, String)
instead
keyStore
- KeyStore holding the public keyuserId
- User ID signature to be revokedprivateKeyPassword
- private key password of this keyreason
- revocation reason codedescription
- revocation description (plain text)
PGPException
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
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"); }
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 passwordreason
- revocation reason code (use the REASON_ constants in this class)description
- revocation description
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 filesassignDesignatedRevoker(String, String, String, String)
public void revokeKeyWithDesignatedRevoker(KeyStore keyStore, long keyId, long revokerKeyId, java.lang.String revokerPassword, byte reason, java.lang.String description) throws PGPException
keyStore
- KeyStore containing the keyskeyId
- Key ID of the public key to be revokedrevokerKeyId
- designated revoker key IDrevokerPassword
- designated revoker secret key passwordreason
- revocation reason codedescription
- revocation description
PGPException
- If the specified designated revoker key has not been assigned as such for this keyassignDesignatedRevoker(KeyStore, long, String, long)
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
keyStore
- KeyStore containing the keysuserId
- User ID of the public key to be revokedrevokerUserId
- designated revoker key User IDrevokerPassword
- designated revoker secret key passwordreason
- revocation reason codedescription
- revocation description (plain text)
PGPException
assignDesignatedRevoker(String, String, String, String)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |