internal static void ReadUserIDs(BcpgInputStream bcpgInput, out IList ids, out IList<ITrustPacket> idTrusts, out IList<IList<IPgpSignature>> idSigs)
        {
            ids = Platform.CreateArrayList();
            idTrusts = Platform.CreateArrayList<ITrustPacket>();
            idSigs = Platform.CreateArrayList<IList<IPgpSignature>>();

            while (bcpgInput.NextPacketTag() == PacketTag.UserId
                || bcpgInput.NextPacketTag() == PacketTag.UserAttribute)
            {
                var obj = bcpgInput.ReadPacket();
                var userIdPacket = obj as UserIdPacket;
                if (userIdPacket != null)
                {
                    ids.Add(userIdPacket.GetId());
                }
                else
                {
                    var user = (UserAttributePacket)obj;
                    ids.Add(new PgpUserAttributeSubpacketVector(user.GetSubpackets()));
                }

                idTrusts.Add(ReadOptionalTrustPacket(bcpgInput));

                idSigs.Add(ReadSignaturesAndTrust(bcpgInput));
            }
        }
示例#2
0
		internal static TrustPacket ReadOptionalTrustPacket(
			BcpgInputStream bcpgInput)
		{
			return (bcpgInput.NextPacketTag() == PacketTag.Trust)
				?	(TrustPacket) bcpgInput.ReadPacket()
				:	null;
		}
 internal ExperimentalPacket(
     PacketTag		tag,
     BcpgInputStream	bcpgIn)
 {
     _tag = tag;
     _contents = bcpgIn.ReadAll();
 }
示例#4
0
		internal static void ReadUserIDs(
			BcpgInputStream	bcpgInput,
			out IList       ids,
			out IList       idTrusts,
			out IList       idSigs)
		{
			ids = Platform.CreateArrayList();
            idTrusts = Platform.CreateArrayList();
            idSigs = Platform.CreateArrayList();

			while (bcpgInput.NextPacketTag() == PacketTag.UserId
				|| bcpgInput.NextPacketTag() == PacketTag.UserAttribute)
			{
				Packet obj = bcpgInput.ReadPacket();
				if (obj is UserIdPacket)
				{
					UserIdPacket id = (UserIdPacket)obj;
					ids.Add(id.GetId());
				}
				else
				{
					UserAttributePacket user = (UserAttributePacket) obj;
					ids.Add(new PgpUserAttributeSubpacketVector(user.GetSubpackets()));
				}

				idTrusts.Add(
					ReadOptionalTrustPacket(bcpgInput));

				idSigs.Add(
					ReadSignaturesAndTrust(bcpgInput));
			}
		}
示例#5
0
		internal static void ReadUserIDs(
			BcpgInputStream	bcpgInput,
			out IList       ids,
			out IList       idTrusts,
			out IList       idSigs)
		{
			ids = Platform.CreateArrayList();
            idTrusts = Platform.CreateArrayList();
            idSigs = Platform.CreateArrayList();

			// EDDINGTON
			try
			{
				while (bcpgInput.NextPacketTag() == PacketTag.UserId
					|| bcpgInput.NextPacketTag() == PacketTag.UserAttribute)
				{
					Packet obj = bcpgInput.ReadPacket();
					if (obj is UserIdPacket)
					{
						UserIdPacket id = (UserIdPacket)obj;
						ids.Add(id.GetId());
					}
					else
					{
						UserAttributePacket user = (UserAttributePacket) obj;
						ids.Add(new PgpUserAttributeSubpacketVector(user.GetSubpackets()));
					}

					idTrusts.Add(
						ReadOptionalTrustPacket(bcpgInput));

					idSigs.Add(
						ReadSignaturesAndTrust(bcpgInput));
				}
			}
			catch (Exception ex)
			{
				// EDDINGTON
				logger.Debug("ReadUserIDs: Exception occured: {0}", ex.Message);
				foreach (var id in ids)
				{
					var sid = id.ToString();
					if (id is UserIdPacket)
						sid = ((UserIdPacket)id).GetId();

					logger.Debug("ReadUserIDs: ID: {0}", sid);
				}

				throw;
			}
		}
        internal static IList<IPgpSignature> ReadSignaturesAndTrust(BcpgInputStream bcpgInput)
        {
            try
            {
                var sigList = Platform.CreateArrayList<IPgpSignature>();

                while (bcpgInput.NextPacketTag() == PacketTag.Signature)
                {
                    var signaturePacket = (SignaturePacket)bcpgInput.ReadPacket();
                    var trustPacket = ReadOptionalTrustPacket(bcpgInput);

                    sigList.Add(new PgpSignature(signaturePacket, trustPacket));
                }

                return sigList;
            }
            catch (PgpException e)
            {
                throw new IOException("can't create signature object: " + e.Message, e);
            }
        }
		public PgpEncryptedDataList(
            BcpgInputStream bcpgInput)
        {
            while (bcpgInput.NextPacketTag() == PacketTag.PublicKeyEncryptedSession
                || bcpgInput.NextPacketTag() == PacketTag.SymmetricKeyEncryptedSessionKey)
            {
                list.Add(bcpgInput.ReadPacket());
            }

			data = (InputStreamPacket)bcpgInput.ReadPacket();

			for (int i = 0; i != list.Count; i++)
            {
                if (list[i] is SymmetricKeyEncSessionPacket)
                {
                    list[i] = new PgpPbeEncryptedData((SymmetricKeyEncSessionPacket) list[i], data);
                }
                else
                {
                    list[i] = new PgpPublicKeyEncryptedData((PublicKeyEncSessionPacket) list[i], data);
                }
            }
        }
		public InputStreamPacket(
            BcpgInputStream bcpgIn)
        {
            this.bcpgIn = bcpgIn;
        }
示例#9
0
		public PgpCompressedData(
            BcpgInputStream bcpgInput)
        {
            data = (CompressedDataPacket) bcpgInput.ReadPacket();
        }
        internal static PgpPublicKey ReadSubkey(BcpgInputStream bcpgInput)
        {
            PublicKeyPacket	pk = (PublicKeyPacket) bcpgInput.ReadPacket();
            TrustPacket kTrust = ReadOptionalTrustPacket(bcpgInput);

            // PGP 8 actually leaves out the signature.
            IList sigList = ReadSignaturesAndTrust(bcpgInput);

            return new PgpPublicKey(pk, kTrust, sigList);
        }
		public PgpObjectFactory(
            Stream inputStream)
        {
            this.bcpgIn = BcpgInputStream.Wrap(inputStream);
        }
示例#12
0
 private ECPrivateKeyParameters GetECKey(string algorithm, BcpgInputStream bcpgIn)
 {
     ECPublicBcpgKey ecdsaPub = (ECPublicBcpgKey)secret.PublicKeyPacket.Key;
     ECSecretBcpgKey ecdsaPriv = new ECSecretBcpgKey(bcpgIn);
     return new ECPrivateKeyParameters(algorithm, ecdsaPriv.X, ecdsaPub.CurveOid);
 }
示例#13
0
		private byte	lastb; // Initial value anything but '\r'

		internal PgpSignature(
            BcpgInputStream bcpgInput)
            : this((SignaturePacket)bcpgInput.ReadPacket())
        {
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="SecretSubkeyPacket"/> class.
 /// </summary>
 /// <param name="bcpgIn">The BCPG in.</param>
 internal SecretSubkeyPacket(BcpgInputStream bcpgIn)
     : base(bcpgIn)
 {
 }
 internal SymmetricEncIntegrityPacket(BcpgInputStream bcpgIn)
     : base(bcpgIn)
 {
     this.Version = bcpgIn.ReadByte();
 }
示例#16
0
		public PgpMarker(
            BcpgInputStream bcpgIn)
        {
            p = (MarkerPacket) bcpgIn.ReadPacket();
        }
 public InputStreamPacket(BcpgInputStream bcpgIn)
 {
     _bcpgIn = bcpgIn;
 }
示例#18
0
		public PgpLiteralData(
            BcpgInputStream bcpgInput)
        {
            data = (LiteralDataPacket) bcpgInput.ReadPacket();
        }
示例#19
0
		public PgpExperimental(
			BcpgInputStream bcpgIn)
		{
			p = (ExperimentalPacket) bcpgIn.ReadPacket();
		}