ReadString() public method

Calls BIO_gets()
public ReadString ( ) : string
return string
コード例 #1
0
        private static DateTime AsnTimeToDateTime(IntPtr ptr)
        {
            string str;

            using (BIO bio = BIO.MemoryBuffer())
            {
                Native.ExpectSuccess(Native.ASN1_UTCTIME_print(bio.Handle, ptr));
                str = bio.ReadString();
            }
            string[] fmts =
            {
                "MMM  d HH:mm:ss yyyy G\\MT",
                "MMM dd HH:mm:ss yyyy G\\MT"
            };
            return(DateTime.ParseExact(str, fmts, new DateTimeFormatInfo(), DateTimeStyles.AssumeUniversal | DateTimeStyles.AdjustToUniversal));
        }
コード例 #2
0
        /// <summary>
        /// Override of ToString() which uses Print() into a BIO memory buffer.
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            try {
                if (this.ptr == IntPtr.Zero)
                {
                    return("(null)");
                }

                using (BIO bio = BIO.MemoryBuffer()) {
                    this.Print(bio);
                    return(bio.ReadString());
                }
            }
            catch (Exception) {
                return("<exception>");
            }
        }