Exemplo n.º 1
0
        public void Read_WithValidInput_ReturnsIssuerSerial()
        {
            var directoryName = new X509Name("CN=test");
            var generalNames  = new GeneralNames(
                new BcGeneralName(BcGeneralName.DirectoryName, directoryName));
            var bcIssuerSerial = new BcIssuerSerial(generalNames, new DerInteger(BigInteger.One));
            var bytes          = bcIssuerSerial.GetDerEncoded();

            var issuerSerial = IssuerSerial.Read(bytes);

            Assert.Equal(1, issuerSerial.GeneralNames.Count);
            Assert.Equal(directoryName.ToString(), issuerSerial.GeneralNames[0].DirectoryName.Name);
            Assert.Equal(bcIssuerSerial.Serial.Value.ToByteArray(), issuerSerial.SerialNumber);
        }
Exemplo n.º 2
0
 public void Read_WithInvalidAsn1_Throws()
 {
     Assert.Throws <CryptographicException>(
         () => IssuerSerial.Read(new byte[] { 0x30, 0x07 }));
 }