public PgpSecretKeyRing(IPacketReader packetReader) { this.keys = new List <PgpSecretKey>(); this.extraPubKeys = new List <PgpPublicKey>(); PacketTag initialTag = packetReader.NextPacketTag(); if (initialTag != PacketTag.SecretKey && initialTag != PacketTag.SecretSubkey) { throw new PgpUnexpectedPacketException(); } SecretKeyPacket secret = (SecretKeyPacket)packetReader.ReadContainedPacket(); keys.Add(new PgpSecretKey(packetReader, secret, subKey: false)); // Read subkeys while (packetReader.NextPacketTag() == PacketTag.SecretSubkey || packetReader.NextPacketTag() == PacketTag.PublicSubkey) { if (packetReader.NextPacketTag() == PacketTag.SecretSubkey) { SecretSubkeyPacket sub = (SecretSubkeyPacket)packetReader.ReadContainedPacket(); keys.Add(new PgpSecretKey(packetReader, sub, subKey: true)); } else { PublicSubkeyPacket sub = (PublicSubkeyPacket)packetReader.ReadContainedPacket(); extraPubKeys.Add(new PgpPublicKey(packetReader, sub, subKey: true)); } } }
} //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)); } } }
public PgpSecretKeyRing(Stream inputStream) { 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); IList keySigs = PgpKeyRing.ReadSignaturesAndTrust(bcpgInputStream); PgpKeyRing.ReadUserIDs(bcpgInputStream, out IList ids, out IList idTrusts, out IList idSigs); keys.Add(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); IList sigs = PgpKeyRing.ReadSignaturesAndTrust(bcpgInputStream); keys.Add(new PgpSecretKey(secretSubkeyPacket, new PgpPublicKey(secretSubkeyPacket.PublicKeyPacket, trustPk2, sigs))); } else { PublicSubkeyPacket publicPk = (PublicSubkeyPacket)bcpgInputStream.ReadPacket(); TrustPacket trustPk3 = PgpKeyRing.ReadOptionalTrustPacket(bcpgInputStream); IList sigs2 = PgpKeyRing.ReadSignaturesAndTrust(bcpgInputStream); extraPubKeys.Add(new PgpPublicKey(publicPk, trustPk3, sigs2)); } } }
public PgpSecretKeyRing( Stream inputStream) { this.keys = Platform.CreateArrayList(); this.extraPubKeys = Platform.CreateArrayList(); BcpgInputStream bcpgInput = BcpgInputStream.Wrap(inputStream); PacketTag initialTag = bcpgInput.NextPacketTag(); if (initialTag != PacketTag.SecretKey && initialTag != PacketTag.SecretSubkey) { throw new IOException("secret key ring doesn't start with secret key tag: " + "tag 0x" + ((int)initialTag).ToString("X")); } SecretKeyPacket secret = (SecretKeyPacket)bcpgInput.ReadPacket(); // // ignore GPG comment packets if found. // while (bcpgInput.NextPacketTag() == PacketTag.Experimental2) { bcpgInput.ReadPacket(); } TrustPacket trust = ReadOptionalTrustPacket(bcpgInput); // revocation and direct signatures IList keySigs = ReadSignaturesAndTrust(bcpgInput); IList ids, idTrusts, idSigs; ReadUserIDs(bcpgInput, out ids, out idTrusts, out idSigs); keys.Add(new PgpSecretKey(secret, new PgpPublicKey(secret.PublicKeyPacket, trust, keySigs, ids, idTrusts, idSigs))); // Read subkeys while (bcpgInput.NextPacketTag() == PacketTag.SecretSubkey || bcpgInput.NextPacketTag() == PacketTag.PublicSubkey) { if (bcpgInput.NextPacketTag() == PacketTag.SecretSubkey) { SecretSubkeyPacket sub = (SecretSubkeyPacket)bcpgInput.ReadPacket(); // // ignore GPG comment packets if found. // while (bcpgInput.NextPacketTag() == PacketTag.Experimental2) { bcpgInput.ReadPacket(); } TrustPacket subTrust = ReadOptionalTrustPacket(bcpgInput); IList sigList = ReadSignaturesAndTrust(bcpgInput); keys.Add(new PgpSecretKey(sub, new PgpPublicKey(sub.PublicKeyPacket, subTrust, sigList))); } else { PublicSubkeyPacket sub = (PublicSubkeyPacket)bcpgInput.ReadPacket(); TrustPacket subTrust = ReadOptionalTrustPacket(bcpgInput); IList sigList = ReadSignaturesAndTrust(bcpgInput); extraPubKeys.Add(new PgpPublicKey(sub, subTrust, sigList)); } } }