Example usage for org.bouncycastle.bcpg.sig RevocationReasonTags NO_REASON

List of usage examples for org.bouncycastle.bcpg.sig RevocationReasonTags NO_REASON

Introduction

In this page you can find the example usage for org.bouncycastle.bcpg.sig RevocationReasonTags NO_REASON.

Prototype

byte NO_REASON

To view the source code for org.bouncycastle.bcpg.sig RevocationReasonTags NO_REASON.

Click Source Link

Usage

From source file:org.sufficientlysecure.keychain.pgp.PgpKeyOperation.java

License:Open Source License

private static PGPSignature generateRevocationSignature(PGPSignatureGenerator sGen, Date creationTime,
        PGPPrivateKey masterPrivateKey, PGPPublicKey pKey, String userId)

        throws IOException, PGPException, SignatureException {
    PGPSignatureSubpacketGenerator subHashedPacketsGen = new PGPSignatureSubpacketGenerator();
    // we use the tag NO_REASON since gnupg does not care about the tag while verifying
    // signatures with a revoked key, the warning is the same
    subHashedPacketsGen.setRevocationReason(true, RevocationReasonTags.NO_REASON, "");
    subHashedPacketsGen.setSignatureCreationTime(true, creationTime);
    sGen.setHashedSubpackets(subHashedPacketsGen.generate());
    sGen.init(PGPSignature.CERTIFICATION_REVOCATION, masterPrivateKey);
    return sGen.generateCertification(userId, pKey);
}

From source file:org.sufficientlysecure.keychain.pgp.PgpKeyOperation.java

License:Open Source License

private static PGPSignature generateRevocationSignature(PGPSignatureGenerator sGen, Date creationTime,
        PGPPublicKey masterPublicKey, PGPPrivateKey masterPrivateKey, PGPPublicKey pKey)
        throws IOException, PGPException, SignatureException {

    PGPSignatureSubpacketGenerator subHashedPacketsGen = new PGPSignatureSubpacketGenerator();
    // we use the tag NO_REASON since gnupg does not care about the tag while verifying
    // signatures with a revoked key, the warning is the same
    subHashedPacketsGen.setRevocationReason(true, RevocationReasonTags.NO_REASON, "");
    subHashedPacketsGen.setSignatureCreationTime(true, creationTime);
    sGen.setHashedSubpackets(subHashedPacketsGen.generate());
    // Generate key revocation or subkey revocation, depending on master/subkey-ness
    if (masterPublicKey.getKeyID() == pKey.getKeyID()) {
        sGen.init(PGPSignature.KEY_REVOCATION, masterPrivateKey);
        return sGen.generateCertification(masterPublicKey);
    } else {/*from  w  w  w . j  a v a 2 s . co  m*/
        sGen.init(PGPSignature.SUBKEY_REVOCATION, masterPrivateKey);
        return sGen.generateCertification(masterPublicKey, pKey);
    }
}