Пример #1
0
        // internal AND protected
        internal override GpgInterfaceResult ProcessLine(String line)
        {
            if (!GNUCheck(ref line))
            {
                return(GpgInterfaceResult.Success);
            }

            switch (GetKeyword(ref line))
            {
            case GpgKeyword.GOODSIG:
            {
                IsSigned        = true;
                IsGoodSignature = true;
                SignatureKeyId  = new KeyId(line.Split(' ')[0]);
                break;
            }

            case GpgKeyword.BADSIG:
            {
                IsSigned        = true;
                IsGoodSignature = false;
                SignatureKeyId  = new KeyId(line.Split(' ')[0]);
                break;
            }

            case GpgKeyword.VALIDSIG:
            {
                String[] parts = line.Split(' ');

                String datetime = parts[2];
                if (datetime.Contains("T"))
                {
                    // ISO 8601
                    SignatureDateTime = DateTime.ParseExact(datetime, "s", CultureInfo.InvariantCulture);
                }
                else
                {
                    SignatureDateTime = Utils.ConvertTimestamp(Double.Parse(datetime, CultureInfo.InvariantCulture));
                }

                break;
            }

            case GpgKeyword.TRUST_UNDEFINED:
            case GpgKeyword.TRUST_NEVER:
            {
                SignatureTrust = KeyOwnerTrust.None;
                break;
            }

            case GpgKeyword.TRUST_MARGINAL:
            {
                SignatureTrust = KeyOwnerTrust.Marginal;
                break;
            }

            case GpgKeyword.TRUST_FULLY:
            {
                SignatureTrust = KeyOwnerTrust.Full;
                break;
            }

            case GpgKeyword.TRUST_ULTIMATE:
            {
                SignatureTrust = KeyOwnerTrust.Ultimate;
                break;
            }
            }

            return(GpgInterfaceResult.Success);
        }