Example usage for org.bouncycastle.bcpg SignatureSubpacketTags CREATION_TIME

List of usage examples for org.bouncycastle.bcpg SignatureSubpacketTags CREATION_TIME

Introduction

In this page you can find the example usage for org.bouncycastle.bcpg SignatureSubpacketTags CREATION_TIME.

Prototype

int CREATION_TIME

To view the source code for org.bouncycastle.bcpg SignatureSubpacketTags CREATION_TIME.

Click Source Link

Usage

From source file:com.google.e2e.bcdriver.KeyChecker.java

License:Apache License

private static final long getSignatureTimestamp(PGPSignature sig, StringBuilder errors) {
    long ts = sig.getCreationTime().getTime();
    // Work-around bouncycastle not indicating lack of timestamp as a
    // hashed subpacket.
    if (sig.getVersion() == 4) {
        // Make sure we actually have a timestamp packet in
        // the hashed section.
        PGPSignatureSubpacketVector svec = sig.getHashedSubPackets();
        if (svec == null) {
            errors.append(niceSig(sig) + " is missing a creation timestamp.\n");
            return -1L;
        }//from  w  w w . j  a va 2 s .  c  o  m
        SignatureCreationTime tspack = (SignatureCreationTime) svec
                .getSubpacket(SignatureSubpacketTags.CREATION_TIME);
        if (tspack == null) {
            errors.append(niceSig(sig) + " is missing a creation timestamp.\n");
            return -1L;
        }
        ts = tspack.getTime().getTime();
    }
    return ts;
}