|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.didisoft.pgp.KeyPairInformation
public class KeyPairInformation
Represents an OpenPGP key pair.
Constructor Summary | |
---|---|
KeyPairInformation()
|
Method Summary | |
---|---|
void |
exportKeyRing(java.lang.String fileName,
boolean asciiArmored)
Exports the key pair (both the public and the private key if available) located in this object in one file. |
void |
exportPrivateKey(java.lang.String fileName,
boolean asciiArmored)
Exports the private key part of this key pair into a file. |
void |
exportPublicKey(java.lang.String fileName,
boolean asciiArmored)
Exports the public key part of this key pair into a file. |
java.lang.String |
getAlgorithm()
Returns the name of the key encryption asymmetric algorithm. |
java.util.Date |
getCreationTime()
Returns when was the key created. |
java.lang.String |
getFingerprint()
Returns the key fingerprint as string. |
long |
getKeyID()
Returns the Key ID of this key pair. |
java.lang.String |
getKeyIDHex()
Returns a string representing the hexadecimal value of the Key ID. |
int |
getKeySize()
Returns key size in bits. |
com.didisoft.pgp.KeyPairInformation.SubKey[] |
getPrivateSubKeys()
Returns an array from all private sub keys. |
com.didisoft.pgp.KeyPairInformation.SubKey[] |
getPublicSubKeys()
Returns an array from all public sub keys. |
PGPSecretKeyRing |
getRawPrivateKeyRing()
Returns the Private key ring part of this Key Pair. |
PGPPublicKeyRing |
getRawPublicKeyRing()
Returns the Public key ring part of this Key Pair |
java.lang.String[] |
getUserIDs()
Returns User Id's associated with this key. |
int |
getValidDays()
Returns key validity period in days. |
int |
getVersion()
Returns key format OpenPGP version. |
boolean |
isEncryptionKey()
Returns true if this key can be used for encryption, otherwise false |
boolean |
isRevoked()
Returns is this Key revoked (not usable any more). |
boolean |
isSigningKey()
Returns is this Key used for signing data. |
void |
setPrivateKeyRing(PGPSecretKeyRing secRing)
Sets the Private key ring part of this Key Pair. |
void |
setPublicKeyRing(PGPPublicKeyRing pubRing)
Sets the Public key ring part of this Key Pair. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public KeyPairInformation()
Method Detail |
---|
public void setPublicKeyRing(PGPPublicKeyRing pubRing)
KeyStore.getKeys()
)
public void setPrivateKeyRing(PGPSecretKeyRing secRing)
KeyStore.getKeys()
)
public com.didisoft.pgp.KeyPairInformation.SubKey[] getPublicSubKeys()
public com.didisoft.pgp.KeyPairInformation.SubKey[] getPrivateSubKeys()
public boolean isRevoked()
public boolean isEncryptionKey()
public boolean isSigningKey()
public PGPPublicKeyRing getRawPublicKeyRing()
public PGPSecretKeyRing getRawPrivateKeyRing()
public long getKeyID()
public java.lang.String getKeyIDHex()
public java.lang.String getFingerprint()
public java.lang.String[] getUserIDs()
public int getKeySize()
public java.lang.String getAlgorithm()
public java.util.Date getCreationTime()
public int getValidDays()
public int getVersion()
public void exportPublicKey(java.lang.String fileName, boolean asciiArmored) throws java.io.IOException
import com.didisoft.pgp.PGPKeyPair; public class ExportPublicKeyDemo { public static void main(String[] args) throws Exception{ // initialize the key object PGPKeyPair key = new PGPKeyPair("my_key.pgp"); // should the exported key be in ASCII form (true), or binary (false) boolean asciiArmored = true; // export the public key key.exportPublicKey("my_public_key.asc", asciiArmored); } }
fileName
- File name where the public key will be exported (absolute or relative path)asciiArmored
- if true, out is ASCII armored, when false binary file format is used.
java.io.IOException
- if an I/O error occurs.public void exportPrivateKey(java.lang.String fileName, boolean asciiArmored) throws NoPrivateKeyFoundException, java.io.IOException
import com.didisoft.pgp.PGPKeyPair; public class ExportPrivateKeyDemo { public static void main(String[] args) throws Exception{ // initialize the key object PGPKeyPair key = new PGPKeyPair("my_key.pgp"); // should the exported key be in ASCII form (true), or binary (false) boolean asciiArmored = true; // export the private key key.exportPrivateKey("my_private_key.asc", asciiArmored); } }
fileName
- File name where the public key will be exported (absolute or relative path)asciiArmored
- if true, out is ASCII armored, when false binary file format is used.
NoPrivateKeyFoundException
- if there is no private key loaded in this key pair object
java.io.IOException
- if an I/O error occurs.public void exportKeyRing(java.lang.String fileName, boolean asciiArmored) throws java.io.IOException
import com.didisoft.pgp.PGPKeyPair; public class ExportKeyPairDemo { public static void main(String[] args) throws Exception{ // initialize the key store PGPKeyPair key = new PGPKeyPair("my_key.pgp"); // export the key pair keyStore.exportKeyRing("keypair.asc"); } }
fileName
- File name where the key pair will be exported (absolute or relative path)
java.io.IOException
- I/O error saving the key ring
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |