WriteObject() public method

public WriteObject ( BcpgObject bcpgObject ) : void
bcpgObject BcpgObject
return void
示例#1
0
        public byte[] GetSignatureBytes()
        {
            //IL_0019: Unknown result type (might be due to invalid IL or missing references)
            //IL_001f: Expected O, but got Unknown
            //IL_0043: Expected O, but got Unknown
            if (signatureEncoding != null)
            {
                return((byte[])((global::System.Array)signatureEncoding).Clone());
            }
            MemoryStream     val = new MemoryStream();
            BcpgOutputStream bcpgOutputStream = new BcpgOutputStream((Stream)(object)val);

            MPInteger[] array = signature;
            foreach (MPInteger bcpgObject in array)
            {
                try
                {
                    bcpgOutputStream.WriteObject(bcpgObject);
                }
                catch (IOException val2)
                {
                    IOException val3 = val2;
                    throw new global::System.Exception(string.Concat((object)"internal error: ", (object)val3));
                }
            }
            return(val.ToArray());
        }
示例#2
0
        public byte[] GetEncodedContents()
        {
            MemoryStream     bOut = new MemoryStream();
            BcpgOutputStream pOut = new BcpgOutputStream(bOut);

            pOut.Write(pubKeyPacket.GetEncodedContents());

            pOut.WriteByte((byte)s2kUsage);

            if (s2kUsage == UsageChecksum || s2kUsage == UsageSha1)
            {
                pOut.WriteByte((byte)encAlgorithm);
                pOut.WriteObject(s2k);
            }

            if (iv != null)
            {
                pOut.Write(iv);
            }

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

            return(bOut.ToArray());
        }
        /**
         * Return the byte encoding of the signature section.
         * @return uninterpreted signature bytes.
         */
        public byte[] GetSignatureBytes()
        {
            if (_signatureEncoding != null)
            {
                return((byte[])_signatureEncoding.Clone());
            }

            using (var bOut = new MemoryStream())
            {
                using (var bcOut = new BcpgOutputStream(bOut))
                {
                    foreach (var sigObj in _signature)
                    {
                        try
                        {
                            bcOut.WriteObject(sigObj);
                        }
                        catch (IOException e)
                        {
                            throw new Exception("internal error: " + e);
                        }
                    }
                }

                return(bOut.ToArray());
            }
        }
示例#4
0
        /// <summary>
        /// Gets the encoded contents.
        /// </summary>
        /// <returns></returns>
        public byte[] GetEncodedContents()
        {
            using (var bOut = new MemoryStream())
            {
                using (var pOut = new BcpgOutputStream(bOut))
                {
                    pOut.Write(PublicKeyPacket.GetEncodedContents());
                    pOut.WriteByte((byte)this.S2KUsage);

                    if (this.S2KUsage == UsageChecksum || this.S2KUsage == UsageSha1)
                    {
                        pOut.WriteByte((byte)this.EncAlgorithm);
                        pOut.WriteObject(this.S2K);
                    }

                    if (_iv != null)
                    {
                        pOut.Write(_iv);
                    }

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

                    return(bOut.ToArray());
                }
            }
        }
示例#5
0
        public virtual byte[] GetEncoded()
        {
            MemoryStream     memoryStream     = new MemoryStream();
            BcpgOutputStream bcpgOutputStream = new BcpgOutputStream(memoryStream);

            bcpgOutputStream.WriteObject(this);
            return(memoryStream.ToArray());
        }
示例#6
0
        public override void Encode(BcpgOutputStream bcpgOut)
        {
            byte[] encoded = oid.GetEncoded();
            ((Stream)bcpgOut).Write(encoded, 1, encoded.Length - 1);
            MPInteger bcpgObject = new MPInteger(point);

            bcpgOut.WriteObject(bcpgObject);
        }
示例#7
0
        public virtual byte[] GetEncoded()
        {
            MemoryStream bOut = new MemoryStream();
            BcpgOutputStream pOut = new BcpgOutputStream(bOut);

			pOut.WriteObject(this);

			return bOut.ToArray();
        }
示例#8
0
        public virtual byte[] GetEncoded()
        {
            MemoryStream     bOut = new MemoryStream();
            BcpgOutputStream pOut = new BcpgOutputStream(bOut);

            pOut.WriteObject(this);

            return(bOut.ToArray());
        }
        public override void Encode(
            BcpgOutputStream bcpgOut)
        {
            byte[] oid = this.oid.GetEncoded();
            bcpgOut.Write(oid, 1, oid.Length - 1);

            MPInteger point = new MPInteger(this.point);
            bcpgOut.WriteObject(point);
        }
示例#10
0
        public virtual byte[] GetEncoded()
        {
            //IL_0000: Unknown result type (might be due to invalid IL or missing references)
            //IL_0006: Expected O, but got Unknown
            MemoryStream     val = new MemoryStream();
            BcpgOutputStream bcpgOutputStream = new BcpgOutputStream((Stream)(object)val);

            bcpgOutputStream.WriteObject(this);
            return(val.ToArray());
        }
示例#11
0
        public override void Encode(
            BcpgOutputStream bcpgOut)
        {
            byte[] oid = this.oid.GetEncoded();
            bcpgOut.Write(oid, 1, oid.Length - 1);

            MPInteger point = new MPInteger(this.point);

            bcpgOut.WriteObject(point);
        }
示例#12
0
        public override void Encode(BcpgOutputStream bcpgOut)
        {
            //IL_0000: Unknown result type (might be due to invalid IL or missing references)
            //IL_0006: Expected O, but got Unknown
            MemoryStream     val = new MemoryStream();
            BcpgOutputStream bcpgOutputStream = new BcpgOutputStream((Stream)(object)val);

            bcpgOutputStream.Write((byte)version, (byte)encAlgorithm);
            bcpgOutputStream.WriteObject(s2k);
            if (secKeyData != null && secKeyData.Length > 0)
            {
                bcpgOutputStream.Write(secKeyData);
            }
            bcpgOut.WritePacket(PacketTag.SymmetricKeyEncryptedSessionKey, val.ToArray(), oldFormat: true);
        }
示例#13
0
        public virtual byte[] GetEncodedContents()
        {
            MemoryStream     memoryStream     = new MemoryStream();
            BcpgOutputStream bcpgOutputStream = new BcpgOutputStream(memoryStream);

            bcpgOutputStream.WriteByte((byte)this.version);
            bcpgOutputStream.WriteInt((int)this.time);
            if (this.version <= 3)
            {
                bcpgOutputStream.WriteShort((short)this.validDays);
            }
            bcpgOutputStream.WriteByte((byte)this.algorithm);
            bcpgOutputStream.WriteObject((BcpgObject)this.key);
            return(memoryStream.ToArray());
        }
示例#14
0
        public virtual byte[] GetEncodedContents()
        {
            //IL_0000: Unknown result type (might be due to invalid IL or missing references)
            //IL_0006: Expected O, but got Unknown
            MemoryStream     val = new MemoryStream();
            BcpgOutputStream bcpgOutputStream = new BcpgOutputStream((Stream)(object)val);

            ((Stream)bcpgOutputStream).WriteByte((byte)version);
            bcpgOutputStream.WriteInt((int)time);
            if (version <= 3)
            {
                bcpgOutputStream.WriteShort((short)validDays);
            }
            ((Stream)bcpgOutputStream).WriteByte((byte)algorithm);
            bcpgOutputStream.WriteObject((BcpgObject)key);
            return(val.ToArray());
        }
        public override void Encode(BcpgOutputStream bcpgOut)
        {
            MemoryStream     memoryStream     = new MemoryStream();
            BcpgOutputStream bcpgOutputStream = new BcpgOutputStream(memoryStream);

            bcpgOutputStream.Write(new byte[]
            {
                (byte)this.version,
                (byte)this.encAlgorithm
            });
            bcpgOutputStream.WriteObject(this.s2k);
            if (this.secKeyData != null && this.secKeyData.Length > 0)
            {
                bcpgOutputStream.Write(this.secKeyData);
            }
            bcpgOut.WritePacket(PacketTag.SymmetricKeyEncryptedSessionKey, memoryStream.ToArray(), true);
        }
 public byte[] GetEncoded()
 {
     try
     {
         using (var bOut = new MemoryStream())
         {
             using (var pOut = new BcpgOutputStream(bOut))
             {
                 pOut.WriteObject(this);
                 return bOut.ToArray();
             }
         }
     }
     catch (Exception)
     {
         return null;
     }
 }
示例#17
0
 public byte[] GetEncoded()
 {
     try
     {
         using (var bOut = new MemoryStream())
         {
             using (var pOut = new BcpgOutputStream(bOut))
             {
                 pOut.WriteObject(this);
                 return(bOut.ToArray());
             }
         }
     }
     catch (Exception)
     {
         return(null);
     }
 }
示例#18
0
        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);
        }
示例#19
0
        public byte[] GetEncodedContents()
        {
            MemoryStream     bOut = new MemoryStream();
            BcpgOutputStream pOut = new BcpgOutputStream(bOut);

            pOut.WriteByte((byte)version);
            pOut.WriteInt((int)time);

            if (version <= 3)
            {
                pOut.WriteShort((short)validDays);
            }

            pOut.WriteByte((byte)algorithm);

            pOut.WriteObject((BcpgObject)key);

            return(bOut.ToArray());
        }
        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);
        }
        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);
        }
        /// <summary>
        /// Encodes this instance to the given stream.
        /// </summary>
        /// <param name="bcpgOut">The BCPG out.</param>
        public override void Encode(IBcpgOutputStream bcpgOut)
        {
            using (var bOut = new MemoryStream())
            {
                using (var 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);
                }
            }
        }
        /// <summary>
        /// Gets the encoded contents.
        /// </summary>
        /// <returns></returns>
        public byte[] GetEncodedContents()
        {
            using (var bOut = new MemoryStream())
            {
                using (var pOut = new BcpgOutputStream(bOut))
                {
                    pOut.WriteByte((byte)_version);
                    pOut.WriteInt((int)_time);

                    if (_version <= 3)
                    {
                        pOut.WriteShort((short)_validDays);
                    }

                    pOut.WriteByte((byte)_algorithm);

                    pOut.WriteObject((BcpgObject)_key);

                    return(bOut.ToArray());
                }
            }
        }
示例#24
0
        public byte[] GetEncodedContents()
        {
            MemoryStream     memoryStream     = new MemoryStream();
            BcpgOutputStream bcpgOutputStream = new BcpgOutputStream(memoryStream);

            bcpgOutputStream.Write(this.pubKeyPacket.GetEncodedContents());
            bcpgOutputStream.WriteByte((byte)this.s2kUsage);
            if (this.s2kUsage == 255 || this.s2kUsage == 254)
            {
                bcpgOutputStream.WriteByte((byte)this.encAlgorithm);
                bcpgOutputStream.WriteObject(this.s2k);
            }
            if (this.iv != null)
            {
                bcpgOutputStream.Write(this.iv);
            }
            if (this.secKeyData != null && this.secKeyData.Length > 0)
            {
                bcpgOutputStream.Write(this.secKeyData);
            }
            return(memoryStream.ToArray());
        }
示例#25
0
        public byte[] GetEncodedContents()
        {
            //IL_0000: Unknown result type (might be due to invalid IL or missing references)
            //IL_0006: Expected O, but got Unknown
            MemoryStream     val = new MemoryStream();
            BcpgOutputStream bcpgOutputStream = new BcpgOutputStream((Stream)(object)val);

            bcpgOutputStream.Write(pubKeyPacket.GetEncodedContents());
            ((Stream)bcpgOutputStream).WriteByte((byte)s2kUsage);
            if (s2kUsage == 255 || s2kUsage == 254)
            {
                ((Stream)bcpgOutputStream).WriteByte((byte)encAlgorithm);
                bcpgOutputStream.WriteObject(s2k);
            }
            if (iv != null)
            {
                bcpgOutputStream.Write(iv);
            }
            if (secKeyData != null && secKeyData.Length > 0)
            {
                bcpgOutputStream.Write(secKeyData);
            }
            return(val.ToArray());
        }
示例#26
0
        public byte[] GetSignatureBytes()
        {
            if (this.signatureEncoding != null)
            {
                return((byte[])this.signatureEncoding.Clone());
            }
            MemoryStream     memoryStream     = new MemoryStream();
            BcpgOutputStream bcpgOutputStream = new BcpgOutputStream(memoryStream);

            MPInteger[] array = this.signature;
            for (int i = 0; i < array.Length; i++)
            {
                MPInteger bcpgObject = array[i];
                try
                {
                    bcpgOutputStream.WriteObject(bcpgObject);
                }
                catch (IOException arg)
                {
                    throw new Exception("internal error: " + arg);
                }
            }
            return(memoryStream.ToArray());
        }
示例#27
0
        /**
         * Return the byte encoding of the signature section.
         * @return uninterpreted signature bytes.
         */
        public byte[] GetSignatureBytes()
        {
            if (signatureEncoding != null)
            {
                return((byte[])signatureEncoding.Clone());
            }

            MemoryStream     bOut  = new MemoryStream();
            BcpgOutputStream bcOut = new BcpgOutputStream(bOut);

            foreach (MPInteger sigObj in signature)
            {
                try
                {
                    bcOut.WriteObject(sigObj);
                }
                catch (IOException e)
                {
                    throw new Exception("internal error: " + e);
                }
            }

            return(bOut.ToArray());
        }
        /// <summary>
        /// Gets the encoded contents.
        /// </summary>
        /// <returns></returns>
        public byte[] GetEncodedContents()
        {
            using (var bOut = new MemoryStream())
            {
                using (var pOut = new BcpgOutputStream(bOut))
                {
                    pOut.Write(PublicKeyPacket.GetEncodedContents());
                    pOut.WriteByte((byte) this.S2KUsage);

                    if (this.S2KUsage == UsageChecksum || this.S2KUsage == UsageSha1)
                    {
                        pOut.WriteByte((byte)this.EncAlgorithm);
                        pOut.WriteObject(this.S2K);
                    }

                    if (_iv != null)
                    {
                        pOut.Write(_iv);
                    }

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

                    return bOut.ToArray();
                }
            }
        }
示例#29
0
 public override void Encode(
     BcpgOutputStream bcpgOut)
 {
     bcpgOut.WriteObject(x);
 }
        /**
         * Return the byte encoding of the signature section.
         * @return uninterpreted signature bytes.
         */
        public byte[] GetSignatureBytes()
        {
            if (_signatureEncoding != null)
            {
                return (byte[])_signatureEncoding.Clone();
            }

            using (var bOut = new MemoryStream())
            {
                using (var bcOut = new BcpgOutputStream(bOut))
                {

                    foreach (var sigObj in _signature)
                    {
                        try
                        {
                            bcOut.WriteObject(sigObj);
                        }
                        catch (IOException e)
                        {
                            throw new Exception("internal error: " + e);
                        }
                    }
                }

                return bOut.ToArray();
            }
        }
		public override void Encode(
			BcpgOutputStream bcpgOut)
		{
			bcpgOut.WriteObject(x);
		}
        /// <summary>
        /// Gets the encoded contents.
        /// </summary>
        /// <returns></returns>
        public byte[] GetEncodedContents()
        {
            using (var bOut = new MemoryStream())
            {
                using (var pOut = new BcpgOutputStream(bOut))
                {

                    pOut.WriteByte((byte)_version);
                    pOut.WriteInt((int)_time);

                    if (_version <= 3)
                    {
                        pOut.WriteShort((short)_validDays);
                    }

                    pOut.WriteByte((byte)_algorithm);

                    pOut.WriteObject((BcpgObject)_key);

                    return bOut.ToArray();
                }
            }
        }
        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);
        }
示例#34
0
		/**
		 * Return the byte encoding of the signature section.
		 * @return uninterpreted signature bytes.
		 */
		public byte[] GetSignatureBytes()
		{
			if (signatureEncoding != null)
			{
				return (byte[]) signatureEncoding.Clone();
			}

			MemoryStream bOut = new MemoryStream();
			BcpgOutputStream bcOut = new BcpgOutputStream(bOut);

			foreach (MPInteger sigObj in signature)
			{
				try
				{
					bcOut.WriteObject(sigObj);
				}
				catch (IOException e)
				{
					throw new Exception("internal error: " + e);
				}
			}

			return bOut.ToArray();
		}
示例#35
0
		public byte[] GetEncodedContents()
        {
            MemoryStream bOut = new MemoryStream();
            BcpgOutputStream pOut = new BcpgOutputStream(bOut);

            pOut.Write(pubKeyPacket.GetEncodedContents());

			pOut.WriteByte((byte) s2kUsage);

			if (s2kUsage == UsageChecksum || s2kUsage == UsageSha1)
            {
                pOut.WriteByte((byte) encAlgorithm);
                pOut.WriteObject(s2k);
            }

			if (iv != null)
            {
                pOut.Write(iv);
            }

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

            return bOut.ToArray();
        }
        /// <summary>
        /// Encodes this instance to the given stream.
        /// </summary>
        /// <param name="bcpgOut">The BCPG out.</param>
        public override void Encode(IBcpgOutputStream bcpgOut)
        {
            using (var bOut = new MemoryStream())
            {
                using (var 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);
                }
            }
        }
示例#37
0
        public byte[] GetEncodedContents()
        {
            MemoryStream bOut = new MemoryStream();
            BcpgOutputStream pOut = new BcpgOutputStream(bOut);

            pOut.WriteByte((byte) version);
            pOut.WriteInt((int) time);

			if (version <= 3)
            {
                pOut.WriteShort((short) validDays);
            }

			pOut.WriteByte((byte) algorithm);

			pOut.WriteObject((BcpgObject)key);

			return bOut.ToArray();
        }