Esempio n. 1
0
        public void WriteObject(PemObjectGenerator objGen)
        {
            PemObject pemObject = objGen.Generate();

            WritePreEncapsulationBoundary(pemObject.Type);
            if (((global::System.Collections.ICollection)pemObject.Headers).get_Count() > 0)
            {
                {
                    global::System.Collections.IEnumerator enumerator = ((global::System.Collections.IEnumerable)pemObject.Headers).GetEnumerator();
                    try
                    {
                        while (enumerator.MoveNext())
                        {
                            PemHeader pemHeader = (PemHeader)enumerator.get_Current();
                            writer.Write(pemHeader.Name);
                            writer.Write(": ");
                            writer.WriteLine(pemHeader.Value);
                        }
                    }
                    finally
                    {
                        global::System.IDisposable disposable = enumerator as global::System.IDisposable;
                        if (disposable != null)
                        {
                            disposable.Dispose();
                        }
                    }
                }
                writer.WriteLine();
            }
            WriteEncoded(pemObject.Content);
            WritePostEncapsulationBoundary(pemObject.Type);
        }
Esempio n. 2
0
        public int GetOutputSize(PemObject obj)
        {
            int num = 2 * (obj.Type.get_Length() + 10 + nlLength) + 6 + 4;

            if (((global::System.Collections.ICollection)obj.Headers).get_Count() > 0)
            {
                {
                    global::System.Collections.IEnumerator enumerator = ((global::System.Collections.IEnumerable)obj.Headers).GetEnumerator();
                    try
                    {
                        while (enumerator.MoveNext())
                        {
                            PemHeader pemHeader = (PemHeader)enumerator.get_Current();
                            num += pemHeader.Name.get_Length() + ": ".get_Length() + pemHeader.Value.get_Length() + nlLength;
                        }
                    }
                    finally
                    {
                        global::System.IDisposable disposable = enumerator as global::System.IDisposable;
                        if (disposable != null)
                        {
                            disposable.Dispose();
                        }
                    }
                }
                num += nlLength;
            }
            int num2 = (obj.Content.Length + 2) / 3 * 4;

            return(num + (num2 + (num2 + 64 - 1) / 64 * nlLength));
        }
Esempio n. 3
0
        public void WriteObject(PemObjectGenerator objGen)
        {
            PemObject obj2 = objGen.Generate();

            this.WritePreEncapsulationBoundary(obj2.Type);
            if (obj2.Headers.Count > 0)
            {
                IEnumerator enumerator = obj2.Headers.GetEnumerator();
                try
                {
                    while (enumerator.MoveNext())
                    {
                        PemHeader current = (PemHeader)enumerator.Current;
                        this.writer.Write(current.Name);
                        this.writer.Write(": ");
                        this.writer.WriteLine(current.Value);
                    }
                }
                finally
                {
                    if (enumerator is IDisposable disposable)
                    {
                        IDisposable disposable;
                        disposable.Dispose();
                    }
                }
                this.writer.WriteLine();
            }
            this.WriteEncoded(obj2.Content);
            this.WritePostEncapsulationBoundary(obj2.Type);
        }
Esempio n. 4
0
        public int GetOutputSize(PemObject obj)
        {
            int num = ((2 * ((obj.Type.Length + 10) + this.nlLength)) + 6) + 4;

            if (obj.Headers.Count > 0)
            {
                IEnumerator enumerator = obj.Headers.GetEnumerator();
                try
                {
                    while (enumerator.MoveNext())
                    {
                        PemHeader current = (PemHeader)enumerator.Current;
                        num += ((current.Name.Length + ": ".Length) + current.Value.Length) + this.nlLength;
                    }
                }
                finally
                {
                    if (enumerator is IDisposable disposable)
                    {
                        IDisposable disposable;
                        disposable.Dispose();
                    }
                }
                num += this.nlLength;
            }
            int num2 = ((obj.Content.Length + 2) / 3) * 4;

            return(num + (num2 + ((((num2 + 0x40) - 1) / 0x40) * this.nlLength)));
        }
Esempio n. 5
0
        public override bool Equals(object obj)
        {
            if (obj == this)
            {
                return(true);
            }
            if (!(obj is PemHeader))
            {
                return(false);
            }
            PemHeader pemHeader = (PemHeader)obj;

            return(object.Equals(this.name, pemHeader.name) && object.Equals(this.val, pemHeader.val));
        }
Esempio n. 6
0
        public override bool Equals(object obj)
        {
            if (obj == this)
            {
                return(true);
            }

            if (!(obj is PemHeader))
            {
                return(false);
            }

            PemHeader other = (PemHeader)obj;

            return(Platform.Equals(this.name, other.name) && Platform.Equals(this.val, other.val));
        }
Esempio n. 7
0
        public override bool Equals(object obj)
        {
            if (obj == this)
            {
                return(true);
            }

            if (!(obj is PemHeader))
            {
                return(false);
            }

            PemHeader other = (PemHeader)obj;

            return(Org.BouncyCastle.Utilities.Platform.Equals(this.name, other.name) &&
                   Org.BouncyCastle.Utilities.Platform.Equals(this.val, other.val));
        }