org.rdfcontext.signing
Class PGPKeyMaster

java.lang.Object
  extended byorg.rdfcontext.signing.PGPKeyMaster

public class PGPKeyMaster
extends java.lang.Object

This class generates a PGP key pair

Author:
Fabio Panaioli

Constructor Summary
PGPKeyMaster(java.lang.String pgpUserId, java.lang.String passphrase)
          It generates a secret and public key ring.
 
Method Summary
 java.io.InputStream getPublicKey(boolean armoured)
           
 java.io.InputStream getSecretKey(boolean armoured)
           
 void writePublicToFile(java.lang.String path, boolean armoured)
           
 void writeSecretToFile(java.lang.String path, boolean armoured)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PGPKeyMaster

public PGPKeyMaster(java.lang.String pgpUserId,
                    java.lang.String passphrase)
             throws java.security.NoSuchAlgorithmException,
                    java.security.NoSuchProviderException,
                    org.bouncycastle.openpgp.PGPException,
                    java.io.IOException
It generates a secret and public key ring.

Parameters:
pgpUserId - - userID of the PGP keys
passphrase - - the passphrase for to encrypt the local secret keyring
Throws:
java.security.NoSuchAlgorithmException
java.security.NoSuchProviderException
org.bouncycastle.openpgp.PGPException
java.io.IOException
Method Detail

getSecretKey

public java.io.InputStream getSecretKey(boolean armoured)
                                 throws java.io.IOException
Returns:
a binary input stream rappresentation of secret key ring
Throws:
java.io.IOException

getPublicKey

public java.io.InputStream getPublicKey(boolean armoured)
                                 throws java.io.IOException
Parameters:
armoured - - if true return a base 64 armoured rappresentation a binary otherwise
Returns:
a input stream rappresentation of public key ring
Throws:
java.io.IOException

writeSecretToFile

public void writeSecretToFile(java.lang.String path,
                              boolean armoured)
                       throws java.io.IOException
Parameters:
path - - the absolute path of the file
armoured - - true if you want Base64 armored objects, false otherwise
Throws:
java.io.IOException

writePublicToFile

public void writePublicToFile(java.lang.String path,
                              boolean armoured)
                       throws java.io.IOException
Parameters:
path - - the absolute path of the file
armoured - - true if you want Base64 armored objects, false otherwise
Throws:
java.io.IOException