Encode() private méthode

private Encode ( DerOutputStream derOut ) : void
derOut DerOutputStream
Résultat void
            public override void Write(
                byte[] buf,
                int offset,
                int len)
            {
                while (len > 0)
                {
                    int numToCopy = System.Math.Min(len, _buf.Length - _off);

                    if (numToCopy == _buf.Length)
                    {
                        DerOctetString.Encode(_derOut, buf, offset, numToCopy);
                    }
                    else
                    {
                        Array.Copy(buf, offset, _buf, _off, numToCopy);

                        _off += numToCopy;
                        if (_off < _buf.Length)
                        {
                            break;
                        }

                        DerOctetString.Encode(_derOut, _buf, 0, _off);
                        _off = 0;
                    }

                    offset += numToCopy;
                    len    -= numToCopy;
                }
            }
Exemple #2
0
 public override void Close()
 {
     if (_off != 0)
     {
         DerOctetString.Encode(_derOut, _buf, 0, _off);
     }
     _gen.WriteBerEnd();
     base.Close();
 }
Exemple #3
0
 public override void WriteByte(byte b)
 {
     _buf[_off++] = b;
     if (_off == _buf.Length)
     {
         DerOctetString.Encode(_derOut, _buf, 0, _off);
         _off = 0;
     }
 }
Exemple #4
0
 public override void Close()
 {
     if (this._off != 0)
     {
         DerOctetString.Encode(this._derOut, this._buf, 0, this._off);
     }
     this._gen.WriteBerEnd();
     base.Close();
 }
Exemple #5
0
 public override void WriteByte(byte b)
 {
     this._buf[this._off++] = b;
     if (this._off == this._buf.Length)
     {
         DerOctetString.Encode(this._derOut, this._buf, 0, this._off);
         this._off = 0;
     }
 }
            protected override void Dispose(bool disposing)
            {
                if (_off != 0)
                {
                    DerOctetString.Encode(_derOut, _buf, 0, _off);
                }

                _gen.WriteBerEnd();
                base.Dispose(disposing);
            }
            protected override void Dispose(bool isDisposing)
            {
                try
                {
                    if (_off != 0)
                    {
                        DerOctetString.Encode(_derOut, _buf, 0, _off);
                    }

                    _gen.WriteBerEnd();
                }
                finally
                {
                    base.Dispose(isDisposing);
                }
            }
Exemple #8
0
 public override void Write(byte[] buf, int offset, int len)
 {
     while (len > 0)
     {
         int num = Math.Min(len, _buf.Length - _off);
         if (num == _buf.Length)
         {
             DerOctetString.Encode(_derOut, buf, offset, num);
         }
         else
         {
             global::System.Array.Copy((global::System.Array)buf, offset, (global::System.Array)_buf, _off, num);
             _off += num;
             if (_off < _buf.Length)
             {
                 break;
             }
             DerOctetString.Encode(_derOut, _buf, 0, _off);
             _off = 0;
         }
         offset += num;
         len    -= num;
     }
 }
Exemple #9
0
 public override void Write(byte[] buf, int offset, int len)
 {
     while (len > 0)
     {
         int num = Math.Min(len, this._buf.Length - this._off);
         if (num == this._buf.Length)
         {
             DerOctetString.Encode(this._derOut, buf, offset, num);
         }
         else
         {
             Array.Copy(buf, offset, this._buf, this._off, num);
             this._off += num;
             if (this._off < this._buf.Length)
             {
                 return;
             }
             DerOctetString.Encode(this._derOut, this._buf, 0, this._off);
             this._off = 0;
         }
         offset += num;
         len    -= num;
     }
 }