public override void Encode(IBcpgOutputStream bcpgOut) { bcpgOut.WriteByte((byte)_type); bcpgOut.WriteByte((byte)_algorithm); if (_type != GnuDummyS2K) { if (_type != 0) { bcpgOut.Write(_iv); } if (_type == 3) { bcpgOut.WriteByte((byte)_itCount); } } else { bcpgOut.WriteByte((byte)'G'); bcpgOut.WriteByte((byte)'N'); bcpgOut.WriteByte((byte)'U'); bcpgOut.WriteByte((byte)_protectionMode); } }
/// <summary> /// Encodes the specified BCPG out. /// </summary> /// <param name="bcpgOut">The BCPG out.</param> public override void Encode(IBcpgOutputStream bcpgOut) { var oid = this.Oid.ToBytes(); bcpgOut.WriteByte((byte)oid.Length); bcpgOut.Write(oid, 0, oid.Length); var point = new MPInteger(new BigInteger(1, _point.GetEncoded())); bcpgOut.WriteObject(point); }
internal static void EncodeInteger(IBcpgOutputStream bcpgOut, IBigInteger val) { bcpgOut.WriteShort((short)val.BitLength); bcpgOut.Write(val.ToByteArrayUnsigned()); }
public override void Encode(IBcpgOutputStream bcpgOut) { bcpgOut.WriteByte((byte) _type); bcpgOut.WriteByte((byte) _algorithm); if (_type != GnuDummyS2K) { if (_type != 0) { bcpgOut.Write(_iv); } if (_type == 3) { bcpgOut.WriteByte((byte) _itCount); } } else { bcpgOut.WriteByte((byte) 'G'); bcpgOut.WriteByte((byte) 'N'); bcpgOut.WriteByte((byte) 'U'); bcpgOut.WriteByte((byte) _protectionMode); } }