HasSubpacket() public method

public HasSubpacket ( SignatureSubpacketTag type ) : bool
type SignatureSubpacketTag
return bool
Example #1
0
        private long GetExpirationTimeFromSig(bool selfSigned, int signatureType)
        {
            long expiryTime = -1;
            long lastDate   = -1;

            foreach (PgpSignature sig in GetSignaturesOfType(signatureType))
            {
                if (selfSigned && sig.KeyId != this.KeyId)
                {
                    continue;
                }

                PgpSignatureSubpacketVector hashed = sig.GetHashedSubPackets();
                if (hashed == null)
                {
                    continue;
                }

                if (!hashed.HasSubpacket(SignatureSubpacketTag.KeyExpireTime))
                {
                    continue;
                }

                long current = hashed.GetKeyExpirationTime();

                if (sig.KeyId == this.KeyId)
                {
                    if (sig.CreationTime.Ticks > lastDate)
                    {
                        lastDate   = sig.CreationTime.Ticks;
                        expiryTime = current;
                    }
                }
                else if (current == 0 || current > expiryTime)
                {
                    expiryTime = current;
                }
            }

            return(expiryTime);
        }