예제 #1
0
		private static TimeStampResp readTimeStampResp(
			Asn1InputStream input)
		{
			try
			{
				return TimeStampResp.GetInstance(input.ReadObject());                
			}
			catch (ArgumentException e)
			{
				throw new TspException("malformed timestamp response: " + e, e);
			}
			catch (InvalidCastException e)
			{
				throw new TspException("malformed timestamp response: " + e, e);
			}
            catch (EndOfStreamException e)
            {
                //jbonilla - TSA del BCE por alguna razón devuelve "null\n"
                string resp = "";
                if (input.CanSeek && input.CanRead && input.Length > 0)
                {
                    input.Seek(0, SeekOrigin.Begin);
                    resp = Strings.FromByteArray(
                        Org.BouncyCastle.Utilities.IO.Streams.ReadAll(input));
                }                
                throw new TspException("malformed timestamp response: " 
                    + resp + " " + e.Message, e);
            }
		}