aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAdam Janovsky2020-11-16 19:49:08 +0100
committerAdam Janovsky2020-11-16 19:49:08 +0100
commit2fe9d4e6ad819d7b7e6c13326890ab2a4c39b14c (patch)
treea998e8a53ba0799605dd8f67b686827e85709009
parentfe9d02cf7191c0ab1fe949cb2fa4770a478c0340 (diff)
downloadsec-certs-2fe9d4e6ad819d7b7e6c13326890ab2a4c39b14c.tar.gz
sec-certs-2fe9d4e6ad819d7b7e6c13326890ab2a4c39b14c.tar.zst
sec-certs-2fe9d4e6ad819d7b7e6c13326890ab2a4c39b14c.zip
Added basic OOP tests for CC dataset and cert
-rw-r--r--sec_certs/dataset.py7
-rw-r--r--sec_certs/helpers.py4
-rw-r--r--test/data/test_cc_oop/cc_products_active.csv3
-rw-r--r--test/data/test_cc_oop/cc_products_active.html654
-rw-r--r--test/data/test_cc_oop/fictional_cert.json30
-rw-r--r--test/data/test_cc_oop/toy_dataset.json50
-rw-r--r--test/test_cc_oop.py127
7 files changed, 872 insertions, 3 deletions
diff --git a/sec_certs/dataset.py b/sec_certs/dataset.py
index b50285c5..7493f615 100644
--- a/sec_certs/dataset.py
+++ b/sec_certs/dataset.py
@@ -241,7 +241,6 @@ class CCDataset(Dataset):
html_sources = [x for x in html_sources if 'active' not in x or get_active]
html_sources = [x for x in html_sources if 'archived' not in x or get_archived]
-
new_certs = {}
for file in html_sources:
partial_certs = self.parse_single_html(self.web_dir / file)
@@ -264,7 +263,11 @@ class CCDataset(Dataset):
def parse_table(soup: BeautifulSoup, table_id: str, category_string: str) -> Dict[str, 'CommonCriteriaCert']:
tables = soup.find_all('table', id=table_id)
- assert len(tables) == 1
+ assert len(tables) <= 1
+
+ if not tables:
+ return {}
+
table = tables[0]
rows = list(table.find_all('tr'))
header, footer, body = rows[0], rows[1], rows[2:]
diff --git a/sec_certs/helpers.py b/sec_certs/helpers.py
index 35ae843d..da5e73d7 100644
--- a/sec_certs/helpers.py
+++ b/sec_certs/helpers.py
@@ -58,7 +58,9 @@ def sanitize_string(record: str) -> Union[str, None]:
return None
else:
# TODO: There is a certificate with name 'ATMEL Secure Microcontroller AT90SC12872RCFT &#x2f; AT90SC12836RCFT rev. I &amp;&#x23;38&#x3b; J' that has to be unescaped twice
- return html.unescape(html.unescape(record)).replace('\r\n', ' ').replace('\n', '')
+ string = html.unescape(html.unescape(record)).replace('\n', '')
+ return ' '.join(string.split())
+
def sanitize_security_levels(record: Union[str, set]) -> set:
diff --git a/test/data/test_cc_oop/cc_products_active.csv b/test/data/test_cc_oop/cc_products_active.csv
new file mode 100644
index 00000000..2561a372
--- /dev/null
+++ b/test/data/test_cc_oop/cc_products_active.csv
@@ -0,0 +1,3 @@
+Category,Name,Manufacturer,Scheme,Assurance Level,Protection Profile(s),Certification Date,Archived Date,Certification Report URL,Security Target URL,Maintenance Date,Maintenance Title,Maintenance Report,Maintenance ST
+Access Control Devices and Systems,NetIQ Identity Manager 4.7,NetIQ Corporation,SE,"EAL3+,ALC_FLR.2",,06/15/2020,06/15/2025,http://www.commoncriteriaportal.org:443/files/epfiles/Certification Report - NetIQ® Identity Manager 4.7.pdf,http://www.commoncriteriaportal.org:443/files/epfiles/ST - NetIQ Identity Manager 4.7.pdf,,,,
+Access Control Devices and Systems,Magic SSO V4.0,"Dreamsecurity Co., Ltd.",KR,None,KECS-PP-0822-2017 SSO V1.0,11/15/2019,11/15/2024,http://www.commoncriteriaportal.org:443/files/epfiles/KECS-CR-19-70 Magic SSO V4.0(eng) V1.0.pdf,http://www.commoncriteriaportal.org:443/files/epfiles/Magic_SSO_V4.0-ST-v1.4_EN.pdf,,,,
diff --git a/test/data/test_cc_oop/cc_products_active.html b/test/data/test_cc_oop/cc_products_active.html
new file mode 100644
index 00000000..463fc51a
--- /dev/null
+++ b/test/data/test_cc_oop/cc_products_active.html
@@ -0,0 +1,654 @@
+<!--Manticore2004-->
+<!--Manticore2004-->
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+<!-- no action (no SSL on dev box) -->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
+
+<head>
+ <meta name="description" content="" />
+ <meta name="keywords" content="" />
+ <meta name="classification" content="Internet" />
+ <meta name="distribution" content="Global" />
+ <meta name="rating" content="Safe For Kids" />
+ <meta name="copyright" content="public domain" />
+ <meta name="language" content="en" />
+
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <meta http-equiv="Accept-Encoding" content="compress, gzip" />
+
+
+ <title>Certified Products : New CC Portal</title>
+
+
+ <link href="/assets/css/main.css" rel="stylesheet" type="text/css" />
+ <link href="/assets/css/print.css" rel="stylesheet" type="text/css" media="print" />
+ <link href="/assets/js/jQuery/themes/base/jquery.ui.all.css" rel="stylesheet" type="text/css" />
+ <link href="/assets/js/jQuery/plugins/tabs/tabs.css" rel="stylesheet" type="text/css" />
+ <!--[if lt IE 7]>
+ <link href="/assets/css/ie-lt-7.css" rel="stylesheet" type="text/css" />
+<![endif]-->
+ <!--[if gte IE 7]>
+ <link href="/assets/css/ie7.css" rel="stylesheet" type="text/css" />
+<![endif]-->
+
+
+ <script src="/assets/js/jQuery/js/jquery-1.7.2.min.js" type="text/javascript"></script>
+ <script src="/assets/js/jQuery/js/jquery-ui-1.8.4.custom.min.js" type="text/javascript"></script>
+ <script src="/assets/js/jQuery/plugins/metadata/jquery.metadata.js" type="text/javascript"></script>
+
+ <script src="/assets/js/jQuery/plugins/tabs/jquery.tools.min.js" type="text/javascript"></script>
+
+
+ <!-- jstablesorter sppt -->
+ <script src="/assets/js/jQuery/plugins/tablesorter/jquery.tablesorter.min.js" type="text/javascript"></script>
+ <link href="/assets/js/jQuery/plugins/tablesorter/css/style.css" rel="stylesheet" type="text/css" />
+ <!-- END jstablesorter sppt -->
+
+
+
+
+ <link rel="alternate" title="Protection Profiles" href="../rss/pps.xml" type="application/rss+xml" />
+
+ <link rel="Shortcut Icon" type="image/ico" href="/assets/images/cc.ico" />
+
+
+ <!-- assets/includes/SQL_Check.cfm -->
+ <!-- ??? ???????? -->
+ <!-- 2012.03.15 - 2012.XX.XX -->
+
+ <!-- This page creates and manages a list of IP addresses to be blocked due -->
+ <!-- to dangerous requests which may be SQL Injection Attacks -->
+ <!-- Included in the site's std header: assets/includes/header.cfm -->
+ <!--Corregidor-->
+
+
+
+
+
+
+
+
+
+ <!--Corregidor-->
+
+
+
+
+
+
+
+
+ <!-- 2012.03.15 - 2012.XX.XX - Initial dev//??? -->
+ <!-- 2012.07.11 - Last mod before 2016//??? -->
+ <!-- 2016.06.23 - Cleanup, minor edits, and comments added//KC -->
+
+
+</head>
+
+
+<!-- 2017.09.07 - Adjusted jstablesorter sppt//KC -->
+
+
+
+<body>
+
+
+ <div id="wrap">
+
+
+ <div id="banner">
+ <p class="topNav">
+ <a href="/sitemap/" title="View the sitemap"> Sitemap</a> &nbsp; | &nbsp;
+
+ <a href="/contact/message/" title="Contact us">Contact</a>
+ &nbsp;&nbsp;
+ </p>
+
+ <!-- Google CSE Search Box Begins -->
+
+ <div id="searchbox">
+ <form id="016233930414485990345:f_zj6spfpx4" action="/search/" style="margin:0;padding:0">
+ <span style="white-space:nowrap">
+ <input type="hidden" name="cx" value="016233930414485990345:f_zj6spfpx4" />
+ <input type="hidden" name="cof" value="FORID:11" />
+ <input type="hidden" name="ie" value="UTF-8" />
+ <input name="q" type="text" size="30" />
+ <input type="submit" name="sa" value="Search" />
+ </span>
+ </form>
+ </div>
+ <script type="text/javascript"
+ src="//www.google.com/coop/cse/brand?form=searchbox_016233930414485990345:f_zj6spfpx4"></script>
+
+ <!-- Google CSE Search Box Ends -->
+
+ </div>
+ <div id="logo">
+
+ <p>
+
+ <a href="https://www.commoncriteriaportal.org/members/account/login/">Login &nbsp; <img
+ src="/assets/images/icon_arrow.png" /> </a>
+
+
+ </p>
+ </div>
+ <!--[if gte IE 9]>
+ <style type="text/css">
+ .gradient {
+ filter: none;
+ }$(function() {
+
+ $( "#menutabs" ).menutabs();
+
+
+ </style>
+<![endif]-->
+ <!-- >
+ <style type="text/css">
+ .trad-blink {
+ animation: blinker 1.5s cubic-bezier(.5, 0, 1, 1) infinite alternate;
+ }
+ @keyframes blinker {
+ from { opacity: 1; }
+ to { opacity: .2;}
+ }
+ </style>
+< -->
+
+ <div id="menutabs">
+
+ <ul class="menutabs menuitem">
+ <li><a href="/news/" title="News">
+ NEWS</a></li>
+ <li class="inline-code trad-blink"> <a href="/iccc/" title="ICCC">
+ ICCC</a></li>
+ <li>
+ <a href="/pps/" title="Protection Profiles">
+ PROTECTION PROFILES </a> </li>
+ <li>
+ <a href="/pps/?cpp=1" title="Collaborative Protection Profiles">
+ COLLABORATIVE PPS </a> </li>
+
+ <li> <a href="/products/" title="Certified Products">
+ CERTIFIED PRODUCTS </a></li>
+ <li>
+ <a href="/communities/index.cfm" title="Technology Communities">
+ TECHNICAL COMMUNITIES</a></li>
+ <li>
+ <a href="/cc/">
+ PUBLICATIONS</a> </li>
+ <li><a href="/ccra/index.cfm">
+ ABOUT THE CC</a></li>
+ <li><a href="/">HOME</a></li>
+
+ </ul>
+
+
+
+
+ </div>
+
+
+ <div id="slides">
+ <div class="slides_container">
+
+
+
+ <div><img src="/assets/images/slides/certified_products_banner.jpg"></div>
+
+
+ <br />
+
+ </div>
+
+ </div>
+
+ <!--[if gte IE 9]>
+ <style type="text/css">
+ .gradient {
+ filter: none;
+ }
+ </style>
+<![endif]-->
+ <div id="content">
+
+
+ <h1 id="page_title">Certified Products</h1>
+
+
+
+
+ <!-- --------------------------------------------------------------------------------------------------------------
+ For those of you poking around in the page source, the following URL parameters are available on this page:
+ expand - auto-expand the tables after the page loads
+ names - display filenames for the certification report and security target files for easier (F)inding
+--------------------------------------------------------------------------------------------------------------- -->
+
+
+ <style type="text/css">
+ .gridTable thead,
+ .gridTable tbody,
+ .gridTable tfoot {
+ display: none
+ }
+
+ .gridTable caption a {
+ color: #333;
+ text-decoration: none
+ }
+
+ .gridTable caption {
+ text-align: left !important;
+ background: #fff
+ }
+ </style>
+
+ <script>
+ $(document).ready(function () {
+
+ $("a#toggle").click().toggle(
+ function () { openAll() },
+ function () { closeAll() }
+ );
+ $("a.toggle").click().toggle(
+ function () { openTbl(this.name); },
+ function () { closeTbl(this.name); }
+ );
+
+ function openAll() {
+ $(".gridTable caption").css({ 'background': '#333' });
+ $(".gridTable caption a").css({ 'color': '#fff' });
+ $(".gridTable thead").show();
+ $(".gridTable tbody").show();
+ $(".gridTable tfoot").show();
+ $("a[id^='toggle'] img").attr("src", "/assets/images/minicon.gif");
+ }
+ function closeAll() {
+ $(".gridTable caption").css({ 'background': '#fff' });
+ $(".gridTable caption a").css({ 'color': '#333' });
+ $(".gridTable thead").hide();
+ $(".gridTable tbody").hide();
+ $(".gridTable tfoot").hide();
+ $("a[id^='toggle'] img").attr("src", "/assets/images/plusicon.gif");
+ }
+ function openTbl(tbl) {
+ $(".gridTable#tbl" + tbl + " caption").css({ 'background': '#333' });
+ $(".gridTable#tbl" + tbl + " caption a").css({ 'color': '#fff' });
+ $(".gridTable#tbl" + tbl + " thead").show();
+ $(".gridTable#tbl" + tbl + " tbody").show();
+ $(".gridTable#tbl" + tbl + " tfoot").show();
+ $("a#toggle" + tbl + " img").attr("src", "/assets/images/minicon.gif");
+ }
+ function closeTbl(tbl) {
+ $(".gridTable#tbl" + tbl + " caption").css({ 'background': '#fff' });
+ $(".gridTable#tbl" + tbl + " caption a").css({ 'color': '#333' });
+ $(".gridTable#tbl" + tbl + " thead").hide();
+ $(".gridTable#tbl" + tbl + " tbody").hide();
+ $(".gridTable#tbl" + tbl + " tfoot").hide();
+ $("a#toggle" + tbl + " img").attr("src", "/assets/images/plusicon.gif");
+ }
+
+ function showProgress() {
+ $('#progress').css({ 'display': 'block' });
+ $('#content').attr('disabled', true);
+ }
+ function hideProgress() {
+ $('#progress').css({ 'display': 'none' });
+ $('#content').removeAttr('disabled');
+ }
+ });
+ </script>
+
+ <div class="noprint" style="float:right;margin-top:-3.5em;margin-right:1em;white-space:nowrap">
+
+ <a href="./stats/" title="View the Certified Products Statistics" class="button2">Statistics</a>
+ &nbsp;&nbsp;&nbsp;
+ <a href="certified_products.csv" title="Download the Certified Products List as a CSV file" class="button2">
+ <img src="/assets/images/icon_csv.gif" height="16" width="15" alt="" align="top"> Download CSV
+ </a>
+ &nbsp;&nbsp;&nbsp;
+ <a href="index.cfm?archived=1" title="View the Archived Certified Products List" class="button2">Archived
+ Certified Products</a>
+
+ </div>
+
+
+ <!-- Blurb for the active list -->
+ <p>
+ The Common Criteria Recognition Arrangement covers certificates with claims of compliance against Common
+ Criteria assurance components of either:&nbsp;
+ </p>
+ <ol>
+ <li /> a collaborative Protection Profile (cPP), developed and maintained in accordance with CCRA Annex K,
+ with assurance activities selected from Evaluation Assurance Levels up to and including level 4 and ALC_FLR,
+ developed through an International Technical Community endorsed by the Management Committee; or
+ <li /> Evaluation Assurance Levels 1 through 2 and ALC_FLR.&nbsp;
+ </ol>
+ <p class="b">
+ Where a CC certificate claims compliance to Evaluation Assurance Level 3 or higher, but does not claim
+ compliance to a collaborative Protection Profile, then for purposes of mutual recognition under the CCRA,
+ the CC certificate should be treated as equivalent to Evaluation Assurance Level 2.&nbsp;
+ </p>
+ <p>
+ The CCDB has approved a resolution to limit the validity of mutually recognized CC certificates over
+ time.&nbsp;
+ Certificates will remain on the CPL for five years.&nbsp;
+ Effective 1 June 2019, certificates with an expired validity period (that is, 5 years or more from the date
+ of certificate issuance) will be moved to an Archive list on the CCRA portal, unless the validity period has
+ been extended using the appropriate procedures.&nbsp;
+ </p>
+ <!--
+ <p>
+ The CCDB has approved a resolution to limit the validity of mutually recognized CC certificates over time.&nbsp;
+ Certificates will remain on the CPL for five years.&nbsp;
+ Effective 1 June 2019, certificates with an expired validity period (that is, 5 years or more from the date of certificate issuance) will be moved to an Archive list on the CCRA portal
+ </p>
+ <p>
+ The CCDB has approved a resolution to limit the validity of mutually recognized CC certificates over time.&nbsp;
+ Certificates will remain on the CPL for five years.&nbsp;
+ Effective 1 June 2019, certificates with an expired validity period (that is, 5 years or more from the date of certificate issuance) will be moved to an Archive list on the CCRA portal.&nbsp;
+ Certificates fully recognized under the CCRA must claim conformance to either a collaborative Protection Profile (cPP) or EAL1-2.&nbsp;
+ <p>
+ -->
+
+
+
+
+
+
+ <h4 id="operations">
+ <a href="#" id="toggle">expand/collapse all categories</a>
+ </h4>
+
+
+ <div id="white">
+
+
+
+ <table class="tablesorter gridTable" id="tblAC" style="width:97%;margin-left: 1em;margin-top:-.5em">
+
+ <thead>
+ <tr>
+ <!-- zxcv class="title2" -->
+
+ <th id="col_1" class="text " style=";text-align:center;width:45%;max-width:45%">Product</th>
+
+
+ <th id="col_2" class="text " style=";text-align:center;width:10%;max-width:10%">Vendor</th>
+
+
+ <th id="col_3" class="text " style=";text-align:center;width:10%;max-width:10%">
+ Product<br />Certificate</th>
+
+
+ <th id="col_4" class="date-iso sortfirstasc " style=";text-align:center;width:10%;max-width:10%">
+ Date&nbsp;Certificate<br />Issued</th>
+
+
+ <th id="col_5" class="date-iso sortfirstasc " style=";text-align:center;width:10%;max-width:10%">
+ Certificate<br />Validity<br />Expiration<br />Date</th>
+
+
+ <th id="col_6" class="text " style=";text-align:center;width:5%;max-width:5%">Compliance</th>
+
+
+ <th id="col_7" class="text last_th" style=";text-align:center;width:10%;max-width:10%">Scheme</th>
+
+
+ </tr>
+ </thead>
+ <!-- 2017.09.06 - Copied to CC Portal from NIAP site//KC -->
+ <!-- 2017.09.06 - Converted tabs to spaces//KC -->
+
+ <tfoot class="hilite7">
+ <!-- hilite1 -->
+ <tr class="">
+ <td colspan="7" class="txt1 c i">
+ This list was generated on Wednesday, November 11, 2020, at 10:47 AM
+ </td>
+ </tr>
+ </tfoot>
+
+ <!-- 2017.09.06 - Copied to CC Portal from NIAP site + mods//KC -->
+
+
+ <caption style="font-weight:bold;font-size:larger">
+ <a name="AC" href="#AC" id="toggleAC" class="toggle"><img src="/assets/images/plusicon.gif" border="0"
+ height="11" width="11" class="toggle" style="margin-right:.5em" />Access Control Devices and
+ Systems &ndash; 27 Certified Products</a>
+ </caption>
+ <thead>
+
+
+ </thead>
+ <tfoot></tfoot>
+ <tbody>
+
+ <tr class="">
+ <td class="b">
+ <!-- ID: 2020.1111 -->
+ NetIQ Identity Manager 4.7<a name="2020.1111" style="text-decoration:none;">&nbsp;</a><span
+ title="2020.1111">&nbsp;</span>
+ <div class="none">
+ <!-- <a href="https&#x3a;&#x2f;&#x2f;www.netiq.com&#x2f;" title="Vendor's web site" target="_blank">NetIQ Corporation</a> -->
+ <img src="/assets/images/spacer.gif" width="600" height="1" class="" align="top"> <br />
+ <!-- ------ ------ ------ Document Links ------ ------ ------ -->
+ <div style="line-height:2.5em">
+ <a href="/files/epfiles/Certification Report - NetIQ® Identity Manager 4.7.pdf"
+ title="Certification Report: Certification Report - NetIQ® Identity Manager 4.7.pdf"
+ target="_blank" class="button2">Certification Report</a>
+ <a href="/files/epfiles/ST - NetIQ Identity Manager 4.7.pdf"
+ title="Security Target: ST - NetIQ Identity Manager 4.7.pdf" target="_blank"
+ class="button2">Security Target</a>
+
+ </div>
+ <!-- ------ ------ ------ END Document Links ------ ------ ------ -->
+ <!-- ------ ------ ------ Product Updates ------ ------ ------ -->
+
+ <!-- ------ ------ ------ END Product Updates ------ ------ ------ -->
+ </div>
+ </td>
+ <!--end-product-cell-->
+ <td>
+ <a href="https&#x3a;&#x2f;&#x2f;www.netiq.com&#x2f;" title="Vendor's web site"
+ target="_blank">NetIQ Corporation</a>
+ </td>
+ <td>
+
+ <a href="/files/epfiles/Certifikat CCRA - NetIQ Identity Manager 4.7_signed.pdf"
+ title="Certifikat CCRA - NetIQ Identity Manager 4.7_signed.pdf" target="_blank"
+ class="button2">CCRA Certificate</a>
+
+ </td>
+ <td style="text-align:center"><span title="2020.1111">2020-06-15</span></td>
+
+ <td style="text-align:center">2025-06-15</td>
+
+
+ <td>
+
+
+ EAL3+
+ <br />ALC_FLR.2
+ </td>
+
+ <td style="text-align:center">
+ <a href="/ccra/members/#SE">
+ <img src="/assets/images/flags/se.png"
+ alt="SE &ndash; Swedish Certification Body for IT Security FMV/CSEC"
+ title="SE &ndash; Swedish Certification Body for IT Security FMV/CSEC" height="32"
+ width="32" style="margin-bottom:-1em" /><br />SE</a>
+ </td>
+ </tr>
+
+ <tr class="even">
+ <td class="b">
+ <!-- ID: 2019.1265 -->
+ Magic SSO V4.0<a name="2019.1265" style="text-decoration:none;">&nbsp;</a><span
+ title="2019.1265">&nbsp;</span>
+ <div class="none">
+ <!-- <a href="https&#x3a;&#x2f;&#x2f;www.dreamsecurity.com&#x2f;" title="Vendor's web site" target="_blank">Dreamsecurity Co., Ltd.</a> -->
+ <img src="/assets/images/spacer.gif" width="600" height="1" class="" align="top"> <br />
+ <!-- ------ ------ ------ Document Links ------ ------ ------ -->
+ <div style="line-height:2.5em">
+ <a href="/files/epfiles/KECS-CR-19-70 Magic SSO V4.0(eng) V1.0.pdf"
+ title="Certification Report: KECS-CR-19-70 Magic SSO V4.0(eng) V1.0.pdf"
+ target="_blank" class="button2">Certification Report</a>
+ <a href="/files/epfiles/Magic_SSO_V4.0-ST-v1.4_EN.pdf"
+ title="Security Target: Magic_SSO_V4.0-ST-v1.4_EN.pdf" target="_blank"
+ class="button2">Security Target</a>
+
+ <!-- how it was before 2017.09
+ <a href="/files/ppfiles/KECS-PP-0822-2017 Korean National PP for Single Sign On V1.0(eng).pdf" target="_blank" class="button2" title="PP: Korean National Protection Profile for Single Sign On V1.0">Protection Profile</a> -->
+ <!-- ------------------------------------ -->
+ <!-- Set the display text for the link to the PP -->
+
+ <!-- ------------------------------------ -->
+ <br /><a
+ href="/files/ppfiles/KECS-PP-0822-2017 Korean National PP for Single Sign On V1.0(eng).pdf"
+ target="_blank" class="button2" title="">Korean National Protection Profile for Single
+ Sign On V1.0</a>
+
+ </div>
+ <!-- ------ ------ ------ END Document Links ------ ------ ------ -->
+ <!-- ------ ------ ------ Product Updates ------ ------ ------ -->
+
+ <!-- ------ ------ ------ END Product Updates ------ ------ ------ -->
+ </div>
+ </td>
+ <!--end-product-cell-->
+ <td>
+ <a href="https&#x3a;&#x2f;&#x2f;www.dreamsecurity.com&#x2f;" title="Vendor's web site"
+ target="_blank">Dreamsecurity Co., Ltd.</a>
+ </td>
+ <td>
+
+ &nbsp;
+
+ </td>
+ <td style="text-align:center"><span title="2019.1265">2019-11-15</span></td>
+
+ <td style="text-align:center">2024-11-15</td>
+
+
+ <td>
+
+
+ PP&nbsp;Compliant
+ </td>
+
+ <td style="text-align:center">
+ <a href="/ccra/members/#KR">
+ <img src="/assets/images/flags/kr.png"
+ alt="KR &ndash; IT Security Certification Center&#x28;ITSCC&#x29;"
+ title="KR &ndash; IT Security Certification Center&#x28;ITSCC&#x29;" height="32"
+ width="32" style="margin-bottom:-1em" /><br />KR</a>
+ </td>
+ </tr>
+
+ </tbody>
+ </table>
+
+
+ </div><!-- END white, i think -->
+
+
+
+
+
+ <!-- 2017.07.10 - Added blurb to active list re. archiving in 2019//KC -->
+ <!-- 2017.09.06 - 2017.09.08 - Big cosmetic changes per NIAP's request//KC -->
+ <!-- 2017.09.06 - Code clean-up in areas I touched//KC -->
+ <!-- 2017.09.08 - Converted page to one paired CFoutput tag//KC -->
+ <!-- 2018.04.03 - 2018.04.05 - Put compliance column back w a few changes//KC -->
+ <!-- 2018.10.04 - Added new text//KC -->
+ <!-- 2019.12.16 - Replaced Application.WebRoot w Application.CodeBase//KC -->
+ <!-- 2019.12.19 - Added product ID to comment & span title//KC -->
+
+
+ <div id="footer" class="copy">
+ <p>&nbsp;</p>
+
+ </div>
+
+
+ <script type="text/javascript" src="/assets/js/searchhi.js"></script>
+
+
+
+
+ <!-- jstablesorter sppt -->
+ <!-- zxcv - Should be w/in JSTableSorter -->
+
+ <script type="text/javascript">
+ $(document).ready(function () {
+ $.tablesorter.defaults.widgets = ['zebra']; // add stripes
+ $.tablesorter.defaults.sortList = [[3, 1]]; // default sort column(s)
+ $('table').tablesorter({ headers: { 5: { sorter: false } } }); // enable sort & disable sort on specific column(s)
+ });
+ </script>
+ <!-- END jstablesorter sppt -->
+
+
+ <!--[if lt IE 8]>
+<script src="/assets/js/ie7-js/IE8.js" type="text/javascript"></script>
+<![endif]-->
+
+
+ <!-- Google Analytics -->
+ <script type="text/javascript">
+ var _gaq = _gaq || [];
+ _gaq.push(['_setAccount', 'UA-1394658-2']);
+ _gaq.push(['_trackPageview']);
+ (function () {
+ var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+ ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+ })();
+ </script>
+
+
+
+
+
+ <!-- 2017.09.07 - Added jstablesorter sppt//KC -->
+
+
+ </div>
+ </div>
+</body>
+
+</html> \ No newline at end of file
diff --git a/test/data/test_cc_oop/fictional_cert.json b/test/data/test_cc_oop/fictional_cert.json
new file mode 100644
index 00000000..44a422db
--- /dev/null
+++ b/test/data/test_cc_oop/fictional_cert.json
@@ -0,0 +1,30 @@
+{
+ "category": "Sample category",
+ "name": "Sample certificate name",
+ "manufacturer": "Sample manufacturer",
+ "scheme": "Sample scheme",
+ "security_level": [
+ "Sample security level"
+ ],
+ "not_valid_before": "1900-01-02",
+ "not_valid_after": "1900-01-03",
+ "report_link": "http://path.to/report/link",
+ "st_link": "http://path.to/st/link",
+ "src": "custom",
+ "cert_link": "http://path.to/cert/link",
+ "manufacturer_web": "http://path.to/manufacturer/web",
+ "protection_profiles": [
+ {
+ "pp_name": "sample_pp",
+ "pp_link": "http://sample.pp"
+ }
+ ],
+ "maintainance_updates": [
+ {
+ "maintainance_date": "1900-01-01",
+ "maintainance_title": "Sample maintainance",
+ "maintainance_report_link": "https://maintainance.up",
+ "maintainance_st_link": "https://maintainance.up"
+ }
+ ]
+} \ No newline at end of file
diff --git a/test/data/test_cc_oop/toy_dataset.json b/test/data/test_cc_oop/toy_dataset.json
new file mode 100644
index 00000000..49d612b5
--- /dev/null
+++ b/test/data/test_cc_oop/toy_dataset.json
@@ -0,0 +1,50 @@
+{
+ "root_dir": "/fictional/path/to/dataset",
+ "timestamp": "2020-11-16 17:04:14.770153",
+ "sha256_digest": "not implemented",
+ "name": "toy dataset",
+ "description": "toy dataset description",
+ "n_certs": 2,
+ "certs": [
+ {
+ "category": "Access Control Devices and Systems",
+ "name": "NetIQ Identity Manager 4.7",
+ "manufacturer": "NetIQ Corporation",
+ "scheme": "SE",
+ "security_level": [
+ "ALC_FLR.2",
+ "EAL3+"
+ ],
+ "not_valid_before": "2020-06-15",
+ "not_valid_after": "2025-06-15",
+ "report_link": "http://www.commoncriteriaportal.org/files/epfiles/Certification%20Report%20-%20NetIQ\u00ae%20Identity%20Manager%204.7.pdf",
+ "st_link": "http://www.commoncriteriaportal.org/files/epfiles/ST%20-%20NetIQ%20Identity%20Manager%204.7.pdf",
+ "src": "csv + html",
+ "cert_link": "http://www.commoncriteriaportal.org/files/epfiles/Certifikat%20CCRA%20-%20NetIQ%20Identity%20Manager%204.7_signed.pdf",
+ "manufacturer_web": "https://www.netiq.com/",
+ "protection_profiles": [],
+ "maintainance_updates": []
+ },
+ {
+ "category": "Access Control Devices and Systems",
+ "name": "Magic SSO V4.0",
+ "manufacturer": "Dreamsecurity Co., Ltd.",
+ "scheme": "KR",
+ "security_level": [],
+ "not_valid_before": "2019-11-15",
+ "not_valid_after": "2024-11-15",
+ "report_link": "http://www.commoncriteriaportal.org/files/epfiles/KECS-CR-19-70%20Magic%20SSO%20V4.0(eng)%20V1.0.pdf",
+ "st_link": "http://www.commoncriteriaportal.org/files/epfiles/Magic_SSO_V4.0-ST-v1.4_EN.pdf",
+ "src": "csv + html",
+ "cert_link": null,
+ "manufacturer_web": "https://www.dreamsecurity.com/",
+ "protection_profiles": [
+ {
+ "pp_name": "Korean National Protection Profile for Single Sign On V1.0",
+ "pp_link": "http://www.commoncriteriaportal.org/files/ppfiles/KECS-PP-0822-2017%20Korean%20National%20PP%20for%20Single%20Sign%20On%20V1.0(eng).pdf"
+ }
+ ],
+ "maintainance_updates": []
+ }
+ ]
+} \ No newline at end of file
diff --git a/test/test_cc_oop.py b/test/test_cc_oop.py
new file mode 100644
index 00000000..c29e90e3
--- /dev/null
+++ b/test/test_cc_oop.py
@@ -0,0 +1,127 @@
+from unittest import TestCase
+from pathlib import Path
+from tempfile import TemporaryDirectory, mkstemp
+from datetime import date, datetime
+import json
+import filecmp
+import shutil
+import os
+
+from sec_certs.dataset import CCDataset, DatasetJSONDecoder, DatasetJSONEncoder
+from sec_certs.certificate import CommonCriteriaCert
+
+
+class TestCommonCriteriaOOP(TestCase):
+ def setUp(self):
+ self.test_data_dir = Path(__file__).parent / 'data' / 'test_cc_oop'
+ self.crt_one = CommonCriteriaCert('Access Control Devices and Systems',
+ 'NetIQ Identity Manager 4.7',
+ 'NetIQ Corporation',
+ 'SE',
+ {'ALC_FLR.2',
+ 'EAL3+'},
+ date(2020, 6, 15),
+ date(2025, 6, 15),
+ 'http://www.commoncriteriaportal.org/files/epfiles/Certification%20Report%20-%20NetIQ\u00ae%20Identity%20Manager%204.7.pdf',
+ 'http://www.commoncriteriaportal.org/files/epfiles/ST%20-%20NetIQ%20Identity%20Manager%204.7.pdf',
+ 'csv + html',
+ 'http://www.commoncriteriaportal.org/files/epfiles/Certifikat%20CCRA%20-%20NetIQ%20Identity%20Manager%204.7_signed.pdf',
+ 'https://www.netiq.com/',
+ set(),
+ set())
+
+ self.crt_two = CommonCriteriaCert('Access Control Devices and Systems',
+ 'Magic SSO V4.0',
+ 'Dreamsecurity Co., Ltd.',
+ 'KR',
+ set(),
+ date(2019, 11, 15),
+ date(2024, 11, 15),
+ 'http://www.commoncriteriaportal.org/files/epfiles/KECS-CR-19-70%20Magic%20SSO%20V4.0(eng)%20V1.0.pdf',
+ 'http://www.commoncriteriaportal.org/files/epfiles/Magic_SSO_V4.0-ST-v1.4_EN.pdf',
+ 'csv + html',
+ None,
+ 'https://www.dreamsecurity.com/',
+ {CommonCriteriaCert.ProtectionProfile('Korean National Protection Profile for Single Sign On V1.0',
+ 'http://www.commoncriteriaportal.org/files/ppfiles/KECS-PP-0822-2017%20Korean%20National%20PP%20for%20Single%20Sign%20On%20V1.0(eng).pdf')},
+ set())
+
+ pp = CommonCriteriaCert.ProtectionProfile('sample_pp', 'http://sample.pp')
+ update = CommonCriteriaCert.MaintainanceReport(date(1900, 1, 1), 'Sample maintainance', 'https://maintainance.up', 'https://maintainance.up')
+ self.fictional_cert = CommonCriteriaCert('Sample category',
+ 'Sample certificate name',
+ 'Sample manufacturer',
+ 'Sample scheme',
+ {'Sample security level'},
+ date(1900, 1, 2),
+ date(1900, 1, 3),
+ 'http://path.to/report/link',
+ 'http://path.to/st/link',
+ 'custom',
+ 'http://path.to/cert/link',
+ 'http://path.to/manufacturer/web',
+ {pp},
+ {update})
+ self.template_dataset = CCDataset({self.crt_one.dgst: self.crt_one, self.crt_two.dgst: self.crt_two}, Path('/fictional/path/to/dataset'), 'toy dataset', 'toy dataset description')
+ self.template_dataset.timestamp = datetime(2020, 11, 16, hour=17, minute=4, second=14, microsecond=770153)
+
+ def test_certificate_input_sanity(self):
+ self.assertEqual(self.crt_one.report_link,
+ 'http://www.commoncriteriaportal.org/files/epfiles/Certification%20Report%20-%20NetIQ®%20Identity%20Manager%204.7.pdf',
+ 'Report link contains some improperly escaped characters.')
+
+ @staticmethod
+ def equal_to_json(referential_path, obj):
+ fd, path = mkstemp()
+ try:
+ with os.fdopen(fd, 'w') as handle:
+ json.dump(obj, handle, cls=DatasetJSONEncoder, indent=4)
+
+ return filecmp.cmp(referential_path, path)
+ finally:
+ os.remove(path)
+
+ @staticmethod
+ def equal_from_json(referential_path, obj):
+ with open(referential_path, 'r') as handle:
+ new_obj = json.load(handle, cls=DatasetJSONDecoder)
+ return obj == new_obj
+
+ def test_cert_to_json(self):
+ self.assertTrue(self.equal_to_json(self.test_data_dir / 'fictional_cert.json', self.fictional_cert),
+ 'The certificate serialized to json differs from a template.')
+
+ def test_dataset_to_json(self):
+ self.assertTrue(self.equal_to_json(self.test_data_dir / 'toy_dataset.json', self.template_dataset),
+ 'The dataset serialized to json differs from a template.')
+
+ def test_cert_from_json(self):
+ self.assertTrue(self.equal_from_json(self.test_data_dir / 'fictional_cert.json', self.fictional_cert),
+ 'The certificate serialized from json differs from a template.')
+
+ def test_dataset_from_json(self):
+ self.assertTrue(self.equal_from_json(self.test_data_dir / 'toy_dataset.json', self.template_dataset),
+ 'The dataset serialized from json differs from a template.')
+
+ def test_build_empty_dataset(self):
+ with TemporaryDirectory() as tmp_dir:
+ dset = CCDataset({}, Path(tmp_dir), 'sample_dataset', 'sample dataset description')
+ dset.get_certs_from_web(to_download=False, get_archived=False, get_active=False)
+ self.assertEqual(len(dset), 0, 'The dataset should contain 0 files.')
+
+ def test_build_dataset(self):
+ with TemporaryDirectory() as tmp_dir:
+ dataset_path = Path(tmp_dir)
+ os.mkdir(dataset_path / 'web')
+ shutil.copyfile(self.test_data_dir / 'cc_products_active.csv', dataset_path / 'web' / 'cc_products_active.csv')
+ shutil.copyfile(self.test_data_dir / 'cc_products_active.html', dataset_path / 'web' / 'cc_products_active.html')
+
+ dset = CCDataset({}, dataset_path, 'sample_dataset', 'sample dataset description')
+ dset.get_certs_from_web(keep_metadata=False, to_download=False, get_archived=False, get_active=True)
+
+ self.assertEqual(len(os.listdir(dataset_path)), 0,
+ 'Meta files (csv, html) were not deleted properly albeit this was explicitly required.')
+
+ self.assertEqual(len(dset), 2, 'The dataset should contain 2 files.')
+ self.assertTrue(self.crt_one in dset, 'The dataset does not contain the template certificate.')
+ self.assertEqual(dset, self.template_dataset, 'The loaded dataset does not match the template dataset.')