ReadOptionalTrustPacket() static private method

static private ReadOptionalTrustPacket ( BcpgInputStream bcpgInput ) : TrustPacket
bcpgInput BcpgInputStream
return TrustPacket
示例#1
0
        internal static PgpPublicKey ReadSubkey(BcpgInputStream bcpgInput)
        {
            PublicKeyPacket publicPk = (PublicKeyPacket)bcpgInput.ReadPacket();
            TrustPacket     trustPk  = PgpKeyRing.ReadOptionalTrustPacket(bcpgInput);

            global::System.Collections.IList sigs = PgpKeyRing.ReadSignaturesAndTrust(bcpgInput);
            return(new PgpPublicKey(publicPk, trustPk, sigs));
        }
示例#2
0
        }        //IL_0002: Unknown result type (might be due to invalid IL or missing references)

        //IL_000c: Expected O, but got Unknown


        public PgpSecretKeyRing(Stream inputStream)
        {
            //IL_004b: Unknown result type (might be due to invalid IL or missing references)
            keys         = Platform.CreateArrayList();
            extraPubKeys = Platform.CreateArrayList();
            BcpgInputStream bcpgInputStream = BcpgInputStream.Wrap(inputStream);
            PacketTag       packetTag       = bcpgInputStream.NextPacketTag();

            if (packetTag != PacketTag.SecretKey && packetTag != PacketTag.SecretSubkey)
            {
                int num = (int)packetTag;
                throw new IOException("secret key ring doesn't start with secret key tag: tag 0x" + num.ToString("X"));
            }
            SecretKeyPacket secretKeyPacket = (SecretKeyPacket)bcpgInputStream.ReadPacket();

            while (bcpgInputStream.NextPacketTag() == PacketTag.Experimental2)
            {
                bcpgInputStream.ReadPacket();
            }
            TrustPacket trustPk = PgpKeyRing.ReadOptionalTrustPacket(bcpgInputStream);

            global::System.Collections.IList keySigs = PgpKeyRing.ReadSignaturesAndTrust(bcpgInputStream);
            PgpKeyRing.ReadUserIDs(bcpgInputStream, out var ids, out var idTrusts, out var idSigs);
            keys.Add((object)new PgpSecretKey(secretKeyPacket, new PgpPublicKey(secretKeyPacket.PublicKeyPacket, trustPk, keySigs, ids, idTrusts, idSigs)));
            while (bcpgInputStream.NextPacketTag() == PacketTag.SecretSubkey || bcpgInputStream.NextPacketTag() == PacketTag.PublicSubkey)
            {
                if (bcpgInputStream.NextPacketTag() == PacketTag.SecretSubkey)
                {
                    SecretSubkeyPacket secretSubkeyPacket = (SecretSubkeyPacket)bcpgInputStream.ReadPacket();
                    while (bcpgInputStream.NextPacketTag() == PacketTag.Experimental2)
                    {
                        bcpgInputStream.ReadPacket();
                    }
                    TrustPacket trustPk2 = PgpKeyRing.ReadOptionalTrustPacket(bcpgInputStream);
                    global::System.Collections.IList sigs = PgpKeyRing.ReadSignaturesAndTrust(bcpgInputStream);
                    keys.Add((object)new PgpSecretKey(secretSubkeyPacket, new PgpPublicKey(secretSubkeyPacket.PublicKeyPacket, trustPk2, sigs)));
                }
                else
                {
                    PublicSubkeyPacket publicPk            = (PublicSubkeyPacket)bcpgInputStream.ReadPacket();
                    TrustPacket        trustPk3            = PgpKeyRing.ReadOptionalTrustPacket(bcpgInputStream);
                    global::System.Collections.IList sigs2 = PgpKeyRing.ReadSignaturesAndTrust(bcpgInputStream);
                    extraPubKeys.Add((object)new PgpPublicKey(publicPk, trustPk3, sigs2));
                }
            }
        }
示例#3
0
        public PgpPublicKeyRing(Stream inputStream)
        {
            //IL_0041: Unknown result type (might be due to invalid IL or missing references)
            keys = Platform.CreateArrayList();
            BcpgInputStream bcpgInputStream = BcpgInputStream.Wrap(inputStream);
            PacketTag       packetTag       = bcpgInputStream.NextPacketTag();

            if (packetTag != PacketTag.PublicKey && packetTag != PacketTag.PublicSubkey)
            {
                int num = (int)packetTag;
                throw new IOException("public key ring doesn't start with public key tag: tag 0x" + num.ToString("X"));
            }
            PublicKeyPacket publicPk = (PublicKeyPacket)bcpgInputStream.ReadPacket();
            TrustPacket     trustPk  = PgpKeyRing.ReadOptionalTrustPacket(bcpgInputStream);

            global::System.Collections.IList keySigs = PgpKeyRing.ReadSignaturesAndTrust(bcpgInputStream);
            PgpKeyRing.ReadUserIDs(bcpgInputStream, out var ids, out var idTrusts, out var idSigs);
            keys.Add((object)new PgpPublicKey(publicPk, trustPk, keySigs, ids, idTrusts, idSigs));
            while (bcpgInputStream.NextPacketTag() == PacketTag.PublicSubkey)
            {
                keys.Add((object)ReadSubkey(bcpgInputStream));
            }
        }