Created
March 16, 2012 15:57
-
-
Save kbsriram/2050672 to your computer and use it in GitHub Desktop.
anonymous keyid recipients
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.bouncycastle.openpgp.operator.bc.BcPublicKeyKeyEncryptionMethodGenerator; | |
import org.bouncycastle.openpgp.PGPPublicKey; | |
import org.bouncycastle.openpgp.PGPException; | |
import org.bouncycastle.bcpg.ContainedPacket; | |
import org.bouncycastle.bcpg.PublicKeyEncSessionPacket; | |
public class CAnonymousPublicKeyKeyEncryptionMethodGenerator | |
extends BcPublicKeyKeyEncryptionMethodGenerator | |
{ | |
public CAnonymousPublicKeyKeyEncryptionMethodGenerator(PGPPublicKey key) | |
{ | |
super(key); | |
m_pubkey = key; | |
} | |
// generate a wildcard keyid rather than embedding it into | |
// the content. | |
@Override | |
public ContainedPacket generate(int encAlg, byte[] sessionInfo) | |
throws PGPException | |
{ | |
return new PublicKeyEncSessionPacket | |
(0l, m_pubkey.getAlgorithm(), | |
processSessionInfo | |
(encryptSessionInfo | |
(m_pubkey, sessionInfo))); | |
} | |
private final PGPPublicKey m_pubkey; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment