/// <summary> /// Imports the certificate(s) from the specified stream. /// </summary> /// <remarks> /// Imports the certificate(s) from the specified stream. /// </remarks> /// <param name="stream">The stream to import.</param> /// <exception cref="System.ArgumentNullException"> /// <paramref name="stream"/> is <c>null</c>. /// </exception> /// <exception cref="System.IO.IOException"> /// An error occurred reading the stream. /// </exception> public void Import(System.IO.Stream stream) { if (stream == null) { throw new System.ArgumentNullException(nameof(stream)); } Org.BouncyCastle.X509.X509CertificateParser parser = new Org.BouncyCastle.X509.X509CertificateParser(); foreach (Org.BouncyCastle.X509.X509Certificate certificate in parser.ReadCertificates(stream)) { if (unique.Add(certificate)) { certs.Add(certificate); } } }