Example usage for org.bouncycastle.bcpg.sig SignatureCreationTime getTime

List of usage examples for org.bouncycastle.bcpg.sig SignatureCreationTime getTime

Introduction

In this page you can find the example usage for org.bouncycastle.bcpg.sig SignatureCreationTime getTime.

Prototype

public Date getTime() 

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;
        }/*  ww w.j  a v a  2s  . c  om*/
        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;
}