WritePacket() public méthode

public WritePacket ( ContainedPacket p ) : void
p ContainedPacket
Résultat void
Exemple #1
0
        public byte[] GetEncoded()
        {
            MemoryStream bOut = new MemoryStream();
            BcpgOutputStream pOut = new BcpgOutputStream(bOut);

			pOut.WritePacket(this);

			return bOut.ToArray();
        }
 /// <summary>
 /// Gets the encoded version of this instance.
 /// </summary>
 /// <returns></returns>
 public byte[] GetEncoded()
 {
     using (var bOut = new MemoryStream())
     {
         using (var pOut = new BcpgOutputStream(bOut))
         {
             pOut.WritePacket(this);
             return bOut.ToArray();
         }
     }
 }
        public override void Encode(
            BcpgOutputStream bcpgOut)
        {
            MemoryStream bOut = new MemoryStream();

            for (int i = 0; i != subpackets.Length; i++)
            {
                subpackets[i].Encode(bOut);
            }

            bcpgOut.WritePacket(PacketTag.UserAttribute, bOut.ToArray(), false);
        }
		public override void Encode(
			BcpgOutputStream bcpgOut)
		{
			MemoryStream bOut = new MemoryStream();
			BcpgOutputStream pOut = new BcpgOutputStream(bOut);

			pOut.Write(
				(byte) version,
				(byte) sigType,
				(byte) hashAlgorithm,
				(byte) keyAlgorithm);

			pOut.WriteLong(keyId);

			pOut.WriteByte((byte) nested);

			bcpgOut.WritePacket(PacketTag.OnePassSignature, bOut.ToArray(), true);
		}
        public override void Encode(
			BcpgOutputStream bcpgOut)
		{
			MemoryStream bOut = new MemoryStream();
			BcpgOutputStream pOut = new BcpgOutputStream(bOut);

			pOut.WriteByte((byte) version);

			pOut.WriteLong(keyId);

			pOut.WriteByte((byte)algorithm);

            for (int i = 0; i < data.Length; ++i)
            {
                pOut.Write(data[i]);
            }

            Platform.Dispose(pOut);

            bcpgOut.WritePacket(PacketTag.PublicKeyEncryptedSession , bOut.ToArray(), true);
		}
 public override void Encode(BcpgOutputStream bcpgOut)
 {
     bcpgOut.WritePacket(PacketTag.Marker, this.marker, true);
 }
		public override void Encode(
            BcpgOutputStream bcpgOut)
        {
            bcpgOut.WritePacket(tag, contents, true);
        }
		public override void Encode(
            BcpgOutputStream bcpgOut)
        {
            bcpgOut.WritePacket(PacketTag.ModificationDetectionCode, digest, false);
        }
        public override void Encode(
            BcpgOutputStream bcpgOut)
        {
            MemoryStream bOut = new MemoryStream();
            BcpgOutputStream pOut = new BcpgOutputStream(bOut);

            pOut.Write(
				(byte) version,
				(byte) encAlgorithm);

			pOut.WriteObject(s2k);

			if (secKeyData != null && secKeyData.Length > 0)
			{
                pOut.Write(secKeyData);
            }

			bcpgOut.WritePacket(PacketTag.SymmetricKeyEncryptedSessionKey, bOut.ToArray(), true);
        }
Exemple #10
0
 public override void Encode(
     BcpgOutputStream bcpgOut)
 {
     bcpgOut.WritePacket(tag, contents, true);
 }
 public override void Encode(
     BcpgOutputStream bcpgOut)
 {
     bcpgOut.WritePacket(PacketTag.Marker, marker, true);
 }
Exemple #12
0
 public override void Encode(BcpgOutputStream bcpgOut)
 {
     bcpgOut.WritePacket(PacketTag.PublicSubkey, this.GetEncodedContents(), true);
 }
Exemple #13
0
 public override void Encode(BcpgOutputStream bcpgOut)
 {
     bcpgOut.WritePacket(PacketTag.ModificationDetectionCode, this.digest, false);
 }
Exemple #14
0
 public override void Encode(BcpgOutputStream bcpgOut)
 {
     bcpgOut.WritePacket(PacketTag.Marker, marker, oldFormat: true);
 }
 public override void Encode(BcpgOutputStream bcpgOut)
 {
     bcpgOut.WritePacket(PacketTag.UserId, idData, oldFormat: true);
 }
		public override void Encode(
			BcpgOutputStream bcpgOut)
        {
            bcpgOut.WritePacket(PacketTag.SecretSubkey, GetEncodedContents(), true);
        }
 public override void Encode(BcpgOutputStream bcpgOut)
 {
     bcpgOut.WritePacket(PacketTag.PublicKey, GetEncodedContents(), oldFormat: true);
 }
		public override void Encode(
            BcpgOutputStream bcpgOut)
        {
            MemoryStream bOut = new MemoryStream();
            BcpgOutputStream pOut = new BcpgOutputStream(bOut);

			pOut.WriteByte((byte) version);

			if (version == 3 || version == 2)
            {
				pOut.Write(
					5, // the length of the next block
					(byte) signatureType);

				pOut.WriteInt((int)(creationTime / 1000L));

				pOut.WriteLong(keyId);

				pOut.Write(
					(byte) keyAlgorithm,
					(byte) hashAlgorithm);
            }
            else if (version == 4)
            {
                pOut.Write(
					(byte) signatureType,
					(byte) keyAlgorithm,
					(byte) hashAlgorithm);

				EncodeLengthAndData(pOut, GetEncodedSubpackets(hashedData));

				EncodeLengthAndData(pOut, GetEncodedSubpackets(unhashedData));
            }
            else
            {
                throw new IOException("unknown version: " + version);
            }

			pOut.Write(fingerprint);

			if (signature != null)
			{
				pOut.WriteObjects(signature);
			}
			else
			{
				pOut.Write(signatureEncoding);
			}

			bcpgOut.WritePacket(PacketTag.Signature, bOut.ToArray(), true);
        }
Exemple #19
0
 public override void Encode(
     BcpgOutputStream bcpgOut)
 {
     bcpgOut.WritePacket(PacketTag.Trust, levelAndTrustAmount, true);
 }
        public override void Encode(
			BcpgOutputStream bcpgOut)
        {
            MemoryStream bOut = new MemoryStream();
            BcpgOutputStream pOut = new BcpgOutputStream(bOut);

            pOut.WriteByte((byte) version);

            pOut.WriteLong(keyId);

            pOut.WriteByte((byte)algorithm);

            for (int i = 0; i != data.Length; i++)
            {
                pOut.WriteObject(new MPInteger(data[i]));
            }

            bcpgOut.WritePacket(PacketTag.PublicKeyEncryptedSession , bOut.ToArray(), true);
        }
 public override void Encode(
     BcpgOutputStream bcpgOut)
 {
     bcpgOut.WritePacket(PacketTag.SecretKey, GetEncodedContents(), true);
 }
Exemple #22
0
		public override void Encode(
            BcpgOutputStream bcpgOut)
        {
            bcpgOut.WritePacket(PacketTag.UserId, idData, true);
        }
Exemple #23
0
 public override void Encode(
     BcpgOutputStream bcpgOut)
 {
     bcpgOut.WritePacket(PacketTag.Trust, levelAndTrustAmount, true);
 }