Exemplo n.º 1
0
    public static CertificateUrl parse(TlsContext context, Stream input)
    {
        byte b = TlsUtilities.ReadUint8(input);

        if (!CertChainType.IsValid(b))
        {
            throw new TlsFatalAlert(50);
        }
        int num = TlsUtilities.ReadUint16(input);

        if (num < 1)
        {
            throw new TlsFatalAlert(50);
        }
        byte[]       buffer       = TlsUtilities.ReadFully(num, input);
        MemoryStream memoryStream = new MemoryStream(buffer, writable: false);
        IList        list         = Platform.CreateArrayList();

        while (memoryStream.Position < memoryStream.Length)
        {
            UrlAndHash value = UrlAndHash.Parse(context, memoryStream);
            list.Add(value);
        }
        return(new CertificateUrl(b, list));
    }
Exemplo n.º 2
0
 public CertificateUrl(byte type, IList urlAndHashList)
 {
     if (!CertChainType.IsValid(type))
     {
         throw new ArgumentException("not a valid CertChainType value", "type");
     }
     if (urlAndHashList == null || urlAndHashList.Count < 1)
     {
         throw new ArgumentException("must have length > 0", "urlAndHashList");
     }
     mType           = type;
     mUrlAndHashList = urlAndHashList;
 }