protected byte[] GetCertificateBytes(Certificate certificate) { if (certificate == null) return new byte[]{0, 0, 0}; byte[] cert_bytes = certificate.ToCerBuffer(); byte[] ret = new byte[6 + cert_bytes.Length]; int size = cert_bytes.Length + 3; ret[0] = (byte)(size / 65536); ret[1] = (byte)((size % 65536) / 256); ret[2] = (byte)(size % 256); ret[3] = (byte)(cert_bytes.Length / 65536); ret[4] = (byte)((cert_bytes.Length % 65536) / 256); ret[5] = (byte)(cert_bytes.Length % 256); Buffer.BlockCopy(cert_bytes, 0, ret, 6, cert_bytes.Length); return ret; }
private int CheckServerCertBasicProps(Certificate c, bool clone) { byte[] SHA1Hash = new byte[] {0xE1, 0x4D, 0x2F, 0x99, 0x4E, 0x31, 0xA3, 0x2E, 0x5E, 0xD6, 0x83, 0x0A, 0x87, 0x59, 0x6F, 0x5E, 0x60, 0x5F, 0x33, 0x89}; byte[] MD5Hash = new byte[] {0xAE, 0x8B, 0xA3, 0x7A, 0xF1, 0x1C, 0x33, 0x86, 0xFD, 0xCF, 0xC5, 0x23, 0xFF, 0x28, 0x2C, 0x6D}; byte[] HashCode = new byte[] {0xE1, 0x4D, 0x2F, 0x99}; byte[] Serial = new byte[] {0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD9, 0x72, 0xD2, 0x61}; byte[] RawData = new byte[] {0x30, 0x82, 0x05, 0xF4, 0x30, 0x82, 0x03, 0xDC, 0xA0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x0A, 0x61, 0xD2, 0x72, 0xD9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x05, 0x05, 0x00,0x30, 0x2D, 0x31, 0x2B, 0x30, 0x29, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x22, 0x4D, 0x65, 0x6E, 0x74, 0x61, 0x6C, 0x69, 0x73, 0x2E, 0x6F, 0x72, 0x67, 0x20, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x20, 0x41, 0x75,0x74, 0x68, 0x6F, 0x72, 0x69, 0x74, 0x79, 0x30, 0x1E, 0x17, 0x0D, 0x30, 0x32, 0x31, 0x32, 0x30, 0x39, 0x31, 0x39, 0x34, 0x39, 0x35, 0x36, 0x5A, 0x17, 0x0D, 0x30, 0x33, 0x31, 0x32, 0x30, 0x39, 0x31, 0x39, 0x35, 0x39, 0x35, 0x36, 0x5A, 0x30,0x81, 0xA9, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x42, 0x45, 0x31, 0x10, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, 0x07, 0x42, 0x72, 0x61, 0x62, 0x61, 0x6E, 0x74, 0x31, 0x0F, 0x30, 0x0D, 0x06, 0x03, 0x55,0x04, 0x07, 0x13, 0x06, 0x4C, 0x65, 0x75, 0x76, 0x65, 0x6E, 0x31, 0x15, 0x30, 0x13, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x13, 0x0C, 0x54, 0x68, 0x65, 0x20, 0x4B, 0x50, 0x44, 0x2D, 0x54, 0x65, 0x61, 0x6D, 0x31, 0x1D, 0x30, 0x1B, 0x06, 0x03, 0x55,0x04, 0x0B, 0x13, 0x14, 0x53, 0x6F, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x20, 0x44, 0x65, 0x76, 0x65, 0x6C, 0x6F, 0x70, 0x6D, 0x65, 0x6E, 0x74, 0x31, 0x1A, 0x30, 0x18, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x11, 0x4D, 0x65, 0x6E, 0x74, 0x61,0x6C, 0x69, 0x73, 0x2E, 0x6F, 0x72, 0x67, 0x20, 0x54, 0x65, 0x61, 0x6D, 0x31, 0x25, 0x30, 0x23, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 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x00, 0x01, 0xA3, 0x82, 0x02, 0x1B, 0x30, 0x82, 0x02, 0x17, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x1D, 0x0F, 0x01, 0x01, 0xFF, 0x04, 0x04, 0x03, 0x02, 0x04, 0x30, 0x30, 0x44, 0x06,0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x0F, 0x04, 0x37, 0x30, 0x35, 0x30, 0x0E, 0x06, 0x08, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x03, 0x02, 0x02, 0x02, 0x00, 0x80, 0x30, 0x0E, 0x06, 0x08, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D,0x03, 0x04, 0x02, 0x02, 0x00, 0x80, 0x30, 0x07, 0x06, 0x05, 0x2B, 0x0E, 0x03, 0x02, 0x07, 0x30, 0x0A, 0x06, 0x08, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x03, 0x07, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D, 0x0E, 0x04, 0x16, 0x04, 0x14, 0x37, 0x97,0x8A, 0x3D, 0x71, 0x3E, 0x24, 0xB6, 0xD8, 0x41, 0x61, 0x04, 0x0E, 0xFA, 0xA3, 0x45, 0xBF, 0x08, 0x90, 0x02, 0x30, 0x13, 0x06, 0x03, 0x55, 0x1D, 0x25, 0x04, 0x0C, 0x30, 0x0A, 0x06, 0x08, 0x2B, 0x06, 0x01, 0x05, 0x05, 0x07, 0x03, 0x01, 0x30,0x1F, 0x06, 0x03, 0x55, 0x1D, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, 0x14, 0xBF, 0x17, 0x6D, 0x60, 0xDA, 0x56, 0xCF, 0x36, 0xE4, 0x21, 0xF3, 0x51, 0x8A, 0x53, 0x64, 0x6C, 0xA1, 0x45, 0x61, 0x78, 0x30, 0x81, 0xA0, 0x06, 0x03, 0x55, 0x1D, 0x1F,0x04, 0x81, 0x98, 0x30, 0x81, 0x95, 0x30, 0x81, 0x92, 0xA0, 0x81, 0x8F, 0xA0, 0x81, 0x8C, 0x86, 0x45, 0x68, 0x74, 0x74, 0x70, 0x3A, 0x2F, 0x2F, 0x6D, 0x61, 0x74, 0x68, 0x69, 0x6C, 0x64, 0x65, 0x2F, 0x43, 0x65, 0x72, 0x74, 0x45, 0x6E, 0x72,0x6F, 0x6C, 0x6C, 0x2F, 0x4D, 0x65, 0x6E, 0x74, 0x61, 0x6C, 0x69, 0x73, 0x2E, 0x6F, 0x72, 0x67, 0x25, 0x32, 0x30, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x25, 0x32, 0x30, 0x41, 0x75, 0x74, 0x68, 0x6F, 0x72, 0x69,0x74, 0x79, 0x2E, 0x63, 0x72, 0x6C, 0x86, 0x43, 0x66, 0x69, 0x6C, 0x65, 0x3A, 0x2F, 0x2F, 0x5C, 0x5C, 0x6D, 0x61, 0x74, 0x68, 0x69, 0x6C, 0x64, 0x65, 0x5C, 0x43, 0x65, 0x72, 0x74, 0x45, 0x6E, 0x72, 0x6F, 0x6C, 0x6C, 0x5C, 0x4D, 0x65, 0x6E,0x74, 0x61, 0x6C, 0x69, 0x73, 0x2E, 0x6F, 0x72, 0x67, 0x20, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x20, 0x41, 0x75, 0x74, 0x68, 0x6F, 0x72, 0x69, 0x74, 0x79, 0x2E, 0x63, 0x72, 0x6C, 0x30, 0x81, 0xC6, 0x06, 0x08,0x2B, 0x06, 0x01, 0x05, 0x05, 0x07, 0x01, 0x01, 0x04, 0x81, 0xB9, 0x30, 0x81, 0xB6, 0x30, 0x5A, 0x06, 0x08, 0x2B, 0x06, 0x01, 0x05, 0x05, 0x07, 0x30, 0x02, 0x86, 0x4E, 0x68, 0x74, 0x74, 0x70, 0x3A, 0x2F, 0x2F, 0x6D, 0x61, 0x74, 0x68, 0x69,0x6C, 0x64, 0x65, 0x2F, 0x43, 0x65, 0x72, 0x74, 0x45, 0x6E, 0x72, 0x6F, 0x6C, 0x6C, 0x2F, 0x6D, 0x61, 0x74, 0x68, 0x69, 0x6C, 0x64, 0x65, 0x5F, 0x4D, 0x65, 0x6E, 0x74, 0x61, 0x6C, 0x69, 0x73, 0x2E, 0x6F, 0x72, 0x67, 0x25, 0x32, 0x30, 0x43,0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x25, 0x32, 0x30, 0x41, 0x75, 0x74, 0x68, 0x6F, 0x72, 0x69, 0x74, 0x79, 0x2E, 0x63, 0x72, 0x74, 0x30, 0x58, 0x06, 0x08, 0x2B, 0x06, 0x01, 0x05, 0x05, 0x07, 0x30, 0x02, 0x86, 0x4C,0x66, 0x69, 0x6C, 0x65, 0x3A, 0x2F, 0x2F, 0x5C, 0x5C, 0x6D, 0x61, 0x74, 0x68, 0x69, 0x6C, 0x64, 0x65, 0x5C, 0x43, 0x65, 0x72, 0x74, 0x45, 0x6E, 0x72, 0x6F, 0x6C, 0x6C, 0x5C, 0x6D, 0x61, 0x74, 0x68, 0x69, 0x6C, 0x64, 0x65, 0x5F, 0x4D, 0x65,0x6E, 0x74, 0x61, 0x6C, 0x69, 0x73, 0x2E, 0x6F, 0x72, 0x67, 0x20, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x20, 0x41, 0x75, 0x74, 0x68, 0x6F, 0x72, 0x69, 0x74, 0x79, 0x2E, 0x63, 0x72, 0x74, 0x30, 0x0D, 0x06, 0x09,0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x05, 0x05, 0x00, 0x03, 0x82, 0x02, 0x01, 0x00, 0x57, 0x1A, 0x4A, 0xEB, 0xDA, 0xE3, 0xCE, 0x4A, 0x8E, 0xE4, 0xF7, 0xE2, 0x81, 0x15, 0x9B, 0x90, 0x33, 0x1F, 0x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0x05, 0x45, 0xBA, 0x36, 0x7E, 0x3B, 0x19, 0xCF, 0x83, 0x06, 0x9D, 0x78, 0x4A, 0x77, 0xA7, 0xCA, 0xA7, 0xFB, 0x21, 0x7E, 0xA1, 0x87, 0xAB, 0xE5, 0x0B, 0x99, 0x10, 0xA5, 0x79, 0x03, 0x61, 0xBA, 0xE7, 0x8F, 0xC8, 0x57, 0x11, 0x7F, 0x28, 0x70,0xF1, 0xA6, 0x57, 0x77, 0x8F, 0xDC, 0x98, 0x4C, 0x51, 0x8F, 0x8E, 0x0E, 0xA7, 0xE7, 0xD0, 0xB8, 0x2E, 0x6A, 0x46, 0x29, 0x83, 0x85, 0x59, 0x84, 0x87, 0xCB, 0xD8, 0xDE, 0x3D, 0xD7, 0x73, 0xE4, 0x52, 0xCB, 0xA2, 0xC2, 0x3D, 0x05, 0x5F, 0xB4,0xDA, 0x40, 0x75, 0x65, 0x72, 0x3E, 0x4C, 0x79, 0x0B, 0x9C, 0x2A, 0xBC, 0x93, 0x1F, 0x24, 0x28, 0x7A, 0x90, 0xA9, 0x7A, 0x0C, 0xCA, 0x53, 0x6B, 0xE5, 0x4E, 0x67, 0x6F, 0x5A, 0x13, 0xB2, 0x67, 0x5C, 0xE3, 0x36, 0x92, 0xD3, 0x6D, 0xF6, 0x69,0x87, 0x02, 0x84, 0x01, 0x59, 0x18, 0x96, 0xFB}; int tests = 53; if (clone) { try { Certificate c2 = (Certificate)c.Clone(); if (!c.Equals(c2)) AddError("C-CSCBP1"); tests += CheckServerCertBasicProps(c2, false); } catch { AddError("C-CSCBP2"); } } try { DistinguishedName dn = c.GetDistinguishedName(); StringDictionary sd = new StringDictionary(); for(int i = 0; i < dn.Count; i++) { sd.Add(dn[i].ObjectID, dn[i].Value); } if (sd.Count != 7) AddError("C-CSCBP3"); try { if (sd["2.5.4.3"] != "Mentalis.org Team") //name AddError("C-CSCBP3"); } catch { AddError("C-CSCBP5"); } try { if (sd["1.2.840.113549.1.9.1"] != "*****@*****.**") //email AddError("C-CSCBP6"); } catch { AddError("C-CSCBP7"); } try { if (sd["2.5.4.7"] != "Leuven") //city AddError("C-CSCBP8"); } catch { AddError("C-CSCBP9"); } try { if (sd["2.5.4.6"] != "BE") //country AddError("C-CSCBP10"); } catch { AddError("C-CSCBP11"); } try { if (sd["2.5.4.10"] != "The KPD-Team") //company AddError("C-CSCBP12"); } catch { AddError("C-CSCBP13"); } try { if (sd["2.5.4.11"] != "Software Development") //department AddError("C-CSCBP14"); } catch { AddError("C-CSCBP15"); } try { if (sd["2.5.4.8"] != "Brabant") //state AddError("C-CSCBP16"); } catch { AddError("C-CSCBP17"); } } catch { AddError("C-CSCBP18"); } try { if (!ArrayEquals(c.GetCertHash(HashType.SHA1), SHA1Hash)) AddError("C-CSCBP19"); } catch { AddError("C-CSCBP20"); } try { if (!ArrayEquals(c.GetCertHash(HashType.MD5), MD5Hash)) AddError("C-CSCBP21"); } catch { AddError("C-CSCBP22"); } try { if (c.GetEffectiveDate().ToFileTime() != 0x1C29FBC26000A00) AddError("C-CSCBP23"); } catch { AddError("C-CSCBP24"); } try { if (c.GetExpirationDate().ToFileTime() != 0x1C3BE8F04678600) AddError("C-CSCBP25"); } catch { AddError("C-CSCBP26"); } try { StringCollection sc = c.GetEnhancedKeyUsage(); if (sc.Count != 1) AddError("C-CSCBP27"); if (!sc.Contains("1.3.6.1.5.5.7.3.1")) AddError("C-CSCBP28"); } catch { AddError("C-CSCBP29"); } try { if (c.GetFormat() != "X509") AddError("C-CSCBP30"); } catch { AddError("C-CSCBP31"); } try { if (!ArrayEquals(BitConverter.GetBytes(c.GetHashCode()), HashCode)) AddError("C-CSCBP32"); } catch { AddError("C-CSCBP33"); } try { if (c.GetIntendedKeyUsage() != 48) // 48 == Data Encipherment and Key Encipherment AddError("C-CSCBP34"); } catch { AddError("C-CSCBP35"); } try { if (c.GetIssuerName() != "Mentalis.org Certificate Authority") AddError("C-CSCBP36"); } catch { AddError("C-CSCBP37"); } try { if (c.GetKeyAlgorithm() != "1.2.840.113549.1.1.5") AddError("C-CSCBP38"); } catch { AddError("C-CSCBP39"); } try { if (c.GetKeyAlgorithmParametersString() != "0500") AddError("C-CSCBP40"); } catch { AddError("C-CSCBP41"); } try { if (c.GetName() != "Mentalis.org Team") AddError("C-CSCBP42"); } catch { AddError("C-CSCBP43"); } try { if (c.GetPublicKeyLength() != 1024) AddError("C-CSCBP44"); } catch { AddError("C-CSCBP45"); } try { if (c.GetPublicKeyString() != "30818902818100BC7B73D8F2A48B17684E49A1425252FD1D8354E2B3202B79BE5764EF2ADD6D413AE8F6E327FBFC4FB3F274357FEE7478BB28AE58975F73BE510F49E4545665B3B3443FD52C27A0DF6B6D8A3AAB5A42C3DEC14CB9A85955C57A99661FB99FE08363E460BEFFFF33C4B6F9F87B12FD6F5D7F2A8AEF6EFA2DA5FAF7EBD72B8B87170203010001") AddError("C-CSCBP46"); } catch { AddError("C-CSCBP47"); } try { if (!ArrayEquals(RawData, c.GetRawCertData())) AddError("C-CSCBP48"); } catch { AddError("C-CSCBP49"); } try { if (!ArrayEquals(c.GetSerialNumber(), Serial)) AddError("C-CSCBP50"); } catch { AddError("C-CSCBP51"); } try { if (!ArrayEquals(RawData, c.ToCerBuffer())) AddError("C-CSCBP52"); } catch { AddError("C-CSCBP53"); } return tests; }