当前位置: 首页>>代码示例>>C#>>正文


C# Bcpg.BcpgOutputStream类代码示例

本文整理汇总了C#中Org.BouncyCastle.Bcpg.BcpgOutputStream的典型用法代码示例。如果您正苦于以下问题:C# BcpgOutputStream类的具体用法?C# BcpgOutputStream怎么用?C# BcpgOutputStream使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


BcpgOutputStream类属于Org.BouncyCastle.Bcpg命名空间,在下文中一共展示了BcpgOutputStream类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Encode

		internal static void Encode(
			BcpgOutputStream	bcpgOut,
			BigInteger			val)
		{
			bcpgOut.WriteShort((short) val.BitLength);
			bcpgOut.Write(val.ToByteArrayUnsigned());
		}
开发者ID:MBrekhof,项目名称:pleiobox-clients,代码行数:7,代码来源:MPInteger.cs

示例2: OutputStreamPacket

		internal OutputStreamPacket(
            BcpgOutputStream bcpgOut)
        {
			if (bcpgOut == null)
				throw new ArgumentNullException("bcpgOut");

			this.bcpgOut = bcpgOut;
        }
开发者ID:MBrekhof,项目名称:pleiobox-clients,代码行数:8,代码来源:OutputStreamPacket.cs

示例3: GetEncoded

        public virtual byte[] GetEncoded()
        {
            MemoryStream bOut = new MemoryStream();
            BcpgOutputStream pOut = new BcpgOutputStream(bOut);

			pOut.WriteObject(this);

			return bOut.ToArray();
        }
开发者ID:ktw,项目名称:OutlookPrivacyPlugin,代码行数:9,代码来源:BcpgObject.cs

示例4: GetEncoded

        public byte[] GetEncoded()
        {
            MemoryStream bOut = new MemoryStream();
            BcpgOutputStream pOut = new BcpgOutputStream(bOut);

			pOut.WritePacket(this);

			return bOut.ToArray();
        }
开发者ID:htlp,项目名称:itextsharp,代码行数:9,代码来源:ContainedPacket.cs

示例5: Encode

        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);
        }
开发者ID:ALange,项目名称:OutlookPrivacyPlugin,代码行数:9,代码来源:ECPublicBCPGKey.cs

示例6: Encode

 public override void Encode(
     BcpgOutputStream bcpgOut)
 {
     base.Encode(bcpgOut);
     bcpgOut.WriteByte(0x3);
     bcpgOut.WriteByte(reserved);
     bcpgOut.WriteByte(hashFunctionId);
     bcpgOut.WriteByte(symAlgorithmId);
 }
开发者ID:ALange,项目名称:OutlookPrivacyPlugin,代码行数:9,代码来源:ECDHPublicBCPGKey.cs

示例7: GetEncoded

 /// <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();
         }
     }
 }
开发者ID:sanyaade-iot,项目名称:Schmoose-BouncyCastle,代码行数:15,代码来源:ContainedPacket.cs

示例8: Encode

        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);
        }
开发者ID:ktw,项目名称:OutlookPrivacyPlugin,代码行数:12,代码来源:UserAttributePacket.cs

示例9: Encode

		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);
		}
开发者ID:MBrekhof,项目名称:pleiobox-clients,代码行数:18,代码来源:OnePassSignaturePacket.cs

示例10: GetEncoded

 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;
     }
 }
开发者ID:sanyaade-iot,项目名称:Schmoose-BouncyCastle,代码行数:18,代码来源:BcpgObject.cs

示例11: Encode

        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);
        }
开发者ID:nicecai,项目名称:iTextSharp-4.1.6,代码行数:19,代码来源:SymmetricKeyEncSessionPacket.cs

示例12: Encode

		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++)
			{
				MPInteger.Encode(pOut, data[i]);
			}

			bcpgOut.WritePacket(PacketTag.PublicKeyEncryptedSession , bOut.ToArray(), true);
		}
开发者ID:MBrekhof,项目名称:pleiobox-clients,代码行数:19,代码来源:PublicKeyEncSessionPacket.cs

示例13: Encode

        public override void Encode(
            BcpgOutputStream bcpgOut)
        {
            int length = val.BitLength;

            bcpgOut.WriteByte((byte) (length >> 8));
            bcpgOut.WriteByte((byte) length);

            byte[] bytes = val.ToByteArray();

            if (bytes[0] == 0)
            {
                bcpgOut.Write(bytes, 1, bytes.Length - 1);
            }
            else
            {
                bcpgOut.Write(bytes);
            }
        }
开发者ID:hjgode,项目名称:iTextSharpCF,代码行数:19,代码来源:MPInteger.cs

示例14: SignFile

        public static void SignFile(Stream input, Stream outputStream, Stream keyIn, char[] pass)
        {
            var secretKey = ReadSecretKey(keyIn);
            var privateKey = secretKey.ExtractPrivateKey(pass);

            var signatureGenerator = new PgpSignatureGenerator(secretKey.PublicKey.Algorithm, HashAlgorithmTag.Sha1);
            var subpacketGenerator = new PgpSignatureSubpacketGenerator();

            signatureGenerator.InitSign(PgpSignature.CanonicalTextDocument, privateKey);
            foreach (string userId in secretKey.PublicKey.GetUserIds())
            {
                var signatureSubpacketGenerator = new PgpSignatureSubpacketGenerator();
                signatureSubpacketGenerator.SetSignerUserId(isCritical: false, userId: userId);
                signatureGenerator.SetHashedSubpackets(signatureSubpacketGenerator.Generate());
                // Just the first one!
                break;
            }

            // Closing armouredOutputStream does not close the underlying stream
            var armouredOutputStream = new ArmoredOutputStream(outputStream);
            using (var bcpgOutputStream = new BcpgOutputStream(armouredOutputStream))
            {
                armouredOutputStream.BeginClearText(HashAlgorithmTag.Sha1);

                int chr;
                while ((chr = input.ReadByte()) > 0)
                {
                    signatureGenerator.Update((byte)chr);
                    bcpgOutputStream.Write((byte)chr);
                }

                // For some reason we need to add a trailing newline
                bcpgOutputStream.Write((byte)'\n'); 

                armouredOutputStream.EndClearText();

                signatureGenerator.Generate().Encode(bcpgOutputStream);
            }
        }
开发者ID:modulexcite,项目名称:SyncTrayzor,代码行数:39,代码来源:PgpClearsignUtilities.cs

示例15: Encode

        public override void Encode(
			BcpgOutputStream bcpgOut)
        {
            bcpgOut.WriteObjects(d, p, q, u);
        }
开发者ID:hjgode,项目名称:iTextSharpCF,代码行数:5,代码来源:RsaSecretBcpgKey.cs


注:本文中的Org.BouncyCastle.Bcpg.BcpgOutputStream类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。