org.freecompany.redline
Class SignatureGenerator

java.lang.Object
  extended by org.freecompany.redline.SignatureGenerator

public class SignatureGenerator
extends Object

Generates PGP signatures for NIO channels


Field Summary
protected  boolean enabled
           
protected  ChannelWrapper.Key<byte[]> headerAndPayloadKey
           
protected  AbstractHeader.Entry<byte[]> headerAndPayloadPGPEntry
           
protected  ChannelWrapper.Key<byte[]> headerOnlyKey
           
protected  AbstractHeader.Entry<byte[]> headerOnlyRSAEntry
           
protected  org.bouncycastle.openpgp.PGPPrivateKey privateKey
           
protected static int SIGNATURE_SIZE
           
 
Constructor Summary
SignatureGenerator(File privateKeyRingFile, String privateKeyId, String privateKeyPassphrase)
           
SignatureGenerator(org.bouncycastle.openpgp.PGPPrivateKey privateKey)
           
 
Method Summary
protected  void checkEntry(AbstractHeader.Entry<byte[]> entry)
           
protected  void checkKey(ChannelWrapper.Key<byte[]> key)
           
protected  org.bouncycastle.openpgp.PGPPrivateKey extractPrivateKey(org.bouncycastle.openpgp.PGPSecretKey secretKey, String privateKeyPassphrase)
           
protected  org.bouncycastle.openpgp.PGPSecretKey findMatchingSecretKey(org.bouncycastle.openpgp.PGPSecretKeyRingCollection keyRings, String privateKeyId)
           
 void finishAfterHeader(WritableChannelWrapper output)
           
 void finishAfterPayload(WritableChannelWrapper output)
           
protected  void finishEntry(WritableChannelWrapper output, AbstractHeader.Entry<byte[]> entry, ChannelWrapper.Key<byte[]> key)
           
protected  int getAlgorithm()
           
 boolean isEnabled()
           
protected  boolean isMatchingKeyId(org.bouncycastle.openpgp.PGPSecretKey key, String privateKeyId)
           
 void prepare(Signature signature)
           
protected  org.bouncycastle.openpgp.PGPSecretKeyRingCollection readKeyRings(File privateKeyRingFile)
           
 void startBeforeHeader(WritableChannelWrapper output)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SIGNATURE_SIZE

protected static final int SIGNATURE_SIZE
See Also:
Constant Field Values

enabled

protected final boolean enabled

headerOnlyRSAEntry

protected AbstractHeader.Entry<byte[]> headerOnlyRSAEntry

headerAndPayloadPGPEntry

protected AbstractHeader.Entry<byte[]> headerAndPayloadPGPEntry

privateKey

protected final org.bouncycastle.openpgp.PGPPrivateKey privateKey

headerOnlyKey

protected ChannelWrapper.Key<byte[]> headerOnlyKey

headerAndPayloadKey

protected ChannelWrapper.Key<byte[]> headerAndPayloadKey
Constructor Detail

SignatureGenerator

public SignatureGenerator(org.bouncycastle.openpgp.PGPPrivateKey privateKey)

SignatureGenerator

public SignatureGenerator(File privateKeyRingFile,
                          String privateKeyId,
                          String privateKeyPassphrase)
Method Detail

prepare

public void prepare(Signature signature)

startBeforeHeader

public void startBeforeHeader(WritableChannelWrapper output)

finishAfterHeader

public void finishAfterHeader(WritableChannelWrapper output)

finishAfterPayload

public void finishAfterPayload(WritableChannelWrapper output)

readKeyRings

protected org.bouncycastle.openpgp.PGPSecretKeyRingCollection readKeyRings(File privateKeyRingFile)

findMatchingSecretKey

protected org.bouncycastle.openpgp.PGPSecretKey findMatchingSecretKey(org.bouncycastle.openpgp.PGPSecretKeyRingCollection keyRings,
                                                                      String privateKeyId)

isMatchingKeyId

protected boolean isMatchingKeyId(org.bouncycastle.openpgp.PGPSecretKey key,
                                  String privateKeyId)

extractPrivateKey

protected org.bouncycastle.openpgp.PGPPrivateKey extractPrivateKey(org.bouncycastle.openpgp.PGPSecretKey secretKey,
                                                                   String privateKeyPassphrase)

finishEntry

protected void finishEntry(WritableChannelWrapper output,
                           AbstractHeader.Entry<byte[]> entry,
                           ChannelWrapper.Key<byte[]> key)

checkEntry

protected void checkEntry(AbstractHeader.Entry<byte[]> entry)

checkKey

protected void checkKey(ChannelWrapper.Key<byte[]> key)

isEnabled

public boolean isEnabled()

getAlgorithm

protected int getAlgorithm()


Copyright © 2014. All Rights Reserved.