{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "40eb700c",
   "metadata": {},
   "source": [
    "## Dependency analysis\n",
    "\n",
    "This notebook contains analysis of dependencies in Common Criteria certificates."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "32456ebd",
   "metadata": {},
   "source": [
    "### Interesting occurences I have noticed during analysing data\n",
    "- 3970 certificates referencing no other certificates: directly_affecting == Nan && indirectly_affecting == NaN\n",
    "- 158 certificates which are affected by at least one certificates and affecting no certificates.\n",
    "- 311 certificates are affected by at least one archived certicates.\n",
    "- 16 BSI certificates affecting ANSSI certificates out of total 831 BSI certs.\n",
    "- 38 ANSSI certificates affecting BSI certificates out of total 682 ANSSI certs.\n",
    "- 25 certificates are crossed referenced\n",
    "- Certificates with security level EAL6+ are directly affecting other certificates with levels: {'EAL6+': 38, 'EAL5+': 6, 'EAL4+': 5} (EAL6+ is directly affecting certificates with lower security levels)\n",
    "- Most common security level among smart-cards is EAL5+ with 671 occurences.\n",
    "- Highest Smart Card BSI level: EAL6+, most common level: EAL4+\n",
    "- Highest Smart Card ANSSI level: EAL7, most common level: EAL5+\n",
    "- Lowest security level among smart cards in dataset: EAL1+ ['ATMEL AT90SC6464C Integrated circuit (reference AT568A9 rev. F)',\n",
    " 'CT2000 embedded Component (reference ST16RFHD50/RSG-A)',\n",
    " 'M/Chip Select v2.0.5.2 Application',\n",
    " 'MODEUS electronic purse : MODEUS carrier card v1.1 (reference : ST16RF58/RSE+) and SAM TC/C v1.1 retailer security module (reference : ST19SF16FF/RVN)',\n",
    " \"Oberthur B0' application v1.0.1 and GemClub v1.3 loaded on Javacard/VOP GemXpresso platform 211 V2\",\n",
    " 'Palmera Protect platform V2.0 JavaCard (SLE66CX320P/SB62 embedded component)',\n",
    " 'VOP 2.0.1 / Javacard 2.1.1 JPH33V2 Operating system version 1 installed on Integrated circuit PHILIPS P8WE5033',\n",
    " 'Javacard/VOP GemXpresso 211 platform (Philips Integrated circuit P8WE5032/MPH02)',\n",
    " 'Javacard/VOP GemXpresso 211 platform V2 (Philips P8WE5032/MPH04 embedded component, A000000018434D Card Manager)',\n",
    " 'S3C8975 for smart cards Integrated circuit',\n",
    " \"'Mondex Purse 2' electronic purse version 0203 component SLE66CX160S, MULTOS V4.1N operating system)\",\n",
    " \"B4/B0' V2 bank application of the MONEO/CB hybrid card (reference : ST19SF16B RCL version B303/B002)\",\n",
    " \"Javacard/VOP GemXpresso 211 platform (Philips P8WE5032/MPH02 Integrated circuit ) with Oberthur B0' v0.32 and Visa VSDC v1.08 applets\",\n",
    " 'MONEO electronic wallet card carrier (ST19SF16B RCL v. B303) and PSAM retailer security module (ST19SF16B RCL v. C103)']\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "f1e12b36",
   "metadata": {},
   "outputs": [],
   "source": [
    "import os\n",
    "import sys\n",
    "module_path = os.path.abspath(os.path.join('../..'))\n",
    "if module_path not in sys.path:\n",
    "    sys.path.append(module_path)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "36688df6",
   "metadata": {},
   "outputs": [],
   "source": [
    "import seaborn as sns\n",
    "import matplotlib.pyplot as plt\n",
    "import numpy as np\n",
    "import pandas as pd\n",
    "import collections \n",
    "import datetime\n",
    "\n",
    "from sec_certs.dataset import CCDataset\n",
    "from typing import Tuple, List\n",
    "\n",
    "plt.style.use(\"ggplot\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "257e2aa9",
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Dataset has 4616 rows and 20 columns.\n"
     ]
    }
   ],
   "source": [
    "dset: CCDataset = CCDataset.from_json(\"/home/george/Downloads/dependency_json_final2.json\")\n",
    "dset._compute_dependencies()\n",
    "df = dset.to_pandas()\n",
    "\n",
    "print(f\"Dataset has {df.shape[0]} rows and {df.shape[1]} columns.\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "e5b76a1a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>cert_id</th>\n",
       "      <th>name</th>\n",
       "      <th>status</th>\n",
       "      <th>category</th>\n",
       "      <th>manufacturer</th>\n",
       "      <th>scheme</th>\n",
       "      <th>security_level</th>\n",
       "      <th>not_valid_before</th>\n",
       "      <th>not_valid_after</th>\n",
       "      <th>report_link</th>\n",
       "      <th>st_link</th>\n",
       "      <th>manufacturer_web</th>\n",
       "      <th>extracted_versions</th>\n",
       "      <th>cpe_matches</th>\n",
       "      <th>verified_cpe_matches</th>\n",
       "      <th>related_cves</th>\n",
       "      <th>directly_affected_by</th>\n",
       "      <th>indirectly_affected_by</th>\n",
       "      <th>directly_affecting</th>\n",
       "      <th>indirectly_affecting</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dgst</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>a89ee15539d006d1</th>\n",
       "      <td>NaN</td>\n",
       "      <td>DriveLock Agent 2019.2 (Device and Application...</td>\n",
       "      <td>active</td>\n",
       "      <td>Access Control Devices and Systems</td>\n",
       "      <td>DriveLock SE</td>\n",
       "      <td>SE</td>\n",
       "      <td>[ALC_FLR.3, EAL3]</td>\n",
       "      <td>2021-04-07</td>\n",
       "      <td>2026-04-07</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>https://www.drivelock.com/</td>\n",
       "      <td>[2019.2]</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>309ac2fd7f2dcf17</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NetIQ Identity Manager 4.7</td>\n",
       "      <td>active</td>\n",
       "      <td>Access Control Devices and Systems</td>\n",
       "      <td>NetIQ Corporation</td>\n",
       "      <td>SE</td>\n",
       "      <td>[ALC_FLR.2, EAL3+]</td>\n",
       "      <td>2020-06-15</td>\n",
       "      <td>2025-06-15</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>https://www.netiq.com/</td>\n",
       "      <td>[4.7]</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8cf86948f02f047d</th>\n",
       "      <td>KECS-CR-19-70</td>\n",
       "      <td>Magic SSO V4.0</td>\n",
       "      <td>active</td>\n",
       "      <td>Access Control Devices and Systems</td>\n",
       "      <td>Dreamsecurity Co., Ltd.</td>\n",
       "      <td>KR</td>\n",
       "      <td>[]</td>\n",
       "      <td>2019-11-15</td>\n",
       "      <td>2024-11-15</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>https://www.dreamsecurity.com/</td>\n",
       "      <td>[4.0]</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0fc32111e368dcf5</th>\n",
       "      <td>NSCIB-CC-0006151-CR</td>\n",
       "      <td>NetIQ Access Manager 4.5</td>\n",
       "      <td>active</td>\n",
       "      <td>Access Control Devices and Systems</td>\n",
       "      <td>NetIQ, Incorporated</td>\n",
       "      <td>NL</td>\n",
       "      <td>[ALC_FLR.1, EAL3+]</td>\n",
       "      <td>2019-11-07</td>\n",
       "      <td>2024-11-07</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>https://www.netiq.com/</td>\n",
       "      <td>[4.5]</td>\n",
       "      <td>[cpe:2.3:a:netiq:access_manager:4.5:hotfix1:*:...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5e87de1cddf1ae43</th>\n",
       "      <td>NaN</td>\n",
       "      <td>Illumio Adaptive Security Platform v18.2.2</td>\n",
       "      <td>active</td>\n",
       "      <td>Access Control Devices and Systems</td>\n",
       "      <td>Illumio</td>\n",
       "      <td>CA</td>\n",
       "      <td>[]</td>\n",
       "      <td>2019-07-12</td>\n",
       "      <td>2024-07-12</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>https://www.illumio.com/</td>\n",
       "      <td>[18.2.2]</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                              cert_id  \\\n",
       "dgst                                    \n",
       "a89ee15539d006d1                  NaN   \n",
       "309ac2fd7f2dcf17                  NaN   \n",
       "8cf86948f02f047d        KECS-CR-19-70   \n",
       "0fc32111e368dcf5  NSCIB-CC-0006151-CR   \n",
       "5e87de1cddf1ae43                  NaN   \n",
       "\n",
       "                                                               name  status  \\\n",
       "dgst                                                                          \n",
       "a89ee15539d006d1  DriveLock Agent 2019.2 (Device and Application...  active   \n",
       "309ac2fd7f2dcf17                         NetIQ Identity Manager 4.7  active   \n",
       "8cf86948f02f047d                                     Magic SSO V4.0  active   \n",
       "0fc32111e368dcf5                           NetIQ Access Manager 4.5  active   \n",
       "5e87de1cddf1ae43         Illumio Adaptive Security Platform v18.2.2  active   \n",
       "\n",
       "                                            category             manufacturer  \\\n",
       "dgst                                                                            \n",
       "a89ee15539d006d1  Access Control Devices and Systems             DriveLock SE   \n",
       "309ac2fd7f2dcf17  Access Control Devices and Systems        NetIQ Corporation   \n",
       "8cf86948f02f047d  Access Control Devices and Systems  Dreamsecurity Co., Ltd.   \n",
       "0fc32111e368dcf5  Access Control Devices and Systems      NetIQ, Incorporated   \n",
       "5e87de1cddf1ae43  Access Control Devices and Systems                  Illumio   \n",
       "\n",
       "                 scheme      security_level not_valid_before not_valid_after  \\\n",
       "dgst                                                                           \n",
       "a89ee15539d006d1     SE   [ALC_FLR.3, EAL3]       2021-04-07      2026-04-07   \n",
       "309ac2fd7f2dcf17     SE  [ALC_FLR.2, EAL3+]       2020-06-15      2025-06-15   \n",
       "8cf86948f02f047d     KR                  []       2019-11-15      2024-11-15   \n",
       "0fc32111e368dcf5     NL  [ALC_FLR.1, EAL3+]       2019-11-07      2024-11-07   \n",
       "5e87de1cddf1ae43     CA                  []       2019-07-12      2024-07-12   \n",
       "\n",
       "                                                        report_link  \\\n",
       "dgst                                                                  \n",
       "a89ee15539d006d1  https://www.commoncriteriaportal.org/files/epf...   \n",
       "309ac2fd7f2dcf17  https://www.commoncriteriaportal.org/files/epf...   \n",
       "8cf86948f02f047d  https://www.commoncriteriaportal.org/files/epf...   \n",
       "0fc32111e368dcf5  https://www.commoncriteriaportal.org/files/epf...   \n",
       "5e87de1cddf1ae43  https://www.commoncriteriaportal.org/files/epf...   \n",
       "\n",
       "                                                            st_link  \\\n",
       "dgst                                                                  \n",
       "a89ee15539d006d1  https://www.commoncriteriaportal.org/files/epf...   \n",
       "309ac2fd7f2dcf17  https://www.commoncriteriaportal.org/files/epf...   \n",
       "8cf86948f02f047d  https://www.commoncriteriaportal.org/files/epf...   \n",
       "0fc32111e368dcf5  https://www.commoncriteriaportal.org/files/epf...   \n",
       "5e87de1cddf1ae43  https://www.commoncriteriaportal.org/files/epf...   \n",
       "\n",
       "                                manufacturer_web extracted_versions  \\\n",
       "dgst                                                                  \n",
       "a89ee15539d006d1      https://www.drivelock.com/           [2019.2]   \n",
       "309ac2fd7f2dcf17          https://www.netiq.com/              [4.7]   \n",
       "8cf86948f02f047d  https://www.dreamsecurity.com/              [4.0]   \n",
       "0fc32111e368dcf5          https://www.netiq.com/              [4.5]   \n",
       "5e87de1cddf1ae43        https://www.illumio.com/           [18.2.2]   \n",
       "\n",
       "                                                        cpe_matches  \\\n",
       "dgst                                                                  \n",
       "a89ee15539d006d1                                                NaN   \n",
       "309ac2fd7f2dcf17                                                NaN   \n",
       "8cf86948f02f047d                                                NaN   \n",
       "0fc32111e368dcf5  [cpe:2.3:a:netiq:access_manager:4.5:hotfix1:*:...   \n",
       "5e87de1cddf1ae43                                                NaN   \n",
       "\n",
       "                 verified_cpe_matches related_cves directly_affected_by  \\\n",
       "dgst                                                                      \n",
       "a89ee15539d006d1                  NaN          NaN                  NaN   \n",
       "309ac2fd7f2dcf17                  NaN          NaN                  NaN   \n",
       "8cf86948f02f047d                  NaN          NaN                  NaN   \n",
       "0fc32111e368dcf5                  NaN          NaN                  NaN   \n",
       "5e87de1cddf1ae43                  NaN          NaN                  NaN   \n",
       "\n",
       "                 indirectly_affected_by directly_affecting  \\\n",
       "dgst                                                         \n",
       "a89ee15539d006d1                    NaN                NaN   \n",
       "309ac2fd7f2dcf17                    NaN                NaN   \n",
       "8cf86948f02f047d                    NaN                NaN   \n",
       "0fc32111e368dcf5                    NaN                NaN   \n",
       "5e87de1cddf1ae43                    NaN                NaN   \n",
       "\n",
       "                 indirectly_affecting  \n",
       "dgst                                   \n",
       "a89ee15539d006d1                  NaN  \n",
       "309ac2fd7f2dcf17                  NaN  \n",
       "8cf86948f02f047d                  NaN  \n",
       "0fc32111e368dcf5                  NaN  \n",
       "5e87de1cddf1ae43                  NaN  "
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "98ac89ea",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "Index: 4616 entries, a89ee15539d006d1 to 09b17cb9b3c8b1bb\n",
      "Data columns (total 20 columns):\n",
      " #   Column                  Non-Null Count  Dtype         \n",
      "---  ------                  --------------  -----         \n",
      " 0   cert_id                 3252 non-null   object        \n",
      " 1   name                    4616 non-null   object        \n",
      " 2   status                  4616 non-null   category      \n",
      " 3   category                4616 non-null   category      \n",
      " 4   manufacturer            4615 non-null   object        \n",
      " 5   scheme                  4616 non-null   category      \n",
      " 6   security_level          4616 non-null   object        \n",
      " 7   not_valid_before        4616 non-null   datetime64[ns]\n",
      " 8   not_valid_after         4327 non-null   datetime64[ns]\n",
      " 9   report_link             4616 non-null   object        \n",
      " 10  st_link                 4616 non-null   object        \n",
      " 11  manufacturer_web        4554 non-null   object        \n",
      " 12  extracted_versions      4616 non-null   object        \n",
      " 13  cpe_matches             721 non-null    object        \n",
      " 14  verified_cpe_matches    356 non-null    object        \n",
      " 15  related_cves            758 non-null    object        \n",
      " 16  directly_affected_by    466 non-null    object        \n",
      " 17  indirectly_affected_by  466 non-null    object        \n",
      " 18  directly_affecting      646 non-null    object        \n",
      " 19  indirectly_affecting    646 non-null    object        \n",
      "dtypes: category(3), datetime64[ns](2), object(15)\n",
      "memory usage: 664.2+ KB\n"
     ]
    }
   ],
   "source": [
    "df.info()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "48d18524",
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>cert_id</th>\n",
       "      <th>name</th>\n",
       "      <th>status</th>\n",
       "      <th>category</th>\n",
       "      <th>manufacturer</th>\n",
       "      <th>scheme</th>\n",
       "      <th>security_level</th>\n",
       "      <th>not_valid_before</th>\n",
       "      <th>not_valid_after</th>\n",
       "      <th>report_link</th>\n",
       "      <th>st_link</th>\n",
       "      <th>manufacturer_web</th>\n",
       "      <th>extracted_versions</th>\n",
       "      <th>cpe_matches</th>\n",
       "      <th>verified_cpe_matches</th>\n",
       "      <th>related_cves</th>\n",
       "      <th>directly_affected_by</th>\n",
       "      <th>indirectly_affected_by</th>\n",
       "      <th>directly_affecting</th>\n",
       "      <th>indirectly_affecting</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dgst</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>a89ee15539d006d1</th>\n",
       "      <td>NaN</td>\n",
       "      <td>DriveLock Agent 2019.2 (Device and Application...</td>\n",
       "      <td>active</td>\n",
       "      <td>Access Control Devices and Systems</td>\n",
       "      <td>DriveLock SE</td>\n",
       "      <td>SE</td>\n",
       "      <td>[ALC_FLR.3, EAL3]</td>\n",
       "      <td>2021-04-07</td>\n",
       "      <td>2026-04-07</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>https://www.drivelock.com/</td>\n",
       "      <td>[2019.2]</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>309ac2fd7f2dcf17</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NetIQ Identity Manager 4.7</td>\n",
       "      <td>active</td>\n",
       "      <td>Access Control Devices and Systems</td>\n",
       "      <td>NetIQ Corporation</td>\n",
       "      <td>SE</td>\n",
       "      <td>[ALC_FLR.2, EAL3+]</td>\n",
       "      <td>2020-06-15</td>\n",
       "      <td>2025-06-15</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>https://www.netiq.com/</td>\n",
       "      <td>[4.7]</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8cf86948f02f047d</th>\n",
       "      <td>KECS-CR-19-70</td>\n",
       "      <td>Magic SSO V4.0</td>\n",
       "      <td>active</td>\n",
       "      <td>Access Control Devices and Systems</td>\n",
       "      <td>Dreamsecurity Co., Ltd.</td>\n",
       "      <td>KR</td>\n",
       "      <td>[]</td>\n",
       "      <td>2019-11-15</td>\n",
       "      <td>2024-11-15</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>https://www.dreamsecurity.com/</td>\n",
       "      <td>[4.0]</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0fc32111e368dcf5</th>\n",
       "      <td>NSCIB-CC-0006151-CR</td>\n",
       "      <td>NetIQ Access Manager 4.5</td>\n",
       "      <td>active</td>\n",
       "      <td>Access Control Devices and Systems</td>\n",
       "      <td>NetIQ, Incorporated</td>\n",
       "      <td>NL</td>\n",
       "      <td>[ALC_FLR.1, EAL3+]</td>\n",
       "      <td>2019-11-07</td>\n",
       "      <td>2024-11-07</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>https://www.netiq.com/</td>\n",
       "      <td>[4.5]</td>\n",
       "      <td>[cpe:2.3:a:netiq:access_manager:4.5:hotfix1:*:...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5e87de1cddf1ae43</th>\n",
       "      <td>NaN</td>\n",
       "      <td>Illumio Adaptive Security Platform v18.2.2</td>\n",
       "      <td>active</td>\n",
       "      <td>Access Control Devices and Systems</td>\n",
       "      <td>Illumio</td>\n",
       "      <td>CA</td>\n",
       "      <td>[]</td>\n",
       "      <td>2019-07-12</td>\n",
       "      <td>2024-07-12</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>https://www.illumio.com/</td>\n",
       "      <td>[18.2.2]</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                              cert_id  \\\n",
       "dgst                                    \n",
       "a89ee15539d006d1                  NaN   \n",
       "309ac2fd7f2dcf17                  NaN   \n",
       "8cf86948f02f047d        KECS-CR-19-70   \n",
       "0fc32111e368dcf5  NSCIB-CC-0006151-CR   \n",
       "5e87de1cddf1ae43                  NaN   \n",
       "\n",
       "                                                               name  status  \\\n",
       "dgst                                                                          \n",
       "a89ee15539d006d1  DriveLock Agent 2019.2 (Device and Application...  active   \n",
       "309ac2fd7f2dcf17                         NetIQ Identity Manager 4.7  active   \n",
       "8cf86948f02f047d                                     Magic SSO V4.0  active   \n",
       "0fc32111e368dcf5                           NetIQ Access Manager 4.5  active   \n",
       "5e87de1cddf1ae43         Illumio Adaptive Security Platform v18.2.2  active   \n",
       "\n",
       "                                            category             manufacturer  \\\n",
       "dgst                                                                            \n",
       "a89ee15539d006d1  Access Control Devices and Systems             DriveLock SE   \n",
       "309ac2fd7f2dcf17  Access Control Devices and Systems        NetIQ Corporation   \n",
       "8cf86948f02f047d  Access Control Devices and Systems  Dreamsecurity Co., Ltd.   \n",
       "0fc32111e368dcf5  Access Control Devices and Systems      NetIQ, Incorporated   \n",
       "5e87de1cddf1ae43  Access Control Devices and Systems                  Illumio   \n",
       "\n",
       "                 scheme      security_level not_valid_before not_valid_after  \\\n",
       "dgst                                                                           \n",
       "a89ee15539d006d1     SE   [ALC_FLR.3, EAL3]       2021-04-07      2026-04-07   \n",
       "309ac2fd7f2dcf17     SE  [ALC_FLR.2, EAL3+]       2020-06-15      2025-06-15   \n",
       "8cf86948f02f047d     KR                  []       2019-11-15      2024-11-15   \n",
       "0fc32111e368dcf5     NL  [ALC_FLR.1, EAL3+]       2019-11-07      2024-11-07   \n",
       "5e87de1cddf1ae43     CA                  []       2019-07-12      2024-07-12   \n",
       "\n",
       "                                                        report_link  \\\n",
       "dgst                                                                  \n",
       "a89ee15539d006d1  https://www.commoncriteriaportal.org/files/epf...   \n",
       "309ac2fd7f2dcf17  https://www.commoncriteriaportal.org/files/epf...   \n",
       "8cf86948f02f047d  https://www.commoncriteriaportal.org/files/epf...   \n",
       "0fc32111e368dcf5  https://www.commoncriteriaportal.org/files/epf...   \n",
       "5e87de1cddf1ae43  https://www.commoncriteriaportal.org/files/epf...   \n",
       "\n",
       "                                                            st_link  \\\n",
       "dgst                                                                  \n",
       "a89ee15539d006d1  https://www.commoncriteriaportal.org/files/epf...   \n",
       "309ac2fd7f2dcf17  https://www.commoncriteriaportal.org/files/epf...   \n",
       "8cf86948f02f047d  https://www.commoncriteriaportal.org/files/epf...   \n",
       "0fc32111e368dcf5  https://www.commoncriteriaportal.org/files/epf...   \n",
       "5e87de1cddf1ae43  https://www.commoncriteriaportal.org/files/epf...   \n",
       "\n",
       "                                manufacturer_web extracted_versions  \\\n",
       "dgst                                                                  \n",
       "a89ee15539d006d1      https://www.drivelock.com/           [2019.2]   \n",
       "309ac2fd7f2dcf17          https://www.netiq.com/              [4.7]   \n",
       "8cf86948f02f047d  https://www.dreamsecurity.com/              [4.0]   \n",
       "0fc32111e368dcf5          https://www.netiq.com/              [4.5]   \n",
       "5e87de1cddf1ae43        https://www.illumio.com/           [18.2.2]   \n",
       "\n",
       "                                                        cpe_matches  \\\n",
       "dgst                                                                  \n",
       "a89ee15539d006d1                                                NaN   \n",
       "309ac2fd7f2dcf17                                                NaN   \n",
       "8cf86948f02f047d                                                NaN   \n",
       "0fc32111e368dcf5  [cpe:2.3:a:netiq:access_manager:4.5:hotfix1:*:...   \n",
       "5e87de1cddf1ae43                                                NaN   \n",
       "\n",
       "                 verified_cpe_matches related_cves directly_affected_by  \\\n",
       "dgst                                                                      \n",
       "a89ee15539d006d1                  NaN          NaN                  NaN   \n",
       "309ac2fd7f2dcf17                  NaN          NaN                  NaN   \n",
       "8cf86948f02f047d                  NaN          NaN                  NaN   \n",
       "0fc32111e368dcf5                  NaN          NaN                  NaN   \n",
       "5e87de1cddf1ae43                  NaN          NaN                  NaN   \n",
       "\n",
       "                 indirectly_affected_by directly_affecting  \\\n",
       "dgst                                                         \n",
       "a89ee15539d006d1                    NaN                NaN   \n",
       "309ac2fd7f2dcf17                    NaN                NaN   \n",
       "8cf86948f02f047d                    NaN                NaN   \n",
       "0fc32111e368dcf5                    NaN                NaN   \n",
       "5e87de1cddf1ae43                    NaN                NaN   \n",
       "\n",
       "                 indirectly_affecting  \n",
       "dgst                                   \n",
       "a89ee15539d006d1                  NaN  \n",
       "309ac2fd7f2dcf17                  NaN  \n",
       "8cf86948f02f047d                  NaN  \n",
       "0fc32111e368dcf5                  NaN  \n",
       "5e87de1cddf1ae43                  NaN  "
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "99e4cd1f",
   "metadata": {},
   "source": [
    "### Filter top 10 manufacturers and see which categories are the most common"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "9eb0d337",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "ICs, Smart Cards and Smart Card-Related Devices and Systems    445\n",
       "Multi-Function Devices                                         164\n",
       "Other Devices and Systems                                      108\n",
       "Network and Network-Related Devices and Systems                 96\n",
       "Operating Systems                                               75\n",
       "Trusted Computing                                               44\n",
       "Databases                                                       30\n",
       "Data Protection                                                 25\n",
       "Mobility                                                        23\n",
       "Boundary Protection Devices and Systems                         19\n",
       "Access Control Devices and Systems                              13\n",
       "Detection Devices and Systems                                    5\n",
       "Key Management Systems                                           4\n",
       "Products for Digital Signatures                                  3\n",
       "Biometric Systems and Devices                                    0\n",
       "Name: category, dtype: int64"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "MANUFACTURER_COUNT = 10\n",
    "top_manufacturers_list = df[df[\"manufacturer\"].notna()][\"manufacturer\"].value_counts().head(MANUFACTURER_COUNT).index.tolist()\n",
    "top_manufacturers_df = df[df[\"manufacturer\"].isin(top_manufacturers_list)]\n",
    "top_manufacturers_df[\"category\"].value_counts()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "37718d3d",
   "metadata": {},
   "source": [
    "### How many archived certificates are in dataset?"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "a2052bdc",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "There are total 3057 archived certificates.\n"
     ]
    }
   ],
   "source": [
    "archived_df = df[df[\"status\"] == \"archived\"]\n",
    "print(f\"There are total {archived_df.shape[0]} archived certificates.\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2d97b1ec",
   "metadata": {},
   "source": [
    "### How many active certificates are in dataset?"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "5baf49e6",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "There are total 1559 active certificates.\n"
     ]
    }
   ],
   "source": [
    "active_df = df[df[\"status\"] == \"active\"]\n",
    "print(f\"There are total {active_df.shape[0]} active certificates.\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "12b152a9",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Text(0.5, 1.0, 'Archived certs vs. active certs')"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 21440 characters]",
      "text/plain": [
       "<Figure size 576x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.figure(figsize=(8, 4))\n",
    "plt.rcParams.update({'font.size': 14})\n",
    "sns.countplot(x=df[\"status\"]).set_title(\"Archived certs vs. active certs\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c607ef59",
   "metadata": {},
   "source": [
    "### Which certificates are referenced at least by one certificate? "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "1019d39a",
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>cert_id</th>\n",
       "      <th>name</th>\n",
       "      <th>status</th>\n",
       "      <th>category</th>\n",
       "      <th>manufacturer</th>\n",
       "      <th>scheme</th>\n",
       "      <th>security_level</th>\n",
       "      <th>not_valid_before</th>\n",
       "      <th>not_valid_after</th>\n",
       "      <th>report_link</th>\n",
       "      <th>...</th>\n",
       "      <th>extracted_versions</th>\n",
       "      <th>cpe_matches</th>\n",
       "      <th>verified_cpe_matches</th>\n",
       "      <th>related_cves</th>\n",
       "      <th>directly_affected_by</th>\n",
       "      <th>indirectly_affected_by</th>\n",
       "      <th>directly_affecting</th>\n",
       "      <th>indirectly_affecting</th>\n",
       "      <th>is_directly_affected_by</th>\n",
       "      <th>directly_affected_by_sum</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dgst</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>f041e5b526e79ef4</th>\n",
       "      <td>BSI-DSZ-CC-0410-2007</td>\n",
       "      <td>NXP Secure Smart Card Controller P5CD080V0B, P...</td>\n",
       "      <td>archived</td>\n",
       "      <td>ICs, Smart Cards and Smart Card-Related Device...</td>\n",
       "      <td>NXP Semiconductors Germany GmbH Business Line ...</td>\n",
       "      <td>DE</td>\n",
       "      <td>[ALC_DVS.2, AVA_MSU.3, AVA_VLA.4, EAL5+]</td>\n",
       "      <td>2007-07-05</td>\n",
       "      <td>2019-09-01</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>...</td>\n",
       "      <td>[-]</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>[BSI-DSZ-CC-0798-2012, BSI-DSZ-CC-0797-2012, B...</td>\n",
       "      <td>{BSI-DSZ-CC-0603-2010, ANSSI-2009/20, BSI-DSZ-...</td>\n",
       "      <td>{BSI-DSZ-CC-0404-2007}</td>\n",
       "      <td>{BSI-DSZ-CC-0404-2007}</td>\n",
       "      <td>True</td>\n",
       "      <td>33.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9dab3f1341f54c42</th>\n",
       "      <td>BSI-DSZ-CC-0555-2009</td>\n",
       "      <td>NXP Smart Card Controller P5CD081V1A and its m...</td>\n",
       "      <td>archived</td>\n",
       "      <td>ICs, Smart Cards and Smart Card-Related Device...</td>\n",
       "      <td>NXP Semiconductors</td>\n",
       "      <td>DE</td>\n",
       "      <td>[EAL5+]</td>\n",
       "      <td>2009-11-10</td>\n",
       "      <td>2019-09-01</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>...</td>\n",
       "      <td>[-]</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>[BSI-DSZ-CC-0784-2013, BSI-DSZ-CC-0857-2013, B...</td>\n",
       "      <td>{BSI-DSZ-CC-0812-2012, BSI-DSZ-CC-0633-2010, B...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>True</td>\n",
       "      <td>19.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dbbf02a1cd0ad33b</th>\n",
       "      <td>ANSSI-CC-2010/02</td>\n",
       "      <td>STMicroelectronics SA23YR48/80B and SB23YR48/8...</td>\n",
       "      <td>archived</td>\n",
       "      <td>ICs, Smart Cards and Smart Card-Related Device...</td>\n",
       "      <td>STMicroelectronics</td>\n",
       "      <td>FR</td>\n",
       "      <td>[ALC_FLR.1, EAL6+]</td>\n",
       "      <td>2010-02-10</td>\n",
       "      <td>2019-09-01</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>...</td>\n",
       "      <td>[3.0, 2.0]</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>[BSI-DSZ-CC-0877-2013, ANSSI-CC-2010/34, BSI-D...</td>\n",
       "      <td>{ANSSI-CC-2010/32, ANSSI-CC-2010/57, BSI-DSZ-C...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>True</td>\n",
       "      <td>19.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7d4585a4b5b6e873</th>\n",
       "      <td>ANSSI-CC-2010/02</td>\n",
       "      <td>Ucard UBJ31-G11 V1.1</td>\n",
       "      <td>archived</td>\n",
       "      <td>ICs, Smart Cards and Smart Card-Related Device...</td>\n",
       "      <td>UBIVELOX</td>\n",
       "      <td>KR</td>\n",
       "      <td>[ALC_DVS.2, AVA_VAN.5, EAL4+]</td>\n",
       "      <td>2012-10-31</td>\n",
       "      <td>2019-06-01</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>...</td>\n",
       "      <td>[1.1]</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>[BSI-DSZ-CC-0877-2013, ANSSI-CC-2010/34, BSI-D...</td>\n",
       "      <td>{ANSSI-CC-2010/32, ANSSI-CC-2010/57, BSI-DSZ-C...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>True</td>\n",
       "      <td>19.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>f2c2231b0ffae4d7</th>\n",
       "      <td>BSI-DSZ-CC-0978-2016</td>\n",
       "      <td>NXP Secure Smart Card Controller P60x144/080yV...</td>\n",
       "      <td>archived</td>\n",
       "      <td>ICs, Smart Cards and Smart Card-Related Device...</td>\n",
       "      <td>NXP Semiconductors Germany GmbH Business Line ...</td>\n",
       "      <td>DE</td>\n",
       "      <td>[ALC_FLR.1, ASE_TSS.2, EAL6+]</td>\n",
       "      <td>2016-02-05</td>\n",
       "      <td>2021-02-05</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>...</td>\n",
       "      <td>[-]</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>[BSI-DSZ-CC-0978-V2-2017, BSI-DSZ-CC-0957-V2-2...</td>\n",
       "      <td>{ANSSI-CC-2016/30, BSI-DSZ-CC-0957-V2-2016, BS...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>True</td>\n",
       "      <td>18.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 22 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                               cert_id  \\\n",
       "dgst                                     \n",
       "f041e5b526e79ef4  BSI-DSZ-CC-0410-2007   \n",
       "9dab3f1341f54c42  BSI-DSZ-CC-0555-2009   \n",
       "dbbf02a1cd0ad33b      ANSSI-CC-2010/02   \n",
       "7d4585a4b5b6e873      ANSSI-CC-2010/02   \n",
       "f2c2231b0ffae4d7  BSI-DSZ-CC-0978-2016   \n",
       "\n",
       "                                                               name    status  \\\n",
       "dgst                                                                            \n",
       "f041e5b526e79ef4  NXP Secure Smart Card Controller P5CD080V0B, P...  archived   \n",
       "9dab3f1341f54c42  NXP Smart Card Controller P5CD081V1A and its m...  archived   \n",
       "dbbf02a1cd0ad33b  STMicroelectronics SA23YR48/80B and SB23YR48/8...  archived   \n",
       "7d4585a4b5b6e873                               Ucard UBJ31-G11 V1.1  archived   \n",
       "f2c2231b0ffae4d7  NXP Secure Smart Card Controller P60x144/080yV...  archived   \n",
       "\n",
       "                                                           category  \\\n",
       "dgst                                                                  \n",
       "f041e5b526e79ef4  ICs, Smart Cards and Smart Card-Related Device...   \n",
       "9dab3f1341f54c42  ICs, Smart Cards and Smart Card-Related Device...   \n",
       "dbbf02a1cd0ad33b  ICs, Smart Cards and Smart Card-Related Device...   \n",
       "7d4585a4b5b6e873  ICs, Smart Cards and Smart Card-Related Device...   \n",
       "f2c2231b0ffae4d7  ICs, Smart Cards and Smart Card-Related Device...   \n",
       "\n",
       "                                                       manufacturer scheme  \\\n",
       "dgst                                                                         \n",
       "f041e5b526e79ef4  NXP Semiconductors Germany GmbH Business Line ...     DE   \n",
       "9dab3f1341f54c42                                 NXP Semiconductors     DE   \n",
       "dbbf02a1cd0ad33b                                 STMicroelectronics     FR   \n",
       "7d4585a4b5b6e873                                           UBIVELOX     KR   \n",
       "f2c2231b0ffae4d7  NXP Semiconductors Germany GmbH Business Line ...     DE   \n",
       "\n",
       "                                            security_level not_valid_before  \\\n",
       "dgst                                                                          \n",
       "f041e5b526e79ef4  [ALC_DVS.2, AVA_MSU.3, AVA_VLA.4, EAL5+]       2007-07-05   \n",
       "9dab3f1341f54c42                                   [EAL5+]       2009-11-10   \n",
       "dbbf02a1cd0ad33b                        [ALC_FLR.1, EAL6+]       2010-02-10   \n",
       "7d4585a4b5b6e873             [ALC_DVS.2, AVA_VAN.5, EAL4+]       2012-10-31   \n",
       "f2c2231b0ffae4d7             [ALC_FLR.1, ASE_TSS.2, EAL6+]       2016-02-05   \n",
       "\n",
       "                 not_valid_after  \\\n",
       "dgst                               \n",
       "f041e5b526e79ef4      2019-09-01   \n",
       "9dab3f1341f54c42      2019-09-01   \n",
       "dbbf02a1cd0ad33b      2019-09-01   \n",
       "7d4585a4b5b6e873      2019-06-01   \n",
       "f2c2231b0ffae4d7      2021-02-05   \n",
       "\n",
       "                                                        report_link  ...  \\\n",
       "dgst                                                                 ...   \n",
       "f041e5b526e79ef4  https://www.commoncriteriaportal.org/files/epf...  ...   \n",
       "9dab3f1341f54c42  https://www.commoncriteriaportal.org/files/epf...  ...   \n",
       "dbbf02a1cd0ad33b  https://www.commoncriteriaportal.org/files/epf...  ...   \n",
       "7d4585a4b5b6e873  https://www.commoncriteriaportal.org/files/epf...  ...   \n",
       "f2c2231b0ffae4d7  https://www.commoncriteriaportal.org/files/epf...  ...   \n",
       "\n",
       "                 extracted_versions cpe_matches verified_cpe_matches  \\\n",
       "dgst                                                                   \n",
       "f041e5b526e79ef4                [-]         NaN                  NaN   \n",
       "9dab3f1341f54c42                [-]         NaN                  NaN   \n",
       "dbbf02a1cd0ad33b         [3.0, 2.0]         NaN                  NaN   \n",
       "7d4585a4b5b6e873              [1.1]         NaN                  NaN   \n",
       "f2c2231b0ffae4d7                [-]         NaN                  NaN   \n",
       "\n",
       "                 related_cves  \\\n",
       "dgst                            \n",
       "f041e5b526e79ef4          NaN   \n",
       "9dab3f1341f54c42          NaN   \n",
       "dbbf02a1cd0ad33b          NaN   \n",
       "7d4585a4b5b6e873          NaN   \n",
       "f2c2231b0ffae4d7          NaN   \n",
       "\n",
       "                                               directly_affected_by  \\\n",
       "dgst                                                                  \n",
       "f041e5b526e79ef4  [BSI-DSZ-CC-0798-2012, BSI-DSZ-CC-0797-2012, B...   \n",
       "9dab3f1341f54c42  [BSI-DSZ-CC-0784-2013, BSI-DSZ-CC-0857-2013, B...   \n",
       "dbbf02a1cd0ad33b  [BSI-DSZ-CC-0877-2013, ANSSI-CC-2010/34, BSI-D...   \n",
       "7d4585a4b5b6e873  [BSI-DSZ-CC-0877-2013, ANSSI-CC-2010/34, BSI-D...   \n",
       "f2c2231b0ffae4d7  [BSI-DSZ-CC-0978-V2-2017, BSI-DSZ-CC-0957-V2-2...   \n",
       "\n",
       "                                             indirectly_affected_by  \\\n",
       "dgst                                                                  \n",
       "f041e5b526e79ef4  {BSI-DSZ-CC-0603-2010, ANSSI-2009/20, BSI-DSZ-...   \n",
       "9dab3f1341f54c42  {BSI-DSZ-CC-0812-2012, BSI-DSZ-CC-0633-2010, B...   \n",
       "dbbf02a1cd0ad33b  {ANSSI-CC-2010/32, ANSSI-CC-2010/57, BSI-DSZ-C...   \n",
       "7d4585a4b5b6e873  {ANSSI-CC-2010/32, ANSSI-CC-2010/57, BSI-DSZ-C...   \n",
       "f2c2231b0ffae4d7  {ANSSI-CC-2016/30, BSI-DSZ-CC-0957-V2-2016, BS...   \n",
       "\n",
       "                      directly_affecting    indirectly_affecting  \\\n",
       "dgst                                                               \n",
       "f041e5b526e79ef4  {BSI-DSZ-CC-0404-2007}  {BSI-DSZ-CC-0404-2007}   \n",
       "9dab3f1341f54c42                     NaN                     NaN   \n",
       "dbbf02a1cd0ad33b                     NaN                     NaN   \n",
       "7d4585a4b5b6e873                     NaN                     NaN   \n",
       "f2c2231b0ffae4d7                     NaN                     NaN   \n",
       "\n",
       "                 is_directly_affected_by directly_affected_by_sum  \n",
       "dgst                                                               \n",
       "f041e5b526e79ef4                    True                     33.0  \n",
       "9dab3f1341f54c42                    True                     19.0  \n",
       "dbbf02a1cd0ad33b                    True                     19.0  \n",
       "7d4585a4b5b6e873                    True                     19.0  \n",
       "f2c2231b0ffae4d7                    True                     18.0  \n",
       "\n",
       "[5 rows x 22 columns]"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "def is_directly_affected_by(references):\n",
    "    if references is np.nan:\n",
    "        return False\n",
    "    \n",
    "    return True\n",
    "\n",
    "def count_directly_affected_by(references):\n",
    "    if references is np.nan:\n",
    "        return np.nan\n",
    "    return len(references)\n",
    "\n",
    "directly_affected_by_df = df.copy()\n",
    "directly_affected_by_df[\"is_directly_affected_by\"] = df[\"directly_affected_by\"].apply(is_directly_affected_by)\n",
    "directly_affected_by_df[\"directly_affected_by_sum\"] = directly_affected_by_df[\"directly_affected_by\"].apply(count_directly_affected_by)\n",
    "directly_affected_by_df.sort_values(by=\"directly_affected_by_sum\", ascending=False, inplace=True)\n",
    "directly_affected_by_df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "ae45f0ef",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 214984 characters]",
      "text/plain": [
       "<Figure size 864x1440 with 2 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig, (ax1, ax2) = plt.subplots(2,1, figsize=(12,20))\n",
    "normalized_serie = directly_affected_by_df[\"category\"].value_counts(normalize=True)\n",
    "plt.rcParams.update({'font.size': 20})\n",
    "sns.countplot(y=\"category\", hue=\"is_directly_affected_by\", data=directly_affected_by_df, ax=ax1).set_title(\"Which certificates are referenced at least by one certificate vs. which are affected by no certificates\")\n",
    "sns.barplot(y=normalized_serie.index, x=normalized_serie.values, ax=ax2).set_title(\"Normalized values for each category\")\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "909bfe81",
   "metadata": {},
   "source": [
    "### Which certificates are referencing no other?"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "a1bf7637",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "There are total 3970 certificates referencing no other certificates.\n"
     ]
    }
   ],
   "source": [
    "no_affecting_df = df[df[\"directly_affecting\"].isna() & df[\"indirectly_affecting\"].isna()]\n",
    "\n",
    "print(f\"There are total {no_affecting_df.shape[0]} certificates referencing no other certificates.\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "875eba0a",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>cert_id</th>\n",
       "      <th>name</th>\n",
       "      <th>status</th>\n",
       "      <th>category</th>\n",
       "      <th>manufacturer</th>\n",
       "      <th>scheme</th>\n",
       "      <th>security_level</th>\n",
       "      <th>not_valid_before</th>\n",
       "      <th>not_valid_after</th>\n",
       "      <th>report_link</th>\n",
       "      <th>st_link</th>\n",
       "      <th>manufacturer_web</th>\n",
       "      <th>extracted_versions</th>\n",
       "      <th>cpe_matches</th>\n",
       "      <th>verified_cpe_matches</th>\n",
       "      <th>related_cves</th>\n",
       "      <th>directly_affected_by</th>\n",
       "      <th>indirectly_affected_by</th>\n",
       "      <th>directly_affecting</th>\n",
       "      <th>indirectly_affecting</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dgst</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>a89ee15539d006d1</th>\n",
       "      <td>NaN</td>\n",
       "      <td>DriveLock Agent 2019.2 (Device and Application...</td>\n",
       "      <td>active</td>\n",
       "      <td>Access Control Devices and Systems</td>\n",
       "      <td>DriveLock SE</td>\n",
       "      <td>SE</td>\n",
       "      <td>[ALC_FLR.3, EAL3]</td>\n",
       "      <td>2021-04-07</td>\n",
       "      <td>2026-04-07</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>https://www.drivelock.com/</td>\n",
       "      <td>[2019.2]</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>309ac2fd7f2dcf17</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NetIQ Identity Manager 4.7</td>\n",
       "      <td>active</td>\n",
       "      <td>Access Control Devices and Systems</td>\n",
       "      <td>NetIQ Corporation</td>\n",
       "      <td>SE</td>\n",
       "      <td>[ALC_FLR.2, EAL3+]</td>\n",
       "      <td>2020-06-15</td>\n",
       "      <td>2025-06-15</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>https://www.netiq.com/</td>\n",
       "      <td>[4.7]</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8cf86948f02f047d</th>\n",
       "      <td>KECS-CR-19-70</td>\n",
       "      <td>Magic SSO V4.0</td>\n",
       "      <td>active</td>\n",
       "      <td>Access Control Devices and Systems</td>\n",
       "      <td>Dreamsecurity Co., Ltd.</td>\n",
       "      <td>KR</td>\n",
       "      <td>[]</td>\n",
       "      <td>2019-11-15</td>\n",
       "      <td>2024-11-15</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>https://www.dreamsecurity.com/</td>\n",
       "      <td>[4.0]</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0fc32111e368dcf5</th>\n",
       "      <td>NSCIB-CC-0006151-CR</td>\n",
       "      <td>NetIQ Access Manager 4.5</td>\n",
       "      <td>active</td>\n",
       "      <td>Access Control Devices and Systems</td>\n",
       "      <td>NetIQ, Incorporated</td>\n",
       "      <td>NL</td>\n",
       "      <td>[ALC_FLR.1, EAL3+]</td>\n",
       "      <td>2019-11-07</td>\n",
       "      <td>2024-11-07</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>https://www.netiq.com/</td>\n",
       "      <td>[4.5]</td>\n",
       "      <td>[cpe:2.3:a:netiq:access_manager:4.5:hotfix1:*:...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5e87de1cddf1ae43</th>\n",
       "      <td>NaN</td>\n",
       "      <td>Illumio Adaptive Security Platform v18.2.2</td>\n",
       "      <td>active</td>\n",
       "      <td>Access Control Devices and Systems</td>\n",
       "      <td>Illumio</td>\n",
       "      <td>CA</td>\n",
       "      <td>[]</td>\n",
       "      <td>2019-07-12</td>\n",
       "      <td>2024-07-12</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>https://www.illumio.com/</td>\n",
       "      <td>[18.2.2]</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                              cert_id  \\\n",
       "dgst                                    \n",
       "a89ee15539d006d1                  NaN   \n",
       "309ac2fd7f2dcf17                  NaN   \n",
       "8cf86948f02f047d        KECS-CR-19-70   \n",
       "0fc32111e368dcf5  NSCIB-CC-0006151-CR   \n",
       "5e87de1cddf1ae43                  NaN   \n",
       "\n",
       "                                                               name  status  \\\n",
       "dgst                                                                          \n",
       "a89ee15539d006d1  DriveLock Agent 2019.2 (Device and Application...  active   \n",
       "309ac2fd7f2dcf17                         NetIQ Identity Manager 4.7  active   \n",
       "8cf86948f02f047d                                     Magic SSO V4.0  active   \n",
       "0fc32111e368dcf5                           NetIQ Access Manager 4.5  active   \n",
       "5e87de1cddf1ae43         Illumio Adaptive Security Platform v18.2.2  active   \n",
       "\n",
       "                                            category             manufacturer  \\\n",
       "dgst                                                                            \n",
       "a89ee15539d006d1  Access Control Devices and Systems             DriveLock SE   \n",
       "309ac2fd7f2dcf17  Access Control Devices and Systems        NetIQ Corporation   \n",
       "8cf86948f02f047d  Access Control Devices and Systems  Dreamsecurity Co., Ltd.   \n",
       "0fc32111e368dcf5  Access Control Devices and Systems      NetIQ, Incorporated   \n",
       "5e87de1cddf1ae43  Access Control Devices and Systems                  Illumio   \n",
       "\n",
       "                 scheme      security_level not_valid_before not_valid_after  \\\n",
       "dgst                                                                           \n",
       "a89ee15539d006d1     SE   [ALC_FLR.3, EAL3]       2021-04-07      2026-04-07   \n",
       "309ac2fd7f2dcf17     SE  [ALC_FLR.2, EAL3+]       2020-06-15      2025-06-15   \n",
       "8cf86948f02f047d     KR                  []       2019-11-15      2024-11-15   \n",
       "0fc32111e368dcf5     NL  [ALC_FLR.1, EAL3+]       2019-11-07      2024-11-07   \n",
       "5e87de1cddf1ae43     CA                  []       2019-07-12      2024-07-12   \n",
       "\n",
       "                                                        report_link  \\\n",
       "dgst                                                                  \n",
       "a89ee15539d006d1  https://www.commoncriteriaportal.org/files/epf...   \n",
       "309ac2fd7f2dcf17  https://www.commoncriteriaportal.org/files/epf...   \n",
       "8cf86948f02f047d  https://www.commoncriteriaportal.org/files/epf...   \n",
       "0fc32111e368dcf5  https://www.commoncriteriaportal.org/files/epf...   \n",
       "5e87de1cddf1ae43  https://www.commoncriteriaportal.org/files/epf...   \n",
       "\n",
       "                                                            st_link  \\\n",
       "dgst                                                                  \n",
       "a89ee15539d006d1  https://www.commoncriteriaportal.org/files/epf...   \n",
       "309ac2fd7f2dcf17  https://www.commoncriteriaportal.org/files/epf...   \n",
       "8cf86948f02f047d  https://www.commoncriteriaportal.org/files/epf...   \n",
       "0fc32111e368dcf5  https://www.commoncriteriaportal.org/files/epf...   \n",
       "5e87de1cddf1ae43  https://www.commoncriteriaportal.org/files/epf...   \n",
       "\n",
       "                                manufacturer_web extracted_versions  \\\n",
       "dgst                                                                  \n",
       "a89ee15539d006d1      https://www.drivelock.com/           [2019.2]   \n",
       "309ac2fd7f2dcf17          https://www.netiq.com/              [4.7]   \n",
       "8cf86948f02f047d  https://www.dreamsecurity.com/              [4.0]   \n",
       "0fc32111e368dcf5          https://www.netiq.com/              [4.5]   \n",
       "5e87de1cddf1ae43        https://www.illumio.com/           [18.2.2]   \n",
       "\n",
       "                                                        cpe_matches  \\\n",
       "dgst                                                                  \n",
       "a89ee15539d006d1                                                NaN   \n",
       "309ac2fd7f2dcf17                                                NaN   \n",
       "8cf86948f02f047d                                                NaN   \n",
       "0fc32111e368dcf5  [cpe:2.3:a:netiq:access_manager:4.5:hotfix1:*:...   \n",
       "5e87de1cddf1ae43                                                NaN   \n",
       "\n",
       "                 verified_cpe_matches related_cves directly_affected_by  \\\n",
       "dgst                                                                      \n",
       "a89ee15539d006d1                  NaN          NaN                  NaN   \n",
       "309ac2fd7f2dcf17                  NaN          NaN                  NaN   \n",
       "8cf86948f02f047d                  NaN          NaN                  NaN   \n",
       "0fc32111e368dcf5                  NaN          NaN                  NaN   \n",
       "5e87de1cddf1ae43                  NaN          NaN                  NaN   \n",
       "\n",
       "                 indirectly_affected_by directly_affecting  \\\n",
       "dgst                                                         \n",
       "a89ee15539d006d1                    NaN                NaN   \n",
       "309ac2fd7f2dcf17                    NaN                NaN   \n",
       "8cf86948f02f047d                    NaN                NaN   \n",
       "0fc32111e368dcf5                    NaN                NaN   \n",
       "5e87de1cddf1ae43                    NaN                NaN   \n",
       "\n",
       "                 indirectly_affecting  \n",
       "dgst                                   \n",
       "a89ee15539d006d1                  NaN  \n",
       "309ac2fd7f2dcf17                  NaN  \n",
       "8cf86948f02f047d                  NaN  \n",
       "0fc32111e368dcf5                  NaN  \n",
       "5e87de1cddf1ae43                  NaN  "
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "no_affecting_df.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "0fa6bb88",
   "metadata": {},
   "source": [
    "### How many no affecting certificates are affected by other certificates?"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "009f9c73",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "There are total of 158 certificates which are affected by other certificates and affecting no certificates.\n"
     ]
    }
   ],
   "source": [
    "affected_but_no_affecting_df = no_affecting_df[no_affecting_df[\"directly_affected_by\"].notna() & no_affecting_df[\"indirectly_affected_by\"].notna()]\n",
    "print(f\"There are total of {affected_but_no_affecting_df.shape[0]} certificates which are affected by other certificates and affecting no certificates.\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "0512b68d",
   "metadata": {},
   "source": [
    "### How many certificates are not affected by other certificates, nor affecting other certificates?"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "f5398edd",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>cert_id</th>\n",
       "      <th>name</th>\n",
       "      <th>status</th>\n",
       "      <th>category</th>\n",
       "      <th>manufacturer</th>\n",
       "      <th>scheme</th>\n",
       "      <th>security_level</th>\n",
       "      <th>not_valid_before</th>\n",
       "      <th>not_valid_after</th>\n",
       "      <th>report_link</th>\n",
       "      <th>...</th>\n",
       "      <th>manufacturer_web</th>\n",
       "      <th>extracted_versions</th>\n",
       "      <th>cpe_matches</th>\n",
       "      <th>verified_cpe_matches</th>\n",
       "      <th>related_cves</th>\n",
       "      <th>directly_affected_by</th>\n",
       "      <th>indirectly_affected_by</th>\n",
       "      <th>directly_affecting</th>\n",
       "      <th>indirectly_affecting</th>\n",
       "      <th>is_no_affecting_nor_affected</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dgst</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>a89ee15539d006d1</th>\n",
       "      <td>NaN</td>\n",
       "      <td>DriveLock Agent 2019.2 (Device and Application...</td>\n",
       "      <td>active</td>\n",
       "      <td>Access Control Devices and Systems</td>\n",
       "      <td>DriveLock SE</td>\n",
       "      <td>SE</td>\n",
       "      <td>[ALC_FLR.3, EAL3]</td>\n",
       "      <td>2021-04-07</td>\n",
       "      <td>2026-04-07</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>...</td>\n",
       "      <td>https://www.drivelock.com/</td>\n",
       "      <td>[2019.2]</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>309ac2fd7f2dcf17</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NetIQ Identity Manager 4.7</td>\n",
       "      <td>active</td>\n",
       "      <td>Access Control Devices and Systems</td>\n",
       "      <td>NetIQ Corporation</td>\n",
       "      <td>SE</td>\n",
       "      <td>[ALC_FLR.2, EAL3+]</td>\n",
       "      <td>2020-06-15</td>\n",
       "      <td>2025-06-15</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>...</td>\n",
       "      <td>https://www.netiq.com/</td>\n",
       "      <td>[4.7]</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8cf86948f02f047d</th>\n",
       "      <td>KECS-CR-19-70</td>\n",
       "      <td>Magic SSO V4.0</td>\n",
       "      <td>active</td>\n",
       "      <td>Access Control Devices and Systems</td>\n",
       "      <td>Dreamsecurity Co., Ltd.</td>\n",
       "      <td>KR</td>\n",
       "      <td>[]</td>\n",
       "      <td>2019-11-15</td>\n",
       "      <td>2024-11-15</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>...</td>\n",
       "      <td>https://www.dreamsecurity.com/</td>\n",
       "      <td>[4.0]</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0fc32111e368dcf5</th>\n",
       "      <td>NSCIB-CC-0006151-CR</td>\n",
       "      <td>NetIQ Access Manager 4.5</td>\n",
       "      <td>active</td>\n",
       "      <td>Access Control Devices and Systems</td>\n",
       "      <td>NetIQ, Incorporated</td>\n",
       "      <td>NL</td>\n",
       "      <td>[ALC_FLR.1, EAL3+]</td>\n",
       "      <td>2019-11-07</td>\n",
       "      <td>2024-11-07</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>...</td>\n",
       "      <td>https://www.netiq.com/</td>\n",
       "      <td>[4.5]</td>\n",
       "      <td>[cpe:2.3:a:netiq:access_manager:4.5:hotfix1:*:...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5e87de1cddf1ae43</th>\n",
       "      <td>NaN</td>\n",
       "      <td>Illumio Adaptive Security Platform v18.2.2</td>\n",
       "      <td>active</td>\n",
       "      <td>Access Control Devices and Systems</td>\n",
       "      <td>Illumio</td>\n",
       "      <td>CA</td>\n",
       "      <td>[]</td>\n",
       "      <td>2019-07-12</td>\n",
       "      <td>2024-07-12</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>...</td>\n",
       "      <td>https://www.illumio.com/</td>\n",
       "      <td>[18.2.2]</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 21 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                              cert_id  \\\n",
       "dgst                                    \n",
       "a89ee15539d006d1                  NaN   \n",
       "309ac2fd7f2dcf17                  NaN   \n",
       "8cf86948f02f047d        KECS-CR-19-70   \n",
       "0fc32111e368dcf5  NSCIB-CC-0006151-CR   \n",
       "5e87de1cddf1ae43                  NaN   \n",
       "\n",
       "                                                               name  status  \\\n",
       "dgst                                                                          \n",
       "a89ee15539d006d1  DriveLock Agent 2019.2 (Device and Application...  active   \n",
       "309ac2fd7f2dcf17                         NetIQ Identity Manager 4.7  active   \n",
       "8cf86948f02f047d                                     Magic SSO V4.0  active   \n",
       "0fc32111e368dcf5                           NetIQ Access Manager 4.5  active   \n",
       "5e87de1cddf1ae43         Illumio Adaptive Security Platform v18.2.2  active   \n",
       "\n",
       "                                            category             manufacturer  \\\n",
       "dgst                                                                            \n",
       "a89ee15539d006d1  Access Control Devices and Systems             DriveLock SE   \n",
       "309ac2fd7f2dcf17  Access Control Devices and Systems        NetIQ Corporation   \n",
       "8cf86948f02f047d  Access Control Devices and Systems  Dreamsecurity Co., Ltd.   \n",
       "0fc32111e368dcf5  Access Control Devices and Systems      NetIQ, Incorporated   \n",
       "5e87de1cddf1ae43  Access Control Devices and Systems                  Illumio   \n",
       "\n",
       "                 scheme      security_level not_valid_before not_valid_after  \\\n",
       "dgst                                                                           \n",
       "a89ee15539d006d1     SE   [ALC_FLR.3, EAL3]       2021-04-07      2026-04-07   \n",
       "309ac2fd7f2dcf17     SE  [ALC_FLR.2, EAL3+]       2020-06-15      2025-06-15   \n",
       "8cf86948f02f047d     KR                  []       2019-11-15      2024-11-15   \n",
       "0fc32111e368dcf5     NL  [ALC_FLR.1, EAL3+]       2019-11-07      2024-11-07   \n",
       "5e87de1cddf1ae43     CA                  []       2019-07-12      2024-07-12   \n",
       "\n",
       "                                                        report_link  ...  \\\n",
       "dgst                                                                 ...   \n",
       "a89ee15539d006d1  https://www.commoncriteriaportal.org/files/epf...  ...   \n",
       "309ac2fd7f2dcf17  https://www.commoncriteriaportal.org/files/epf...  ...   \n",
       "8cf86948f02f047d  https://www.commoncriteriaportal.org/files/epf...  ...   \n",
       "0fc32111e368dcf5  https://www.commoncriteriaportal.org/files/epf...  ...   \n",
       "5e87de1cddf1ae43  https://www.commoncriteriaportal.org/files/epf...  ...   \n",
       "\n",
       "                                manufacturer_web extracted_versions  \\\n",
       "dgst                                                                  \n",
       "a89ee15539d006d1      https://www.drivelock.com/           [2019.2]   \n",
       "309ac2fd7f2dcf17          https://www.netiq.com/              [4.7]   \n",
       "8cf86948f02f047d  https://www.dreamsecurity.com/              [4.0]   \n",
       "0fc32111e368dcf5          https://www.netiq.com/              [4.5]   \n",
       "5e87de1cddf1ae43        https://www.illumio.com/           [18.2.2]   \n",
       "\n",
       "                                                        cpe_matches  \\\n",
       "dgst                                                                  \n",
       "a89ee15539d006d1                                                NaN   \n",
       "309ac2fd7f2dcf17                                                NaN   \n",
       "8cf86948f02f047d                                                NaN   \n",
       "0fc32111e368dcf5  [cpe:2.3:a:netiq:access_manager:4.5:hotfix1:*:...   \n",
       "5e87de1cddf1ae43                                                NaN   \n",
       "\n",
       "                 verified_cpe_matches related_cves directly_affected_by  \\\n",
       "dgst                                                                      \n",
       "a89ee15539d006d1                  NaN          NaN                  NaN   \n",
       "309ac2fd7f2dcf17                  NaN          NaN                  NaN   \n",
       "8cf86948f02f047d                  NaN          NaN                  NaN   \n",
       "0fc32111e368dcf5                  NaN          NaN                  NaN   \n",
       "5e87de1cddf1ae43                  NaN          NaN                  NaN   \n",
       "\n",
       "                 indirectly_affected_by directly_affecting  \\\n",
       "dgst                                                         \n",
       "a89ee15539d006d1                    NaN                NaN   \n",
       "309ac2fd7f2dcf17                    NaN                NaN   \n",
       "8cf86948f02f047d                    NaN                NaN   \n",
       "0fc32111e368dcf5                    NaN                NaN   \n",
       "5e87de1cddf1ae43                    NaN                NaN   \n",
       "\n",
       "                 indirectly_affecting is_no_affecting_nor_affected  \n",
       "dgst                                                                \n",
       "a89ee15539d006d1                  NaN                         True  \n",
       "309ac2fd7f2dcf17                  NaN                         True  \n",
       "8cf86948f02f047d                  NaN                         True  \n",
       "0fc32111e368dcf5                  NaN                         True  \n",
       "5e87de1cddf1ae43                  NaN                         True  \n",
       "\n",
       "[5 rows x 21 columns]"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "def is_no_affecting_nor_affected(directly_affecting, indirectly_affecting, directly_affected_by, indirectly_affected_by):\n",
    "    if directly_affecting is np.nan and indirectly_affecting is np.nan and directly_affected_by is np.nan and indirectly_affected_by is np.nan:\n",
    "        return True\n",
    "    \n",
    "    return False\n",
    "\n",
    "\n",
    "no_affecting_no_affected_df = df.copy()\n",
    "no_affecting_no_affected_df[\"is_no_affecting_nor_affected\"] = df.apply(lambda x: is_no_affecting_nor_affected(x[\"directly_affecting\"], x[\"indirectly_affecting\"], x[\"directly_affected_by\"], x[\"indirectly_affected_by\"]), axis=1)\n",
    "no_affecting_no_affected_df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "97870d41",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 103568 characters]",
      "text/plain": [
       "<Figure size 864x1440 with 2 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig, (ax1, ax2) = plt.subplots(2,1, figsize=(12,20))\n",
    "normalized_serie = no_affecting_no_affected_df[\"scheme\"].value_counts(normalize=True)\n",
    "plt.rcParams.update({'font.size': 20})\n",
    "sns.countplot(y=\"scheme\", hue=\"is_no_affecting_nor_affected\", data=no_affecting_no_affected_df, ax=ax1).set_title(\"Distribution of schemes which certs from categories are not affecting, nor affected by other certs\")\n",
    "sns.barplot(y=normalized_serie.index, x=normalized_serie.values, ax=ax2).set_title(\"Normalized values for each scheme\")\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c65fb79b",
   "metadata": {},
   "source": [
    "### Which certificates are dependent on the archived certificates?"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "fc547955",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Total 311 certificates are affected by at least one archived certicates.\n"
     ]
    }
   ],
   "source": [
    "archived_cert_id_list = df[df[\"cert_id\"].notna() & (df[\"status\"] == \"archived\")][\"cert_id\"].tolist()\n",
    "\n",
    "def contains_archived_cert_dependency(affected_by):\n",
    "    if affected_by is np.nan:\n",
    "        return False\n",
    "    \n",
    "    for cert_id in affected_by:\n",
    "        if cert_id in archived_cert_id_list:\n",
    "            return True\n",
    "        \n",
    "    return False\n",
    "\n",
    "\n",
    "depends_on_archived_df = df.copy()\n",
    "depends_on_archived_df[\"depends_on_archived\"] = depends_on_archived_df[\"directly_affected_by\"].apply(contains_archived_cert_dependency)\n",
    "total_records_dependent = sum(depends_on_archived_df[\"depends_on_archived\"])\n",
    "print(f\"Total {total_records_dependent} certificates are affected by at least one archived certicates.\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "8a6e379d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 283368 characters]",
      "text/plain": [
       "<Figure size 864x1440 with 2 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig, (ax1, ax2) = plt.subplots(2,1, figsize=(12,20))\n",
    "normalized_serie = depends_on_archived_df[\"category\"].value_counts(normalize=True)\n",
    "plt.rcParams.update({'font.size': 20})\n",
    "sns.countplot(y=\"category\", hue=\"depends_on_archived\", data=depends_on_archived_df, ax=ax1).set_title(\"Distribution of categories among certificates dependent on archived certs.\")\n",
    "sns.barplot(y=normalized_serie.index, x=normalized_serie.values, ax=ax2).set_title(\"Normalized values for each category\")\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "4c7d3d3c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 93608 characters]",
      "text/plain": [
       "<Figure size 864x1440 with 2 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "fig, (ax1, ax2) = plt.subplots(2,1, figsize=(12,20))\n",
    "normalized_serie = depends_on_archived_df[\"scheme\"].value_counts(normalize=True)\n",
    "plt.rcParams.update({'font.size': 20})\n",
    "sns.countplot(y=\"scheme\", hue=\"depends_on_archived\", data=depends_on_archived_df, ax=ax1).set_title(\"Distribution of schemes among certificates dependent on archived certs.\")\n",
    "sns.barplot(y=normalized_serie.index, x=normalized_serie.values, ax=ax2).set_title(\"Normalized values for each scheme\")\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "75891368",
   "metadata": {},
   "source": [
    "### How frequently are BSI certificates referencing ANSSI certs and vice versa?"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "e532eb30",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "There are 16 BSI certs affecting ANSSI certs out of total 831 BSI certs.\n",
      "There are 38 ANSSI certs affecting BSI certs out of total 682 ANSSI certs.\n",
      "Success hit for BSI certs: 0.019253910950661854\n",
      "Success hit for ANSSI certs: 0.05571847507331378\n"
     ]
    }
   ],
   "source": [
    "from typing import Set\n",
    "\n",
    "\n",
    "def is_bsi_cert(cert_id: str) -> bool:\n",
    "    if cert_id is np.nan:\n",
    "        return False\n",
    "    \n",
    "    if cert_id.lower().startswith(\"bsi\"):\n",
    "        return True\n",
    "    \n",
    "    return False\n",
    "\n",
    "\n",
    "def is_anssi_cert(cert_id: str) -> bool:\n",
    "    if cert_id is np.nan:\n",
    "        return False\n",
    "    \n",
    "    if cert_id.lower().startswith(\"anssi\"):\n",
    "        return True\n",
    "\n",
    "    return False\n",
    "\n",
    "\n",
    "def is_affecting_anssi(directly_affecting: Set[str]) -> bool:\n",
    "    if directly_affecting is np.nan:\n",
    "        return False\n",
    "    \n",
    "    for cert_id in directly_affecting:\n",
    "        if is_anssi_cert(cert_id):\n",
    "            return True\n",
    "        \n",
    "    return False\n",
    "\n",
    "\n",
    "def is_affecting_bsi(directly_affecting: Set[str]) -> bool:\n",
    "    if directly_affecting is np.nan:\n",
    "        return False\n",
    "    \n",
    "    for cert_id in directly_affecting:\n",
    "        if is_bsi_cert(cert_id):\n",
    "            return True\n",
    "    \n",
    "    return False\n",
    "    \n",
    "    \n",
    "df[\"is_bsi_cert\"] = df[\"cert_id\"].apply(is_bsi_cert)\n",
    "df[\"is_anssi_cert\"] = df[\"cert_id\"].apply(is_anssi_cert)\n",
    "\n",
    "bsi_df = df[df[\"is_bsi_cert\"] == True].copy()\n",
    "anssi_df = df[df[\"is_anssi_cert\"] == True].copy()\n",
    "\n",
    "bsi_df[\"is_affecting_anssi\"] = bsi_df[\"directly_affecting\"].apply(is_affecting_anssi)\n",
    "bsi_affecting_anssi_df = bsi_df[bsi_df[\"is_affecting_anssi\"] == True]\n",
    "\n",
    "anssi_df[\"is_affecting_bsi\"] = anssi_df[\"directly_affecting\"].apply(is_affecting_bsi)\n",
    "anssi_affecting_bsi_df = anssi_df[anssi_df[\"is_affecting_bsi\"] == True]\n",
    "\n",
    "bsi_total_records = bsi_df.shape[0]\n",
    "anssi_total_records = anssi_df.shape[0]\n",
    "bsi_affecting_records = bsi_affecting_anssi_df.shape[0]\n",
    "anssi_affecting_records = anssi_affecting_bsi_df.shape[0]\n",
    "\n",
    "print(f\"There are {bsi_affecting_records} BSI certs affecting ANSSI certs out of total {bsi_total_records} BSI certs.\")\n",
    "print(f\"There are {anssi_affecting_records} ANSSI certs affecting BSI certs out of total {anssi_total_records} ANSSI certs.\")\n",
    "\n",
    "print(f\"Success hit for BSI certs: {bsi_affecting_records / bsi_total_records}\")\n",
    "print(f\"Success hit for ANSSI certs: {anssi_affecting_records / anssi_total_records}\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "8613862c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>cert_id</th>\n",
       "      <th>name</th>\n",
       "      <th>status</th>\n",
       "      <th>category</th>\n",
       "      <th>manufacturer</th>\n",
       "      <th>scheme</th>\n",
       "      <th>security_level</th>\n",
       "      <th>not_valid_before</th>\n",
       "      <th>not_valid_after</th>\n",
       "      <th>report_link</th>\n",
       "      <th>...</th>\n",
       "      <th>cpe_matches</th>\n",
       "      <th>verified_cpe_matches</th>\n",
       "      <th>related_cves</th>\n",
       "      <th>directly_affected_by</th>\n",
       "      <th>indirectly_affected_by</th>\n",
       "      <th>directly_affecting</th>\n",
       "      <th>indirectly_affecting</th>\n",
       "      <th>is_bsi_cert</th>\n",
       "      <th>is_anssi_cert</th>\n",
       "      <th>is_affecting_anssi</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dgst</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>424f6d496746258b</th>\n",
       "      <td>BSI-DSZ-CC-1064-2020</td>\n",
       "      <td>MTCOS Pro 2.5 EAC with PACE / ST31G480 D01</td>\n",
       "      <td>active</td>\n",
       "      <td>ICs, Smart Cards and Smart Card-Related Device...</td>\n",
       "      <td>MaskTech International GmbH</td>\n",
       "      <td>DE</td>\n",
       "      <td>[ALC_DVS.2, AVA_VAN.5, EAL5+]</td>\n",
       "      <td>2020-09-29</td>\n",
       "      <td>2025-09-29</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>[BSI-DSZ-CC-1065-2020]</td>\n",
       "      <td>{BSI-DSZ-CC-1065-2020}</td>\n",
       "      <td>{ANSSI-CC-2019/12, BSI-DSZ-CC-0995-2018}</td>\n",
       "      <td>{BSI-DSZ-CC-0973-2016, ANSSI-CC-2019/12, BSI-D...</td>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>b8437dbfeeaf0f04</th>\n",
       "      <td>BSI-DSZ-CC-1065-2020</td>\n",
       "      <td>MTCOS Pro 2.5 EAC with PACE / ST31G480 D01 (BAC)</td>\n",
       "      <td>active</td>\n",
       "      <td>ICs, Smart Cards and Smart Card-Related Device...</td>\n",
       "      <td>MaskTech International GmbH</td>\n",
       "      <td>DE</td>\n",
       "      <td>[ALC_DVS.2, EAL4+]</td>\n",
       "      <td>2020-09-29</td>\n",
       "      <td>2025-09-29</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>{ANSSI-CC-2019/12, BSI-DSZ-CC-1064-2020}</td>\n",
       "      <td>{BSI-DSZ-CC-0973-2016, ANSSI-CC-2019/12, BSI-D...</td>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4832a44c0df0bad2</th>\n",
       "      <td>BSI-DSZ-CC-1074-V2-2020</td>\n",
       "      <td>Xaica-Alpha PLUS ePassport on MTCOS Pro 2.5 wi...</td>\n",
       "      <td>active</td>\n",
       "      <td>ICs, Smart Cards and Smart Card-Related Device...</td>\n",
       "      <td>MaskTech International GmbH</td>\n",
       "      <td>DE</td>\n",
       "      <td>[ALC_DVS.2, EAL4+]</td>\n",
       "      <td>2020-07-30</td>\n",
       "      <td>2025-07-30</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>{BSI-DSZ-CC-1074-V2, ANSSI-CC-2019/12, BSI-DSZ...</td>\n",
       "      <td>{BSI-DSZ-CC-1073-V2, ANSSI-CC-2019/12, BSI-DSZ...</td>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7f9eb1b8217d15ad</th>\n",
       "      <td>BSI-DSZ-CC-1073-V2-2020</td>\n",
       "      <td>Xaica-Alpha PLUS ePassport on MTCOS Pro 2.5 wi...</td>\n",
       "      <td>active</td>\n",
       "      <td>ICs, Smart Cards and Smart Card-Related Device...</td>\n",
       "      <td>MaskTech International GmbH</td>\n",
       "      <td>DE</td>\n",
       "      <td>[ALC_DVS.2, AVA_VAN.5, EAL4+]</td>\n",
       "      <td>2020-07-30</td>\n",
       "      <td>2025-07-30</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>{BSI-DSZ-CC-1074-V2, ANSSI-CC-2019/12, BSI-DSZ...</td>\n",
       "      <td>{BSI-DSZ-CC-1073-V2, ANSSI-CC-2019/12, BSI-DSZ...</td>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>06e505abb8dad1b8</th>\n",
       "      <td>BSI-DSZ-CC-1003-2018</td>\n",
       "      <td>Smart Meter Gateway Security Module Applicatio...</td>\n",
       "      <td>active</td>\n",
       "      <td>ICs, Smart Cards and Smart Card-Related Device...</td>\n",
       "      <td>Gemalto</td>\n",
       "      <td>DE</td>\n",
       "      <td>[AVA_VAN.5, EAL4]</td>\n",
       "      <td>2018-09-18</td>\n",
       "      <td>2028-09-18</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>{ANSSI-CC-2017/54, BSI-DSZ-CC-0891-V2-2016}</td>\n",
       "      <td>{ANSSI-CC-2017/54, BSI-DSZ-CC-0891-2015, BSI-D...</td>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 23 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                  cert_id  \\\n",
       "dgst                                        \n",
       "424f6d496746258b     BSI-DSZ-CC-1064-2020   \n",
       "b8437dbfeeaf0f04     BSI-DSZ-CC-1065-2020   \n",
       "4832a44c0df0bad2  BSI-DSZ-CC-1074-V2-2020   \n",
       "7f9eb1b8217d15ad  BSI-DSZ-CC-1073-V2-2020   \n",
       "06e505abb8dad1b8     BSI-DSZ-CC-1003-2018   \n",
       "\n",
       "                                                               name  status  \\\n",
       "dgst                                                                          \n",
       "424f6d496746258b         MTCOS Pro 2.5 EAC with PACE / ST31G480 D01  active   \n",
       "b8437dbfeeaf0f04   MTCOS Pro 2.5 EAC with PACE / ST31G480 D01 (BAC)  active   \n",
       "4832a44c0df0bad2  Xaica-Alpha PLUS ePassport on MTCOS Pro 2.5 wi...  active   \n",
       "7f9eb1b8217d15ad  Xaica-Alpha PLUS ePassport on MTCOS Pro 2.5 wi...  active   \n",
       "06e505abb8dad1b8  Smart Meter Gateway Security Module Applicatio...  active   \n",
       "\n",
       "                                                           category  \\\n",
       "dgst                                                                  \n",
       "424f6d496746258b  ICs, Smart Cards and Smart Card-Related Device...   \n",
       "b8437dbfeeaf0f04  ICs, Smart Cards and Smart Card-Related Device...   \n",
       "4832a44c0df0bad2  ICs, Smart Cards and Smart Card-Related Device...   \n",
       "7f9eb1b8217d15ad  ICs, Smart Cards and Smart Card-Related Device...   \n",
       "06e505abb8dad1b8  ICs, Smart Cards and Smart Card-Related Device...   \n",
       "\n",
       "                                 manufacturer scheme  \\\n",
       "dgst                                                   \n",
       "424f6d496746258b  MaskTech International GmbH     DE   \n",
       "b8437dbfeeaf0f04  MaskTech International GmbH     DE   \n",
       "4832a44c0df0bad2  MaskTech International GmbH     DE   \n",
       "7f9eb1b8217d15ad  MaskTech International GmbH     DE   \n",
       "06e505abb8dad1b8                      Gemalto     DE   \n",
       "\n",
       "                                 security_level not_valid_before  \\\n",
       "dgst                                                               \n",
       "424f6d496746258b  [ALC_DVS.2, AVA_VAN.5, EAL5+]       2020-09-29   \n",
       "b8437dbfeeaf0f04             [ALC_DVS.2, EAL4+]       2020-09-29   \n",
       "4832a44c0df0bad2             [ALC_DVS.2, EAL4+]       2020-07-30   \n",
       "7f9eb1b8217d15ad  [ALC_DVS.2, AVA_VAN.5, EAL4+]       2020-07-30   \n",
       "06e505abb8dad1b8              [AVA_VAN.5, EAL4]       2018-09-18   \n",
       "\n",
       "                 not_valid_after  \\\n",
       "dgst                               \n",
       "424f6d496746258b      2025-09-29   \n",
       "b8437dbfeeaf0f04      2025-09-29   \n",
       "4832a44c0df0bad2      2025-07-30   \n",
       "7f9eb1b8217d15ad      2025-07-30   \n",
       "06e505abb8dad1b8      2028-09-18   \n",
       "\n",
       "                                                        report_link  ...  \\\n",
       "dgst                                                                 ...   \n",
       "424f6d496746258b  https://www.commoncriteriaportal.org/files/epf...  ...   \n",
       "b8437dbfeeaf0f04  https://www.commoncriteriaportal.org/files/epf...  ...   \n",
       "4832a44c0df0bad2  https://www.commoncriteriaportal.org/files/epf...  ...   \n",
       "7f9eb1b8217d15ad  https://www.commoncriteriaportal.org/files/epf...  ...   \n",
       "06e505abb8dad1b8  https://www.commoncriteriaportal.org/files/epf...  ...   \n",
       "\n",
       "                 cpe_matches verified_cpe_matches related_cves  \\\n",
       "dgst                                                             \n",
       "424f6d496746258b         NaN                  NaN          NaN   \n",
       "b8437dbfeeaf0f04         NaN                  NaN          NaN   \n",
       "4832a44c0df0bad2         NaN                  NaN          NaN   \n",
       "7f9eb1b8217d15ad         NaN                  NaN          NaN   \n",
       "06e505abb8dad1b8         NaN                  NaN          NaN   \n",
       "\n",
       "                    directly_affected_by  indirectly_affected_by  \\\n",
       "dgst                                                               \n",
       "424f6d496746258b  [BSI-DSZ-CC-1065-2020]  {BSI-DSZ-CC-1065-2020}   \n",
       "b8437dbfeeaf0f04                     NaN                     NaN   \n",
       "4832a44c0df0bad2                     NaN                     NaN   \n",
       "7f9eb1b8217d15ad                     NaN                     NaN   \n",
       "06e505abb8dad1b8                     NaN                     NaN   \n",
       "\n",
       "                                                 directly_affecting  \\\n",
       "dgst                                                                  \n",
       "424f6d496746258b           {ANSSI-CC-2019/12, BSI-DSZ-CC-0995-2018}   \n",
       "b8437dbfeeaf0f04           {ANSSI-CC-2019/12, BSI-DSZ-CC-1064-2020}   \n",
       "4832a44c0df0bad2  {BSI-DSZ-CC-1074-V2, ANSSI-CC-2019/12, BSI-DSZ...   \n",
       "7f9eb1b8217d15ad  {BSI-DSZ-CC-1074-V2, ANSSI-CC-2019/12, BSI-DSZ...   \n",
       "06e505abb8dad1b8        {ANSSI-CC-2017/54, BSI-DSZ-CC-0891-V2-2016}   \n",
       "\n",
       "                                               indirectly_affecting  \\\n",
       "dgst                                                                  \n",
       "424f6d496746258b  {BSI-DSZ-CC-0973-2016, ANSSI-CC-2019/12, BSI-D...   \n",
       "b8437dbfeeaf0f04  {BSI-DSZ-CC-0973-2016, ANSSI-CC-2019/12, BSI-D...   \n",
       "4832a44c0df0bad2  {BSI-DSZ-CC-1073-V2, ANSSI-CC-2019/12, BSI-DSZ...   \n",
       "7f9eb1b8217d15ad  {BSI-DSZ-CC-1073-V2, ANSSI-CC-2019/12, BSI-DSZ...   \n",
       "06e505abb8dad1b8  {ANSSI-CC-2017/54, BSI-DSZ-CC-0891-2015, BSI-D...   \n",
       "\n",
       "                 is_bsi_cert is_anssi_cert is_affecting_anssi  \n",
       "dgst                                                           \n",
       "424f6d496746258b        True         False               True  \n",
       "b8437dbfeeaf0f04        True         False               True  \n",
       "4832a44c0df0bad2        True         False               True  \n",
       "7f9eb1b8217d15ad        True         False               True  \n",
       "06e505abb8dad1b8        True         False               True  \n",
       "\n",
       "[5 rows x 23 columns]"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "bsi_affecting_anssi_df.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e357818b",
   "metadata": {},
   "source": [
    "### Which certificates are referencing each other? (= are crossed referenced)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "1376bb24",
   "metadata": {},
   "outputs": [
    {
     "ename": "KeyboardInterrupt",
     "evalue": "",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mKeyboardInterrupt\u001b[0m                         Traceback (most recent call last)",
      "\u001b[0;32m/tmp/ipykernel_5791/2939454344.py\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m     22\u001b[0m         \u001b[0mcerts_set\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mset\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mcert_id\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0manother_cert_id\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     23\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 24\u001b[0;31m         \u001b[0;32mif\u001b[0m \u001b[0mis_cert_affecting_other_cert\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mcert_id\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0manother_cert_id\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mand\u001b[0m \u001b[0mis_cert_affecting_other_cert\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0manother_cert_id\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcert_id\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mand\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mis_already_involved\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mcross_reference_list\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcerts_set\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m     25\u001b[0m             \u001b[0mcross_reference_list\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mappend\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mcerts_set\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     26\u001b[0m     \u001b[0mcount\u001b[0m \u001b[0;34m+=\u001b[0m \u001b[0;36m1\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m/tmp/ipykernel_5791/2939454344.py\u001b[0m in \u001b[0;36mis_cert_affecting_other_cert\u001b[0;34m(root_cert_id, affected_cert_id)\u001b[0m\n\u001b[1;32m      3\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m      4\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mis_cert_affecting_other_cert\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mroot_cert_id\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mstr\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0maffected_cert_id\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mstr\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m->\u001b[0m \u001b[0mbool\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 5\u001b[0;31m     \u001b[0;32mreturn\u001b[0m \u001b[0maffected_cert_id\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mcross_df\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mcross_df\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"cert_id\"\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0mroot_cert_id\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0miloc\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"directly_affecting\"\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m      6\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m      7\u001b[0m \u001b[0mcross_reference_list\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mList\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mSet\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mstr\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m~/ohmygit/sec-certs/notebooks/cc/env/lib/python3.8/site-packages/pandas/core/ops/common.py\u001b[0m in \u001b[0;36mnew_method\u001b[0;34m(self, other)\u001b[0m\n\u001b[1;32m     63\u001b[0m         \u001b[0mother\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mitem_from_zerodim\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mother\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     64\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 65\u001b[0;31m         \u001b[0;32mreturn\u001b[0m \u001b[0mmethod\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mother\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m     66\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     67\u001b[0m     \u001b[0;32mreturn\u001b[0m \u001b[0mnew_method\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m~/ohmygit/sec-certs/notebooks/cc/env/lib/python3.8/site-packages/pandas/core/ops/__init__.py\u001b[0m in \u001b[0;36mwrapper\u001b[0;34m(self, other)\u001b[0m\n\u001b[1;32m    368\u001b[0m         \u001b[0mrvalues\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mextract_array\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mother\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mextract_numpy\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mTrue\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    369\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 370\u001b[0;31m         \u001b[0mres_values\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mcomparison_op\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mlvalues\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mrvalues\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mop\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    371\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    372\u001b[0m         \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_construct_result\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mres_values\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mname\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mres_name\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m~/ohmygit/sec-certs/notebooks/cc/env/lib/python3.8/site-packages/pandas/core/ops/array_ops.py\u001b[0m in \u001b[0;36mcomparison_op\u001b[0;34m(left, right, op)\u001b[0m\n\u001b[1;32m    242\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    243\u001b[0m     \u001b[0;32melif\u001b[0m \u001b[0mis_object_dtype\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mlvalues\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdtype\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 244\u001b[0;31m         \u001b[0mres_values\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mcomp_method_OBJECT_ARRAY\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mop\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlvalues\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mrvalues\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    245\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    246\u001b[0m     \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;32m~/ohmygit/sec-certs/notebooks/cc/env/lib/python3.8/site-packages/pandas/core/ops/array_ops.py\u001b[0m in \u001b[0;36mcomp_method_OBJECT_ARRAY\u001b[0;34m(op, x, y)\u001b[0m\n\u001b[1;32m     54\u001b[0m         \u001b[0mresult\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mlibops\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mvec_compare\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mravel\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0my\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mravel\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mop\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     55\u001b[0m     \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 56\u001b[0;31m         \u001b[0mresult\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mlibops\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mscalar_compare\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mravel\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0my\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mop\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m     57\u001b[0m     \u001b[0;32mreturn\u001b[0m \u001b[0mresult\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mreshape\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mshape\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m     58\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;31mKeyboardInterrupt\u001b[0m: "
     ]
    }
   ],
   "source": [
    "def is_already_involved(cross_reference_list: List[Tuple[str, str]], certs_set: Set[str]) -> bool:\n",
    "    return certs_set in cross_reference_list\n",
    "\n",
    "def is_cert_affecting_other_cert(root_cert_id: str, affected_cert_id: str) -> bool:\n",
    "    return affected_cert_id in cross_df[cross_df[\"cert_id\"] == root_cert_id].iloc[0][\"directly_affecting\"]\n",
    "\n",
    "cross_reference_list: List[Set[str]] = []\n",
    "cross_df = df[(df[\"cert_id\"].notna()) & (df[\"directly_affecting\"].notna())]\n",
    "count = 1\n",
    "total = cross_df.shape[0]\n",
    "\n",
    "for cert_record in cross_df.itertuples():\n",
    "    cert_id = cert_record.cert_id\n",
    "\n",
    "    for another_cert_record in cross_df.itertuples():\n",
    "\n",
    "        another_cert_id = another_cert_record.cert_id\n",
    "        \n",
    "        if cert_record.cert_id == another_cert_record.cert_id:\n",
    "            continue\n",
    "            \n",
    "        certs_set = set([cert_id, another_cert_id])\n",
    "        \n",
    "        if is_cert_affecting_other_cert(cert_id, another_cert_id) and is_cert_affecting_other_cert(another_cert_id, cert_id) and not is_already_involved(cross_reference_list, certs_set):\n",
    "            cross_reference_list.append(certs_set)\n",
    "    count += 1 \n",
    "    \n",
    "    \n",
    "print(f\"Total of {len(cross_reference_list)} crossed referenced certificates.\")\n",
    "print(cross_reference_list)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b03da278",
   "metadata": {},
   "source": [
    "### What are the EAL levels typically affecting a certificate? E.g. are certificates referencing EAL5 typically higher or same level?"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "e604ee18",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>cert_id</th>\n",
       "      <th>name</th>\n",
       "      <th>status</th>\n",
       "      <th>category</th>\n",
       "      <th>manufacturer</th>\n",
       "      <th>scheme</th>\n",
       "      <th>security_level</th>\n",
       "      <th>not_valid_before</th>\n",
       "      <th>not_valid_after</th>\n",
       "      <th>report_link</th>\n",
       "      <th>...</th>\n",
       "      <th>extracted_versions</th>\n",
       "      <th>cpe_matches</th>\n",
       "      <th>verified_cpe_matches</th>\n",
       "      <th>related_cves</th>\n",
       "      <th>directly_affected_by</th>\n",
       "      <th>indirectly_affected_by</th>\n",
       "      <th>directly_affecting</th>\n",
       "      <th>indirectly_affecting</th>\n",
       "      <th>is_bsi_cert</th>\n",
       "      <th>is_anssi_cert</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dgst</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>a89ee15539d006d1</th>\n",
       "      <td>NaN</td>\n",
       "      <td>DriveLock Agent 2019.2 (Device and Application...</td>\n",
       "      <td>active</td>\n",
       "      <td>Access Control Devices and Systems</td>\n",
       "      <td>DriveLock SE</td>\n",
       "      <td>SE</td>\n",
       "      <td>[ALC_FLR.3, EAL3]</td>\n",
       "      <td>2021-04-07</td>\n",
       "      <td>2026-04-07</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>...</td>\n",
       "      <td>[2019.2]</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>309ac2fd7f2dcf17</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NetIQ Identity Manager 4.7</td>\n",
       "      <td>active</td>\n",
       "      <td>Access Control Devices and Systems</td>\n",
       "      <td>NetIQ Corporation</td>\n",
       "      <td>SE</td>\n",
       "      <td>[ALC_FLR.2, EAL3+]</td>\n",
       "      <td>2020-06-15</td>\n",
       "      <td>2025-06-15</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>...</td>\n",
       "      <td>[4.7]</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8cf86948f02f047d</th>\n",
       "      <td>KECS-CR-19-70</td>\n",
       "      <td>Magic SSO V4.0</td>\n",
       "      <td>active</td>\n",
       "      <td>Access Control Devices and Systems</td>\n",
       "      <td>Dreamsecurity Co., Ltd.</td>\n",
       "      <td>KR</td>\n",
       "      <td>[]</td>\n",
       "      <td>2019-11-15</td>\n",
       "      <td>2024-11-15</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>...</td>\n",
       "      <td>[4.0]</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0fc32111e368dcf5</th>\n",
       "      <td>NSCIB-CC-0006151-CR</td>\n",
       "      <td>NetIQ Access Manager 4.5</td>\n",
       "      <td>active</td>\n",
       "      <td>Access Control Devices and Systems</td>\n",
       "      <td>NetIQ, Incorporated</td>\n",
       "      <td>NL</td>\n",
       "      <td>[ALC_FLR.1, EAL3+]</td>\n",
       "      <td>2019-11-07</td>\n",
       "      <td>2024-11-07</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>...</td>\n",
       "      <td>[4.5]</td>\n",
       "      <td>[cpe:2.3:a:netiq:access_manager:4.5:hotfix1:*:...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5e87de1cddf1ae43</th>\n",
       "      <td>NaN</td>\n",
       "      <td>Illumio Adaptive Security Platform v18.2.2</td>\n",
       "      <td>active</td>\n",
       "      <td>Access Control Devices and Systems</td>\n",
       "      <td>Illumio</td>\n",
       "      <td>CA</td>\n",
       "      <td>[]</td>\n",
       "      <td>2019-07-12</td>\n",
       "      <td>2024-07-12</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>...</td>\n",
       "      <td>[18.2.2]</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 22 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                              cert_id  \\\n",
       "dgst                                    \n",
       "a89ee15539d006d1                  NaN   \n",
       "309ac2fd7f2dcf17                  NaN   \n",
       "8cf86948f02f047d        KECS-CR-19-70   \n",
       "0fc32111e368dcf5  NSCIB-CC-0006151-CR   \n",
       "5e87de1cddf1ae43                  NaN   \n",
       "\n",
       "                                                               name  status  \\\n",
       "dgst                                                                          \n",
       "a89ee15539d006d1  DriveLock Agent 2019.2 (Device and Application...  active   \n",
       "309ac2fd7f2dcf17                         NetIQ Identity Manager 4.7  active   \n",
       "8cf86948f02f047d                                     Magic SSO V4.0  active   \n",
       "0fc32111e368dcf5                           NetIQ Access Manager 4.5  active   \n",
       "5e87de1cddf1ae43         Illumio Adaptive Security Platform v18.2.2  active   \n",
       "\n",
       "                                            category             manufacturer  \\\n",
       "dgst                                                                            \n",
       "a89ee15539d006d1  Access Control Devices and Systems             DriveLock SE   \n",
       "309ac2fd7f2dcf17  Access Control Devices and Systems        NetIQ Corporation   \n",
       "8cf86948f02f047d  Access Control Devices and Systems  Dreamsecurity Co., Ltd.   \n",
       "0fc32111e368dcf5  Access Control Devices and Systems      NetIQ, Incorporated   \n",
       "5e87de1cddf1ae43  Access Control Devices and Systems                  Illumio   \n",
       "\n",
       "                 scheme      security_level not_valid_before not_valid_after  \\\n",
       "dgst                                                                           \n",
       "a89ee15539d006d1     SE   [ALC_FLR.3, EAL3]       2021-04-07      2026-04-07   \n",
       "309ac2fd7f2dcf17     SE  [ALC_FLR.2, EAL3+]       2020-06-15      2025-06-15   \n",
       "8cf86948f02f047d     KR                  []       2019-11-15      2024-11-15   \n",
       "0fc32111e368dcf5     NL  [ALC_FLR.1, EAL3+]       2019-11-07      2024-11-07   \n",
       "5e87de1cddf1ae43     CA                  []       2019-07-12      2024-07-12   \n",
       "\n",
       "                                                        report_link  ...  \\\n",
       "dgst                                                                 ...   \n",
       "a89ee15539d006d1  https://www.commoncriteriaportal.org/files/epf...  ...   \n",
       "309ac2fd7f2dcf17  https://www.commoncriteriaportal.org/files/epf...  ...   \n",
       "8cf86948f02f047d  https://www.commoncriteriaportal.org/files/epf...  ...   \n",
       "0fc32111e368dcf5  https://www.commoncriteriaportal.org/files/epf...  ...   \n",
       "5e87de1cddf1ae43  https://www.commoncriteriaportal.org/files/epf...  ...   \n",
       "\n",
       "                 extracted_versions  \\\n",
       "dgst                                  \n",
       "a89ee15539d006d1           [2019.2]   \n",
       "309ac2fd7f2dcf17              [4.7]   \n",
       "8cf86948f02f047d              [4.0]   \n",
       "0fc32111e368dcf5              [4.5]   \n",
       "5e87de1cddf1ae43           [18.2.2]   \n",
       "\n",
       "                                                        cpe_matches  \\\n",
       "dgst                                                                  \n",
       "a89ee15539d006d1                                                NaN   \n",
       "309ac2fd7f2dcf17                                                NaN   \n",
       "8cf86948f02f047d                                                NaN   \n",
       "0fc32111e368dcf5  [cpe:2.3:a:netiq:access_manager:4.5:hotfix1:*:...   \n",
       "5e87de1cddf1ae43                                                NaN   \n",
       "\n",
       "                 verified_cpe_matches related_cves directly_affected_by  \\\n",
       "dgst                                                                      \n",
       "a89ee15539d006d1                  NaN          NaN                  NaN   \n",
       "309ac2fd7f2dcf17                  NaN          NaN                  NaN   \n",
       "8cf86948f02f047d                  NaN          NaN                  NaN   \n",
       "0fc32111e368dcf5                  NaN          NaN                  NaN   \n",
       "5e87de1cddf1ae43                  NaN          NaN                  NaN   \n",
       "\n",
       "                 indirectly_affected_by directly_affecting  \\\n",
       "dgst                                                         \n",
       "a89ee15539d006d1                    NaN                NaN   \n",
       "309ac2fd7f2dcf17                    NaN                NaN   \n",
       "8cf86948f02f047d                    NaN                NaN   \n",
       "0fc32111e368dcf5                    NaN                NaN   \n",
       "5e87de1cddf1ae43                    NaN                NaN   \n",
       "\n",
       "                 indirectly_affecting is_bsi_cert is_anssi_cert  \n",
       "dgst                                                             \n",
       "a89ee15539d006d1                  NaN       False         False  \n",
       "309ac2fd7f2dcf17                  NaN       False         False  \n",
       "8cf86948f02f047d                  NaN       False         False  \n",
       "0fc32111e368dcf5                  NaN       False         False  \n",
       "5e87de1cddf1ae43                  NaN       False         False  \n",
       "\n",
       "[5 rows x 22 columns]"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "c23e0981",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Introduce security level EAL variable\n",
    "eals = ['EAL1', 'EAL1+', 'EAL2', 'EAL2+', 'EAL3', 'EAL3+', 'EAL4', 'EAL4+', 'EAL5', 'EAL5+', 'EAL6+', 'EAL7', 'EAL7+']\n",
    "df['highest_security_level'] = df.security_level.map(lambda all_levels: [eal for eal in all_levels if eal.startswith('EAL')] if all_levels else np.nan)\n",
    "df.highest_security_level = df.highest_security_level.map(lambda x: x[0] if x and isinstance(x, list) else np.nan)\n",
    "df.highest_security_level = pd.Categorical(df.highest_security_level, categories=eals, ordered=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "id": "faa13c35",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>cert_id</th>\n",
       "      <th>name</th>\n",
       "      <th>status</th>\n",
       "      <th>category</th>\n",
       "      <th>manufacturer</th>\n",
       "      <th>scheme</th>\n",
       "      <th>security_level</th>\n",
       "      <th>not_valid_before</th>\n",
       "      <th>not_valid_after</th>\n",
       "      <th>report_link</th>\n",
       "      <th>...</th>\n",
       "      <th>cpe_matches</th>\n",
       "      <th>verified_cpe_matches</th>\n",
       "      <th>related_cves</th>\n",
       "      <th>directly_affected_by</th>\n",
       "      <th>indirectly_affected_by</th>\n",
       "      <th>directly_affecting</th>\n",
       "      <th>indirectly_affecting</th>\n",
       "      <th>is_bsi_cert</th>\n",
       "      <th>is_anssi_cert</th>\n",
       "      <th>highest_security_level</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dgst</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>98c1ac41aedcdae2</th>\n",
       "      <td>BSI-DSZ-CC-1142-2020</td>\n",
       "      <td>genuscreen 7.0</td>\n",
       "      <td>active</td>\n",
       "      <td>Boundary Protection Devices and Systems</td>\n",
       "      <td>genua GmbH</td>\n",
       "      <td>DE</td>\n",
       "      <td>[ALC_FLR.2, ASE_TSS.2, AVA_VAN.4, EAL4+]</td>\n",
       "      <td>2020-08-18</td>\n",
       "      <td>2025-08-17</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>{BSI-DSZ-CC-1085-2019}</td>\n",
       "      <td>{BSI-DSZ-CC-1085-2019}</td>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>EAL4+</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0eff4063e68d7cd6</th>\n",
       "      <td>BSI-DSZ-CC-0823-2014</td>\n",
       "      <td>genuscreen 4.0</td>\n",
       "      <td>active</td>\n",
       "      <td>Boundary Protection Devices and Systems</td>\n",
       "      <td>GeNUA mbH</td>\n",
       "      <td>DE</td>\n",
       "      <td>[ALC_FLR.2, ASE_TSS.2, AVA_VAN.4, EAL4+]</td>\n",
       "      <td>2014-10-29</td>\n",
       "      <td>NaT</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>[BSI-DSZ-CC-0966-2015]</td>\n",
       "      <td>{BSI-DSZ-CC-0966-2015}</td>\n",
       "      <td>{BSI-DSZ-CC-0565-2009}</td>\n",
       "      <td>{BSI-DSZ-CC-0565-2009, BSI-DSZ-CC-0382-2007}</td>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>EAL4+</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>e62f50581d828477</th>\n",
       "      <td>BSI-DSZ-CC-0519-V3-2021</td>\n",
       "      <td>ORGA 6141 online Version 3.7.2:1.2.0</td>\n",
       "      <td>active</td>\n",
       "      <td>ICs, Smart Cards and Smart Card-Related Device...</td>\n",
       "      <td>Ingenico Healthcare GmbH</td>\n",
       "      <td>DE</td>\n",
       "      <td>[ADV_FSP.4, ADV_IMP.1, ADV_TDS.3, ALC_TAT.1, A...</td>\n",
       "      <td>2021-03-22</td>\n",
       "      <td>2026-03-22</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>{BSI-DSZ-CC-0519-V2-2018}</td>\n",
       "      <td>{BSI-DSZ-CC-0519-V2-2018}</td>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>EAL3+</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6a5cb89e80f86ce9</th>\n",
       "      <td>BSI-DSZ-CC-0977-V3-2021</td>\n",
       "      <td>NXP Secure Smart Card Controller N7021 VA incl...</td>\n",
       "      <td>active</td>\n",
       "      <td>ICs, Smart Cards and Smart Card-Related Device...</td>\n",
       "      <td>NXP Semiconductors Germany GmbH</td>\n",
       "      <td>DE</td>\n",
       "      <td>[ALC_FLR.1, ASE_TSS.2, EAL6+]</td>\n",
       "      <td>2021-02-24</td>\n",
       "      <td>2026-02-24</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>{BSI-DSZ-CC-0977-V3, BSI-DSZ-CC-0977-V2-2019}</td>\n",
       "      <td>{BSI-DSZ-CC-0977-2017, BSI-DSZ-CC-0977-V3, BSI...</td>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>EAL6+</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>41fb9717f70d3037</th>\n",
       "      <td>BSI-DSZ-CC-1052-V3-2021</td>\n",
       "      <td>RISE Konnektor V3.0</td>\n",
       "      <td>active</td>\n",
       "      <td>ICs, Smart Cards and Smart Card-Related Device...</td>\n",
       "      <td>Research Industrial Systems Engineering (RISE)...</td>\n",
       "      <td>DE</td>\n",
       "      <td>[ADV_FSP.4, ADV_INT.1, ADV_TDS.3, ALC_FLR.2, A...</td>\n",
       "      <td>2021-02-22</td>\n",
       "      <td>2026-03-21</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>{BSI-DSZ-CC-1052-V2-2020, BSI-DSZ-CC-1052-V3}</td>\n",
       "      <td>{BSI-DSZ-CC-1052-V2-2020, BSI-DSZ-CC-1052-V2, ...</td>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>EAL3+</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 23 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                  cert_id  \\\n",
       "dgst                                        \n",
       "98c1ac41aedcdae2     BSI-DSZ-CC-1142-2020   \n",
       "0eff4063e68d7cd6     BSI-DSZ-CC-0823-2014   \n",
       "e62f50581d828477  BSI-DSZ-CC-0519-V3-2021   \n",
       "6a5cb89e80f86ce9  BSI-DSZ-CC-0977-V3-2021   \n",
       "41fb9717f70d3037  BSI-DSZ-CC-1052-V3-2021   \n",
       "\n",
       "                                                               name  status  \\\n",
       "dgst                                                                          \n",
       "98c1ac41aedcdae2                                     genuscreen 7.0  active   \n",
       "0eff4063e68d7cd6                                     genuscreen 4.0  active   \n",
       "e62f50581d828477               ORGA 6141 online Version 3.7.2:1.2.0  active   \n",
       "6a5cb89e80f86ce9  NXP Secure Smart Card Controller N7021 VA incl...  active   \n",
       "41fb9717f70d3037                                RISE Konnektor V3.0  active   \n",
       "\n",
       "                                                           category  \\\n",
       "dgst                                                                  \n",
       "98c1ac41aedcdae2            Boundary Protection Devices and Systems   \n",
       "0eff4063e68d7cd6            Boundary Protection Devices and Systems   \n",
       "e62f50581d828477  ICs, Smart Cards and Smart Card-Related Device...   \n",
       "6a5cb89e80f86ce9  ICs, Smart Cards and Smart Card-Related Device...   \n",
       "41fb9717f70d3037  ICs, Smart Cards and Smart Card-Related Device...   \n",
       "\n",
       "                                                       manufacturer scheme  \\\n",
       "dgst                                                                         \n",
       "98c1ac41aedcdae2                                         genua GmbH     DE   \n",
       "0eff4063e68d7cd6                                          GeNUA mbH     DE   \n",
       "e62f50581d828477                           Ingenico Healthcare GmbH     DE   \n",
       "6a5cb89e80f86ce9                    NXP Semiconductors Germany GmbH     DE   \n",
       "41fb9717f70d3037  Research Industrial Systems Engineering (RISE)...     DE   \n",
       "\n",
       "                                                     security_level  \\\n",
       "dgst                                                                  \n",
       "98c1ac41aedcdae2           [ALC_FLR.2, ASE_TSS.2, AVA_VAN.4, EAL4+]   \n",
       "0eff4063e68d7cd6           [ALC_FLR.2, ASE_TSS.2, AVA_VAN.4, EAL4+]   \n",
       "e62f50581d828477  [ADV_FSP.4, ADV_IMP.1, ADV_TDS.3, ALC_TAT.1, A...   \n",
       "6a5cb89e80f86ce9                      [ALC_FLR.1, ASE_TSS.2, EAL6+]   \n",
       "41fb9717f70d3037  [ADV_FSP.4, ADV_INT.1, ADV_TDS.3, ALC_FLR.2, A...   \n",
       "\n",
       "                 not_valid_before not_valid_after  \\\n",
       "dgst                                                \n",
       "98c1ac41aedcdae2       2020-08-18      2025-08-17   \n",
       "0eff4063e68d7cd6       2014-10-29             NaT   \n",
       "e62f50581d828477       2021-03-22      2026-03-22   \n",
       "6a5cb89e80f86ce9       2021-02-24      2026-02-24   \n",
       "41fb9717f70d3037       2021-02-22      2026-03-21   \n",
       "\n",
       "                                                        report_link  ...  \\\n",
       "dgst                                                                 ...   \n",
       "98c1ac41aedcdae2  https://www.commoncriteriaportal.org/files/epf...  ...   \n",
       "0eff4063e68d7cd6  https://www.commoncriteriaportal.org/files/epf...  ...   \n",
       "e62f50581d828477  https://www.commoncriteriaportal.org/files/epf...  ...   \n",
       "6a5cb89e80f86ce9  https://www.commoncriteriaportal.org/files/epf...  ...   \n",
       "41fb9717f70d3037  https://www.commoncriteriaportal.org/files/epf...  ...   \n",
       "\n",
       "                 cpe_matches verified_cpe_matches related_cves  \\\n",
       "dgst                                                             \n",
       "98c1ac41aedcdae2         NaN                  NaN          NaN   \n",
       "0eff4063e68d7cd6         NaN                  NaN          NaN   \n",
       "e62f50581d828477         NaN                  NaN          NaN   \n",
       "6a5cb89e80f86ce9         NaN                  NaN          NaN   \n",
       "41fb9717f70d3037         NaN                  NaN          NaN   \n",
       "\n",
       "                    directly_affected_by  indirectly_affected_by  \\\n",
       "dgst                                                               \n",
       "98c1ac41aedcdae2                     NaN                     NaN   \n",
       "0eff4063e68d7cd6  [BSI-DSZ-CC-0966-2015]  {BSI-DSZ-CC-0966-2015}   \n",
       "e62f50581d828477                     NaN                     NaN   \n",
       "6a5cb89e80f86ce9                     NaN                     NaN   \n",
       "41fb9717f70d3037                     NaN                     NaN   \n",
       "\n",
       "                                             directly_affecting  \\\n",
       "dgst                                                              \n",
       "98c1ac41aedcdae2                         {BSI-DSZ-CC-1085-2019}   \n",
       "0eff4063e68d7cd6                         {BSI-DSZ-CC-0565-2009}   \n",
       "e62f50581d828477                      {BSI-DSZ-CC-0519-V2-2018}   \n",
       "6a5cb89e80f86ce9  {BSI-DSZ-CC-0977-V3, BSI-DSZ-CC-0977-V2-2019}   \n",
       "41fb9717f70d3037  {BSI-DSZ-CC-1052-V2-2020, BSI-DSZ-CC-1052-V3}   \n",
       "\n",
       "                                               indirectly_affecting  \\\n",
       "dgst                                                                  \n",
       "98c1ac41aedcdae2                             {BSI-DSZ-CC-1085-2019}   \n",
       "0eff4063e68d7cd6       {BSI-DSZ-CC-0565-2009, BSI-DSZ-CC-0382-2007}   \n",
       "e62f50581d828477                          {BSI-DSZ-CC-0519-V2-2018}   \n",
       "6a5cb89e80f86ce9  {BSI-DSZ-CC-0977-2017, BSI-DSZ-CC-0977-V3, BSI...   \n",
       "41fb9717f70d3037  {BSI-DSZ-CC-1052-V2-2020, BSI-DSZ-CC-1052-V2, ...   \n",
       "\n",
       "                 is_bsi_cert is_anssi_cert highest_security_level  \n",
       "dgst                                                               \n",
       "98c1ac41aedcdae2        True         False                  EAL4+  \n",
       "0eff4063e68d7cd6        True         False                  EAL4+  \n",
       "e62f50581d828477        True         False                  EAL3+  \n",
       "6a5cb89e80f86ce9        True         False                  EAL6+  \n",
       "41fb9717f70d3037        True         False                  EAL3+  \n",
       "\n",
       "[5 rows x 23 columns]"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "levels_df = df[(df[\"highest_security_level\"].notna()) & (df[\"directly_affecting\"].notna()) & (df[\"cert_id\"].notna())].copy()\n",
    "levels_df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "id": "2238bb57",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>cert_id</th>\n",
       "      <th>name</th>\n",
       "      <th>status</th>\n",
       "      <th>category</th>\n",
       "      <th>manufacturer</th>\n",
       "      <th>scheme</th>\n",
       "      <th>security_level</th>\n",
       "      <th>not_valid_before</th>\n",
       "      <th>not_valid_after</th>\n",
       "      <th>report_link</th>\n",
       "      <th>...</th>\n",
       "      <th>verified_cpe_matches</th>\n",
       "      <th>related_cves</th>\n",
       "      <th>directly_affected_by</th>\n",
       "      <th>indirectly_affected_by</th>\n",
       "      <th>directly_affecting</th>\n",
       "      <th>indirectly_affecting</th>\n",
       "      <th>is_bsi_cert</th>\n",
       "      <th>is_anssi_cert</th>\n",
       "      <th>highest_security_level</th>\n",
       "      <th>affecting_security_levels</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dgst</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>98c1ac41aedcdae2</th>\n",
       "      <td>BSI-DSZ-CC-1142-2020</td>\n",
       "      <td>genuscreen 7.0</td>\n",
       "      <td>active</td>\n",
       "      <td>Boundary Protection Devices and Systems</td>\n",
       "      <td>genua GmbH</td>\n",
       "      <td>DE</td>\n",
       "      <td>[ALC_FLR.2, ASE_TSS.2, AVA_VAN.4, EAL4+]</td>\n",
       "      <td>2020-08-18</td>\n",
       "      <td>2025-08-17</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>{BSI-DSZ-CC-1085-2019}</td>\n",
       "      <td>{BSI-DSZ-CC-1085-2019}</td>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>EAL4+</td>\n",
       "      <td>{}</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0eff4063e68d7cd6</th>\n",
       "      <td>BSI-DSZ-CC-0823-2014</td>\n",
       "      <td>genuscreen 4.0</td>\n",
       "      <td>active</td>\n",
       "      <td>Boundary Protection Devices and Systems</td>\n",
       "      <td>GeNUA mbH</td>\n",
       "      <td>DE</td>\n",
       "      <td>[ALC_FLR.2, ASE_TSS.2, AVA_VAN.4, EAL4+]</td>\n",
       "      <td>2014-10-29</td>\n",
       "      <td>NaT</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>[BSI-DSZ-CC-0966-2015]</td>\n",
       "      <td>{BSI-DSZ-CC-0966-2015}</td>\n",
       "      <td>{BSI-DSZ-CC-0565-2009}</td>\n",
       "      <td>{BSI-DSZ-CC-0565-2009, BSI-DSZ-CC-0382-2007}</td>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>EAL4+</td>\n",
       "      <td>{'EAL4+': 1}</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>e62f50581d828477</th>\n",
       "      <td>BSI-DSZ-CC-0519-V3-2021</td>\n",
       "      <td>ORGA 6141 online Version 3.7.2:1.2.0</td>\n",
       "      <td>active</td>\n",
       "      <td>ICs, Smart Cards and Smart Card-Related Device...</td>\n",
       "      <td>Ingenico Healthcare GmbH</td>\n",
       "      <td>DE</td>\n",
       "      <td>[ADV_FSP.4, ADV_IMP.1, ADV_TDS.3, ALC_TAT.1, A...</td>\n",
       "      <td>2021-03-22</td>\n",
       "      <td>2026-03-22</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>{BSI-DSZ-CC-0519-V2-2018}</td>\n",
       "      <td>{BSI-DSZ-CC-0519-V2-2018}</td>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>EAL3+</td>\n",
       "      <td>{}</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6a5cb89e80f86ce9</th>\n",
       "      <td>BSI-DSZ-CC-0977-V3-2021</td>\n",
       "      <td>NXP Secure Smart Card Controller N7021 VA incl...</td>\n",
       "      <td>active</td>\n",
       "      <td>ICs, Smart Cards and Smart Card-Related Device...</td>\n",
       "      <td>NXP Semiconductors Germany GmbH</td>\n",
       "      <td>DE</td>\n",
       "      <td>[ALC_FLR.1, ASE_TSS.2, EAL6+]</td>\n",
       "      <td>2021-02-24</td>\n",
       "      <td>2026-02-24</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>{BSI-DSZ-CC-0977-V3, BSI-DSZ-CC-0977-V2-2019}</td>\n",
       "      <td>{BSI-DSZ-CC-0977-2017, BSI-DSZ-CC-0977-V3, BSI...</td>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>EAL6+</td>\n",
       "      <td>{'EAL6+': 1}</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>41fb9717f70d3037</th>\n",
       "      <td>BSI-DSZ-CC-1052-V3-2021</td>\n",
       "      <td>RISE Konnektor V3.0</td>\n",
       "      <td>active</td>\n",
       "      <td>ICs, Smart Cards and Smart Card-Related Device...</td>\n",
       "      <td>Research Industrial Systems Engineering (RISE)...</td>\n",
       "      <td>DE</td>\n",
       "      <td>[ADV_FSP.4, ADV_INT.1, ADV_TDS.3, ALC_FLR.2, A...</td>\n",
       "      <td>2021-02-22</td>\n",
       "      <td>2026-03-21</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>{BSI-DSZ-CC-1052-V2-2020, BSI-DSZ-CC-1052-V3}</td>\n",
       "      <td>{BSI-DSZ-CC-1052-V2-2020, BSI-DSZ-CC-1052-V2, ...</td>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>EAL3+</td>\n",
       "      <td>{'EAL3': 1}</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>cc533c087f06ad0d</th>\n",
       "      <td>BSI-DSZ-CC-1147-2020</td>\n",
       "      <td>MTCOS Pro 2.5 EAC with PACE / P71D352 (N7121)</td>\n",
       "      <td>active</td>\n",
       "      <td>ICs, Smart Cards and Smart Card-Related Device...</td>\n",
       "      <td>MaskTech International GmbH</td>\n",
       "      <td>DE</td>\n",
       "      <td>[ALC_DVS.2, AVA_VAN.5, EAL5+]</td>\n",
       "      <td>2020-12-18</td>\n",
       "      <td>2025-12-18</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>[BSI-DSZ-CC-1148-2020]</td>\n",
       "      <td>{BSI-DSZ-CC-1148-2020}</td>\n",
       "      <td>{BSI-DSZ-CC-1033-2019, BSI-DSZ-CC-1040-2019}</td>\n",
       "      <td>{BSI-DSZ-CC-1034-2019, BSI-DSZ-CC-1040-2019, B...</td>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>EAL5+</td>\n",
       "      <td>{'EAL5+': 1, 'EAL6+': 1}</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>a69ec271f8651d1b</th>\n",
       "      <td>BSI-DSZ-CC-1148-2020</td>\n",
       "      <td>MTCOS Pro 2.5 EAC with PACE / P71D352 (N7121) ...</td>\n",
       "      <td>active</td>\n",
       "      <td>ICs, Smart Cards and Smart Card-Related Device...</td>\n",
       "      <td>MaskTech International GmbH</td>\n",
       "      <td>DE</td>\n",
       "      <td>[ALC_DVS.2, EAL4+]</td>\n",
       "      <td>2020-12-18</td>\n",
       "      <td>2025-12-18</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>{BSI-DSZ-CC-1040-2019, BSI-DSZ-CC-1147-2020}</td>\n",
       "      <td>{BSI-DSZ-CC-1034-2019, BSI-DSZ-CC-1147-2020, B...</td>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>EAL4+</td>\n",
       "      <td>{'EAL6+': 1, 'EAL5+': 1}</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dc45c7a6ef17f8b5</th>\n",
       "      <td>BSI-DSZ-CC-1161-2020</td>\n",
       "      <td>Bundesdruckerei Document Application with tamp...</td>\n",
       "      <td>active</td>\n",
       "      <td>ICs, Smart Cards and Smart Card-Related Device...</td>\n",
       "      <td>Bundesdruckerei GmbH</td>\n",
       "      <td>DE</td>\n",
       "      <td>[EAL3]</td>\n",
       "      <td>2020-12-11</td>\n",
       "      <td>2025-12-10</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>{BSI-DSZ-CC-1125-2019}</td>\n",
       "      <td>{BSI-DSZ-CC-1125-2019}</td>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>EAL3</td>\n",
       "      <td>{'EAL3': 1}</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15d68159595eae09</th>\n",
       "      <td>BSI-DSZ-CC-0782-V5-2020</td>\n",
       "      <td>Infineon Security Controller M7892 B11 with op...</td>\n",
       "      <td>active</td>\n",
       "      <td>ICs, Smart Cards and Smart Card-Related Device...</td>\n",
       "      <td>Infineon Technologies AG</td>\n",
       "      <td>DE</td>\n",
       "      <td>[ALC_FLR.1, EAL6+]</td>\n",
       "      <td>2020-11-26</td>\n",
       "      <td>2025-11-26</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>{BSI-DSZ-CC-0782-V4-2018}</td>\n",
       "      <td>{BSI-DSZ-CC-0782-2012, BSI-DSZ-CC-0782-V2, BSI...</td>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>EAL6+</td>\n",
       "      <td>{'EAL6+': 1}</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>424f6d496746258b</th>\n",
       "      <td>BSI-DSZ-CC-1064-2020</td>\n",
       "      <td>MTCOS Pro 2.5 EAC with PACE / ST31G480 D01</td>\n",
       "      <td>active</td>\n",
       "      <td>ICs, Smart Cards and Smart Card-Related Device...</td>\n",
       "      <td>MaskTech International GmbH</td>\n",
       "      <td>DE</td>\n",
       "      <td>[ALC_DVS.2, AVA_VAN.5, EAL5+]</td>\n",
       "      <td>2020-09-29</td>\n",
       "      <td>2025-09-29</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>[BSI-DSZ-CC-1065-2020]</td>\n",
       "      <td>{BSI-DSZ-CC-1065-2020}</td>\n",
       "      <td>{ANSSI-CC-2019/12, BSI-DSZ-CC-0995-2018}</td>\n",
       "      <td>{BSI-DSZ-CC-0973-2016, ANSSI-CC-2019/12, BSI-D...</td>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>EAL5+</td>\n",
       "      <td>{'EAL5+': 2}</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>b8437dbfeeaf0f04</th>\n",
       "      <td>BSI-DSZ-CC-1065-2020</td>\n",
       "      <td>MTCOS Pro 2.5 EAC with PACE / ST31G480 D01 (BAC)</td>\n",
       "      <td>active</td>\n",
       "      <td>ICs, Smart Cards and Smart Card-Related Device...</td>\n",
       "      <td>MaskTech International GmbH</td>\n",
       "      <td>DE</td>\n",
       "      <td>[ALC_DVS.2, EAL4+]</td>\n",
       "      <td>2020-09-29</td>\n",
       "      <td>2025-09-29</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>{ANSSI-CC-2019/12, BSI-DSZ-CC-1064-2020}</td>\n",
       "      <td>{BSI-DSZ-CC-0973-2016, ANSSI-CC-2019/12, BSI-D...</td>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>EAL4+</td>\n",
       "      <td>{'EAL5+': 2}</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>90c290ed4ded479d</th>\n",
       "      <td>BSI-DSZ-CC-0961-V5-2020</td>\n",
       "      <td>Infineon smart card IC (Security Controller) I...</td>\n",
       "      <td>active</td>\n",
       "      <td>ICs, Smart Cards and Smart Card-Related Device...</td>\n",
       "      <td>Infineon Technologies AG</td>\n",
       "      <td>DE</td>\n",
       "      <td>[ALC_FLR.1, EAL6+]</td>\n",
       "      <td>2020-09-02</td>\n",
       "      <td>2025-09-02</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>{BSI-DSZ-CC-0961-V4-2019}</td>\n",
       "      <td>{BSI-DSZ-CC-0961-V4-2019, BSI-DSZ-CC-0891-2015...</td>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>EAL6+</td>\n",
       "      <td>{'EAL6+': 1}</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>05a8a84b60a30ceb</th>\n",
       "      <td>BSI-DSZ-CC-1076-2020</td>\n",
       "      <td>STARCOS 3.7 ID eAT BAC C1, STARCOS 3.7 ID ePas...</td>\n",
       "      <td>active</td>\n",
       "      <td>ICs, Smart Cards and Smart Card-Related Device...</td>\n",
       "      <td>G+D Mobile Security GmbH</td>\n",
       "      <td>DE</td>\n",
       "      <td>[ALC_DVS.2, EAL4+]</td>\n",
       "      <td>2020-08-18</td>\n",
       "      <td>2025-08-18</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>{BSI-DSZ-CC-1110-V3-2020}</td>\n",
       "      <td>{BSI-DSZ-CC-1110-V3-2020}</td>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>EAL4+</td>\n",
       "      <td>{'EAL5+': 1}</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>598b6c745cdcd404</th>\n",
       "      <td>BSI-DSZ-CC-1077-2020</td>\n",
       "      <td>STARCOS 3.7 ID ePA C1, STARCOS 3.7 ID eAT C1, ...</td>\n",
       "      <td>active</td>\n",
       "      <td>ICs, Smart Cards and Smart Card-Related Device...</td>\n",
       "      <td>G+D Mobile Security GmbH</td>\n",
       "      <td>DE</td>\n",
       "      <td>[ALC_DVS.2, ATE_DPT.2, AVA_VAN.5, EAL4+]</td>\n",
       "      <td>2020-08-05</td>\n",
       "      <td>2025-08-05</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>{BSI-DSZ-CC-1110-V3-2020}</td>\n",
       "      <td>{BSI-DSZ-CC-1110-V3-2020}</td>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>EAL4+</td>\n",
       "      <td>{'EAL5+': 1}</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>96d69242a699323d</th>\n",
       "      <td>BSI-DSZ-CC-1098-2020</td>\n",
       "      <td>IDEMIA_HC_Germany_NEO_G2.1_COS, V1</td>\n",
       "      <td>active</td>\n",
       "      <td>ICs, Smart Cards and Smart Card-Related Device...</td>\n",
       "      <td>IDEMIA Germany GmbH</td>\n",
       "      <td>DE</td>\n",
       "      <td>[ALC_DVS.2, ATE_DPT.2, AVA_VAN.5, EAL4+]</td>\n",
       "      <td>2020-07-30</td>\n",
       "      <td>2025-07-30</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>{BSI-DSZ-CC-1110-V3-2020}</td>\n",
       "      <td>{BSI-DSZ-CC-1110-V3-2020}</td>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>EAL4+</td>\n",
       "      <td>{'EAL5+': 1}</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4832a44c0df0bad2</th>\n",
       "      <td>BSI-DSZ-CC-1074-V2-2020</td>\n",
       "      <td>Xaica-Alpha PLUS ePassport on MTCOS Pro 2.5 wi...</td>\n",
       "      <td>active</td>\n",
       "      <td>ICs, Smart Cards and Smart Card-Related Device...</td>\n",
       "      <td>MaskTech International GmbH</td>\n",
       "      <td>DE</td>\n",
       "      <td>[ALC_DVS.2, EAL4+]</td>\n",
       "      <td>2020-07-30</td>\n",
       "      <td>2025-07-30</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>{BSI-DSZ-CC-1074-V2, ANSSI-CC-2019/12, BSI-DSZ...</td>\n",
       "      <td>{BSI-DSZ-CC-1073-V2, ANSSI-CC-2019/12, BSI-DSZ...</td>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>EAL4+</td>\n",
       "      <td>{'EAL5+': 1, 'EAL4+': 1}</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7f9eb1b8217d15ad</th>\n",
       "      <td>BSI-DSZ-CC-1073-V2-2020</td>\n",
       "      <td>Xaica-Alpha PLUS ePassport on MTCOS Pro 2.5 wi...</td>\n",
       "      <td>active</td>\n",
       "      <td>ICs, Smart Cards and Smart Card-Related Device...</td>\n",
       "      <td>MaskTech International GmbH</td>\n",
       "      <td>DE</td>\n",
       "      <td>[ALC_DVS.2, AVA_VAN.5, EAL4+]</td>\n",
       "      <td>2020-07-30</td>\n",
       "      <td>2025-07-30</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>{BSI-DSZ-CC-1074-V2, ANSSI-CC-2019/12, BSI-DSZ...</td>\n",
       "      <td>{BSI-DSZ-CC-1073-V2, ANSSI-CC-2019/12, BSI-DSZ...</td>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>EAL4+</td>\n",
       "      <td>{'EAL5+': 1, 'EAL4+': 1}</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>59b026d889aa0309</th>\n",
       "      <td>BSI-DSZ-CC-1025-V3-2020</td>\n",
       "      <td>Infineon smart card IC (Security Controller) I...</td>\n",
       "      <td>active</td>\n",
       "      <td>ICs, Smart Cards and Smart Card-Related Device...</td>\n",
       "      <td>Infineon Technologies AG</td>\n",
       "      <td>DE</td>\n",
       "      <td>[ALC_FLR.1, EAL6+]</td>\n",
       "      <td>2020-07-24</td>\n",
       "      <td>2025-07-24</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>{BSI-DSZ-CC-1025-V2-2019}</td>\n",
       "      <td>{BSI-DSZ-CC-1025-2018, BSI-DSZ-CC-1025-V2-2019}</td>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>EAL6+</td>\n",
       "      <td>{'EAL6+': 1}</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>87286bdc06061018</th>\n",
       "      <td>BSI-DSZ-CC-0827-V8-2020</td>\n",
       "      <td>Infineon Technologies Smart Card IC (Security ...</td>\n",
       "      <td>active</td>\n",
       "      <td>ICs, Smart Cards and Smart Card-Related Device...</td>\n",
       "      <td>Infineon Technologies AG</td>\n",
       "      <td>DE</td>\n",
       "      <td>[ALC_DVS.2, AVA_VAN.5, EAL5+]</td>\n",
       "      <td>2020-07-06</td>\n",
       "      <td>2025-07-06</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>[BSI-DSZ-CC-1158-2020]</td>\n",
       "      <td>{BSI-DSZ-CC-1158-2020}</td>\n",
       "      <td>{BSI-DSZ-CC-0827-V7-2018}</td>\n",
       "      <td>{BSI-DSZ-CC-0827-V6-2017, BSI-DSZ-CC-0827-V3-2...</td>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>EAL5+</td>\n",
       "      <td>{'EAL5+': 1}</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4750f5114dcaa60d</th>\n",
       "      <td>BSI-DSZ-CC-1105-2020</td>\n",
       "      <td>Infineon Security Controller M7892 Design Step...</td>\n",
       "      <td>active</td>\n",
       "      <td>ICs, Smart Cards and Smart Card-Related Device...</td>\n",
       "      <td>Infineon Technologies AG</td>\n",
       "      <td>DE</td>\n",
       "      <td>[ALC_FLR.1, EAL6+]</td>\n",
       "      <td>2020-06-30</td>\n",
       "      <td>2025-06-30</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>{BSI-DSZ-CC-0891-V4-2018}</td>\n",
       "      <td>{BSI-DSZ-CC-0891-V4-2018}</td>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>EAL6+</td>\n",
       "      <td>{}</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>20 rows × 24 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                  cert_id  \\\n",
       "dgst                                        \n",
       "98c1ac41aedcdae2     BSI-DSZ-CC-1142-2020   \n",
       "0eff4063e68d7cd6     BSI-DSZ-CC-0823-2014   \n",
       "e62f50581d828477  BSI-DSZ-CC-0519-V3-2021   \n",
       "6a5cb89e80f86ce9  BSI-DSZ-CC-0977-V3-2021   \n",
       "41fb9717f70d3037  BSI-DSZ-CC-1052-V3-2021   \n",
       "cc533c087f06ad0d     BSI-DSZ-CC-1147-2020   \n",
       "a69ec271f8651d1b     BSI-DSZ-CC-1148-2020   \n",
       "dc45c7a6ef17f8b5     BSI-DSZ-CC-1161-2020   \n",
       "15d68159595eae09  BSI-DSZ-CC-0782-V5-2020   \n",
       "424f6d496746258b     BSI-DSZ-CC-1064-2020   \n",
       "b8437dbfeeaf0f04     BSI-DSZ-CC-1065-2020   \n",
       "90c290ed4ded479d  BSI-DSZ-CC-0961-V5-2020   \n",
       "05a8a84b60a30ceb     BSI-DSZ-CC-1076-2020   \n",
       "598b6c745cdcd404     BSI-DSZ-CC-1077-2020   \n",
       "96d69242a699323d     BSI-DSZ-CC-1098-2020   \n",
       "4832a44c0df0bad2  BSI-DSZ-CC-1074-V2-2020   \n",
       "7f9eb1b8217d15ad  BSI-DSZ-CC-1073-V2-2020   \n",
       "59b026d889aa0309  BSI-DSZ-CC-1025-V3-2020   \n",
       "87286bdc06061018  BSI-DSZ-CC-0827-V8-2020   \n",
       "4750f5114dcaa60d     BSI-DSZ-CC-1105-2020   \n",
       "\n",
       "                                                               name  status  \\\n",
       "dgst                                                                          \n",
       "98c1ac41aedcdae2                                     genuscreen 7.0  active   \n",
       "0eff4063e68d7cd6                                     genuscreen 4.0  active   \n",
       "e62f50581d828477               ORGA 6141 online Version 3.7.2:1.2.0  active   \n",
       "6a5cb89e80f86ce9  NXP Secure Smart Card Controller N7021 VA incl...  active   \n",
       "41fb9717f70d3037                                RISE Konnektor V3.0  active   \n",
       "cc533c087f06ad0d      MTCOS Pro 2.5 EAC with PACE / P71D352 (N7121)  active   \n",
       "a69ec271f8651d1b  MTCOS Pro 2.5 EAC with PACE / P71D352 (N7121) ...  active   \n",
       "dc45c7a6ef17f8b5  Bundesdruckerei Document Application with tamp...  active   \n",
       "15d68159595eae09  Infineon Security Controller M7892 B11 with op...  active   \n",
       "424f6d496746258b         MTCOS Pro 2.5 EAC with PACE / ST31G480 D01  active   \n",
       "b8437dbfeeaf0f04   MTCOS Pro 2.5 EAC with PACE / ST31G480 D01 (BAC)  active   \n",
       "90c290ed4ded479d  Infineon smart card IC (Security Controller) I...  active   \n",
       "05a8a84b60a30ceb  STARCOS 3.7 ID eAT BAC C1, STARCOS 3.7 ID ePas...  active   \n",
       "598b6c745cdcd404  STARCOS 3.7 ID ePA C1, STARCOS 3.7 ID eAT C1, ...  active   \n",
       "96d69242a699323d                 IDEMIA_HC_Germany_NEO_G2.1_COS, V1  active   \n",
       "4832a44c0df0bad2  Xaica-Alpha PLUS ePassport on MTCOS Pro 2.5 wi...  active   \n",
       "7f9eb1b8217d15ad  Xaica-Alpha PLUS ePassport on MTCOS Pro 2.5 wi...  active   \n",
       "59b026d889aa0309  Infineon smart card IC (Security Controller) I...  active   \n",
       "87286bdc06061018  Infineon Technologies Smart Card IC (Security ...  active   \n",
       "4750f5114dcaa60d  Infineon Security Controller M7892 Design Step...  active   \n",
       "\n",
       "                                                           category  \\\n",
       "dgst                                                                  \n",
       "98c1ac41aedcdae2            Boundary Protection Devices and Systems   \n",
       "0eff4063e68d7cd6            Boundary Protection Devices and Systems   \n",
       "e62f50581d828477  ICs, Smart Cards and Smart Card-Related Device...   \n",
       "6a5cb89e80f86ce9  ICs, Smart Cards and Smart Card-Related Device...   \n",
       "41fb9717f70d3037  ICs, Smart Cards and Smart Card-Related Device...   \n",
       "cc533c087f06ad0d  ICs, Smart Cards and Smart Card-Related Device...   \n",
       "a69ec271f8651d1b  ICs, Smart Cards and Smart Card-Related Device...   \n",
       "dc45c7a6ef17f8b5  ICs, Smart Cards and Smart Card-Related Device...   \n",
       "15d68159595eae09  ICs, Smart Cards and Smart Card-Related Device...   \n",
       "424f6d496746258b  ICs, Smart Cards and Smart Card-Related Device...   \n",
       "b8437dbfeeaf0f04  ICs, Smart Cards and Smart Card-Related Device...   \n",
       "90c290ed4ded479d  ICs, Smart Cards and Smart Card-Related Device...   \n",
       "05a8a84b60a30ceb  ICs, Smart Cards and Smart Card-Related Device...   \n",
       "598b6c745cdcd404  ICs, Smart Cards and Smart Card-Related Device...   \n",
       "96d69242a699323d  ICs, Smart Cards and Smart Card-Related Device...   \n",
       "4832a44c0df0bad2  ICs, Smart Cards and Smart Card-Related Device...   \n",
       "7f9eb1b8217d15ad  ICs, Smart Cards and Smart Card-Related Device...   \n",
       "59b026d889aa0309  ICs, Smart Cards and Smart Card-Related Device...   \n",
       "87286bdc06061018  ICs, Smart Cards and Smart Card-Related Device...   \n",
       "4750f5114dcaa60d  ICs, Smart Cards and Smart Card-Related Device...   \n",
       "\n",
       "                                                       manufacturer scheme  \\\n",
       "dgst                                                                         \n",
       "98c1ac41aedcdae2                                         genua GmbH     DE   \n",
       "0eff4063e68d7cd6                                          GeNUA mbH     DE   \n",
       "e62f50581d828477                           Ingenico Healthcare GmbH     DE   \n",
       "6a5cb89e80f86ce9                    NXP Semiconductors Germany GmbH     DE   \n",
       "41fb9717f70d3037  Research Industrial Systems Engineering (RISE)...     DE   \n",
       "cc533c087f06ad0d                        MaskTech International GmbH     DE   \n",
       "a69ec271f8651d1b                        MaskTech International GmbH     DE   \n",
       "dc45c7a6ef17f8b5                               Bundesdruckerei GmbH     DE   \n",
       "15d68159595eae09                           Infineon Technologies AG     DE   \n",
       "424f6d496746258b                        MaskTech International GmbH     DE   \n",
       "b8437dbfeeaf0f04                        MaskTech International GmbH     DE   \n",
       "90c290ed4ded479d                           Infineon Technologies AG     DE   \n",
       "05a8a84b60a30ceb                           G+D Mobile Security GmbH     DE   \n",
       "598b6c745cdcd404                           G+D Mobile Security GmbH     DE   \n",
       "96d69242a699323d                                IDEMIA Germany GmbH     DE   \n",
       "4832a44c0df0bad2                        MaskTech International GmbH     DE   \n",
       "7f9eb1b8217d15ad                        MaskTech International GmbH     DE   \n",
       "59b026d889aa0309                           Infineon Technologies AG     DE   \n",
       "87286bdc06061018                           Infineon Technologies AG     DE   \n",
       "4750f5114dcaa60d                           Infineon Technologies AG     DE   \n",
       "\n",
       "                                                     security_level  \\\n",
       "dgst                                                                  \n",
       "98c1ac41aedcdae2           [ALC_FLR.2, ASE_TSS.2, AVA_VAN.4, EAL4+]   \n",
       "0eff4063e68d7cd6           [ALC_FLR.2, ASE_TSS.2, AVA_VAN.4, EAL4+]   \n",
       "e62f50581d828477  [ADV_FSP.4, ADV_IMP.1, ADV_TDS.3, ALC_TAT.1, A...   \n",
       "6a5cb89e80f86ce9                      [ALC_FLR.1, ASE_TSS.2, EAL6+]   \n",
       "41fb9717f70d3037  [ADV_FSP.4, ADV_INT.1, ADV_TDS.3, ALC_FLR.2, A...   \n",
       "cc533c087f06ad0d                      [ALC_DVS.2, AVA_VAN.5, EAL5+]   \n",
       "a69ec271f8651d1b                                 [ALC_DVS.2, EAL4+]   \n",
       "dc45c7a6ef17f8b5                                             [EAL3]   \n",
       "15d68159595eae09                                 [ALC_FLR.1, EAL6+]   \n",
       "424f6d496746258b                      [ALC_DVS.2, AVA_VAN.5, EAL5+]   \n",
       "b8437dbfeeaf0f04                                 [ALC_DVS.2, EAL4+]   \n",
       "90c290ed4ded479d                                 [ALC_FLR.1, EAL6+]   \n",
       "05a8a84b60a30ceb                                 [ALC_DVS.2, EAL4+]   \n",
       "598b6c745cdcd404           [ALC_DVS.2, ATE_DPT.2, AVA_VAN.5, EAL4+]   \n",
       "96d69242a699323d           [ALC_DVS.2, ATE_DPT.2, AVA_VAN.5, EAL4+]   \n",
       "4832a44c0df0bad2                                 [ALC_DVS.2, EAL4+]   \n",
       "7f9eb1b8217d15ad                      [ALC_DVS.2, AVA_VAN.5, EAL4+]   \n",
       "59b026d889aa0309                                 [ALC_FLR.1, EAL6+]   \n",
       "87286bdc06061018                      [ALC_DVS.2, AVA_VAN.5, EAL5+]   \n",
       "4750f5114dcaa60d                                 [ALC_FLR.1, EAL6+]   \n",
       "\n",
       "                 not_valid_before not_valid_after  \\\n",
       "dgst                                                \n",
       "98c1ac41aedcdae2       2020-08-18      2025-08-17   \n",
       "0eff4063e68d7cd6       2014-10-29             NaT   \n",
       "e62f50581d828477       2021-03-22      2026-03-22   \n",
       "6a5cb89e80f86ce9       2021-02-24      2026-02-24   \n",
       "41fb9717f70d3037       2021-02-22      2026-03-21   \n",
       "cc533c087f06ad0d       2020-12-18      2025-12-18   \n",
       "a69ec271f8651d1b       2020-12-18      2025-12-18   \n",
       "dc45c7a6ef17f8b5       2020-12-11      2025-12-10   \n",
       "15d68159595eae09       2020-11-26      2025-11-26   \n",
       "424f6d496746258b       2020-09-29      2025-09-29   \n",
       "b8437dbfeeaf0f04       2020-09-29      2025-09-29   \n",
       "90c290ed4ded479d       2020-09-02      2025-09-02   \n",
       "05a8a84b60a30ceb       2020-08-18      2025-08-18   \n",
       "598b6c745cdcd404       2020-08-05      2025-08-05   \n",
       "96d69242a699323d       2020-07-30      2025-07-30   \n",
       "4832a44c0df0bad2       2020-07-30      2025-07-30   \n",
       "7f9eb1b8217d15ad       2020-07-30      2025-07-30   \n",
       "59b026d889aa0309       2020-07-24      2025-07-24   \n",
       "87286bdc06061018       2020-07-06      2025-07-06   \n",
       "4750f5114dcaa60d       2020-06-30      2025-06-30   \n",
       "\n",
       "                                                        report_link  ...  \\\n",
       "dgst                                                                 ...   \n",
       "98c1ac41aedcdae2  https://www.commoncriteriaportal.org/files/epf...  ...   \n",
       "0eff4063e68d7cd6  https://www.commoncriteriaportal.org/files/epf...  ...   \n",
       "e62f50581d828477  https://www.commoncriteriaportal.org/files/epf...  ...   \n",
       "6a5cb89e80f86ce9  https://www.commoncriteriaportal.org/files/epf...  ...   \n",
       "41fb9717f70d3037  https://www.commoncriteriaportal.org/files/epf...  ...   \n",
       "cc533c087f06ad0d  https://www.commoncriteriaportal.org/files/epf...  ...   \n",
       "a69ec271f8651d1b  https://www.commoncriteriaportal.org/files/epf...  ...   \n",
       "dc45c7a6ef17f8b5  https://www.commoncriteriaportal.org/files/epf...  ...   \n",
       "15d68159595eae09  https://www.commoncriteriaportal.org/files/epf...  ...   \n",
       "424f6d496746258b  https://www.commoncriteriaportal.org/files/epf...  ...   \n",
       "b8437dbfeeaf0f04  https://www.commoncriteriaportal.org/files/epf...  ...   \n",
       "90c290ed4ded479d  https://www.commoncriteriaportal.org/files/epf...  ...   \n",
       "05a8a84b60a30ceb  https://www.commoncriteriaportal.org/files/epf...  ...   \n",
       "598b6c745cdcd404  https://www.commoncriteriaportal.org/files/epf...  ...   \n",
       "96d69242a699323d  https://www.commoncriteriaportal.org/files/epf...  ...   \n",
       "4832a44c0df0bad2  https://www.commoncriteriaportal.org/files/epf...  ...   \n",
       "7f9eb1b8217d15ad  https://www.commoncriteriaportal.org/files/epf...  ...   \n",
       "59b026d889aa0309  https://www.commoncriteriaportal.org/files/epf...  ...   \n",
       "87286bdc06061018  https://www.commoncriteriaportal.org/files/epf...  ...   \n",
       "4750f5114dcaa60d  https://www.commoncriteriaportal.org/files/epf...  ...   \n",
       "\n",
       "                 verified_cpe_matches related_cves    directly_affected_by  \\\n",
       "dgst                                                                         \n",
       "98c1ac41aedcdae2                  NaN          NaN                     NaN   \n",
       "0eff4063e68d7cd6                  NaN          NaN  [BSI-DSZ-CC-0966-2015]   \n",
       "e62f50581d828477                  NaN          NaN                     NaN   \n",
       "6a5cb89e80f86ce9                  NaN          NaN                     NaN   \n",
       "41fb9717f70d3037                  NaN          NaN                     NaN   \n",
       "cc533c087f06ad0d                  NaN          NaN  [BSI-DSZ-CC-1148-2020]   \n",
       "a69ec271f8651d1b                  NaN          NaN                     NaN   \n",
       "dc45c7a6ef17f8b5                  NaN          NaN                     NaN   \n",
       "15d68159595eae09                  NaN          NaN                     NaN   \n",
       "424f6d496746258b                  NaN          NaN  [BSI-DSZ-CC-1065-2020]   \n",
       "b8437dbfeeaf0f04                  NaN          NaN                     NaN   \n",
       "90c290ed4ded479d                  NaN          NaN                     NaN   \n",
       "05a8a84b60a30ceb                  NaN          NaN                     NaN   \n",
       "598b6c745cdcd404                  NaN          NaN                     NaN   \n",
       "96d69242a699323d                  NaN          NaN                     NaN   \n",
       "4832a44c0df0bad2                  NaN          NaN                     NaN   \n",
       "7f9eb1b8217d15ad                  NaN          NaN                     NaN   \n",
       "59b026d889aa0309                  NaN          NaN                     NaN   \n",
       "87286bdc06061018                  NaN          NaN  [BSI-DSZ-CC-1158-2020]   \n",
       "4750f5114dcaa60d                  NaN          NaN                     NaN   \n",
       "\n",
       "                  indirectly_affected_by  \\\n",
       "dgst                                       \n",
       "98c1ac41aedcdae2                     NaN   \n",
       "0eff4063e68d7cd6  {BSI-DSZ-CC-0966-2015}   \n",
       "e62f50581d828477                     NaN   \n",
       "6a5cb89e80f86ce9                     NaN   \n",
       "41fb9717f70d3037                     NaN   \n",
       "cc533c087f06ad0d  {BSI-DSZ-CC-1148-2020}   \n",
       "a69ec271f8651d1b                     NaN   \n",
       "dc45c7a6ef17f8b5                     NaN   \n",
       "15d68159595eae09                     NaN   \n",
       "424f6d496746258b  {BSI-DSZ-CC-1065-2020}   \n",
       "b8437dbfeeaf0f04                     NaN   \n",
       "90c290ed4ded479d                     NaN   \n",
       "05a8a84b60a30ceb                     NaN   \n",
       "598b6c745cdcd404                     NaN   \n",
       "96d69242a699323d                     NaN   \n",
       "4832a44c0df0bad2                     NaN   \n",
       "7f9eb1b8217d15ad                     NaN   \n",
       "59b026d889aa0309                     NaN   \n",
       "87286bdc06061018  {BSI-DSZ-CC-1158-2020}   \n",
       "4750f5114dcaa60d                     NaN   \n",
       "\n",
       "                                                 directly_affecting  \\\n",
       "dgst                                                                  \n",
       "98c1ac41aedcdae2                             {BSI-DSZ-CC-1085-2019}   \n",
       "0eff4063e68d7cd6                             {BSI-DSZ-CC-0565-2009}   \n",
       "e62f50581d828477                          {BSI-DSZ-CC-0519-V2-2018}   \n",
       "6a5cb89e80f86ce9      {BSI-DSZ-CC-0977-V3, BSI-DSZ-CC-0977-V2-2019}   \n",
       "41fb9717f70d3037      {BSI-DSZ-CC-1052-V2-2020, BSI-DSZ-CC-1052-V3}   \n",
       "cc533c087f06ad0d       {BSI-DSZ-CC-1033-2019, BSI-DSZ-CC-1040-2019}   \n",
       "a69ec271f8651d1b       {BSI-DSZ-CC-1040-2019, BSI-DSZ-CC-1147-2020}   \n",
       "dc45c7a6ef17f8b5                             {BSI-DSZ-CC-1125-2019}   \n",
       "15d68159595eae09                          {BSI-DSZ-CC-0782-V4-2018}   \n",
       "424f6d496746258b           {ANSSI-CC-2019/12, BSI-DSZ-CC-0995-2018}   \n",
       "b8437dbfeeaf0f04           {ANSSI-CC-2019/12, BSI-DSZ-CC-1064-2020}   \n",
       "90c290ed4ded479d                          {BSI-DSZ-CC-0961-V4-2019}   \n",
       "05a8a84b60a30ceb                          {BSI-DSZ-CC-1110-V3-2020}   \n",
       "598b6c745cdcd404                          {BSI-DSZ-CC-1110-V3-2020}   \n",
       "96d69242a699323d                          {BSI-DSZ-CC-1110-V3-2020}   \n",
       "4832a44c0df0bad2  {BSI-DSZ-CC-1074-V2, ANSSI-CC-2019/12, BSI-DSZ...   \n",
       "7f9eb1b8217d15ad  {BSI-DSZ-CC-1074-V2, ANSSI-CC-2019/12, BSI-DSZ...   \n",
       "59b026d889aa0309                          {BSI-DSZ-CC-1025-V2-2019}   \n",
       "87286bdc06061018                          {BSI-DSZ-CC-0827-V7-2018}   \n",
       "4750f5114dcaa60d                          {BSI-DSZ-CC-0891-V4-2018}   \n",
       "\n",
       "                                               indirectly_affecting  \\\n",
       "dgst                                                                  \n",
       "98c1ac41aedcdae2                             {BSI-DSZ-CC-1085-2019}   \n",
       "0eff4063e68d7cd6       {BSI-DSZ-CC-0565-2009, BSI-DSZ-CC-0382-2007}   \n",
       "e62f50581d828477                          {BSI-DSZ-CC-0519-V2-2018}   \n",
       "6a5cb89e80f86ce9  {BSI-DSZ-CC-0977-2017, BSI-DSZ-CC-0977-V3, BSI...   \n",
       "41fb9717f70d3037  {BSI-DSZ-CC-1052-V2-2020, BSI-DSZ-CC-1052-V2, ...   \n",
       "cc533c087f06ad0d  {BSI-DSZ-CC-1034-2019, BSI-DSZ-CC-1040-2019, B...   \n",
       "a69ec271f8651d1b  {BSI-DSZ-CC-1034-2019, BSI-DSZ-CC-1147-2020, B...   \n",
       "dc45c7a6ef17f8b5                             {BSI-DSZ-CC-1125-2019}   \n",
       "15d68159595eae09  {BSI-DSZ-CC-0782-2012, BSI-DSZ-CC-0782-V2, BSI...   \n",
       "424f6d496746258b  {BSI-DSZ-CC-0973-2016, ANSSI-CC-2019/12, BSI-D...   \n",
       "b8437dbfeeaf0f04  {BSI-DSZ-CC-0973-2016, ANSSI-CC-2019/12, BSI-D...   \n",
       "90c290ed4ded479d  {BSI-DSZ-CC-0961-V4-2019, BSI-DSZ-CC-0891-2015...   \n",
       "05a8a84b60a30ceb                          {BSI-DSZ-CC-1110-V3-2020}   \n",
       "598b6c745cdcd404                          {BSI-DSZ-CC-1110-V3-2020}   \n",
       "96d69242a699323d                          {BSI-DSZ-CC-1110-V3-2020}   \n",
       "4832a44c0df0bad2  {BSI-DSZ-CC-1073-V2, ANSSI-CC-2019/12, BSI-DSZ...   \n",
       "7f9eb1b8217d15ad  {BSI-DSZ-CC-1073-V2, ANSSI-CC-2019/12, BSI-DSZ...   \n",
       "59b026d889aa0309    {BSI-DSZ-CC-1025-2018, BSI-DSZ-CC-1025-V2-2019}   \n",
       "87286bdc06061018  {BSI-DSZ-CC-0827-V6-2017, BSI-DSZ-CC-0827-V3-2...   \n",
       "4750f5114dcaa60d                          {BSI-DSZ-CC-0891-V4-2018}   \n",
       "\n",
       "                 is_bsi_cert is_anssi_cert highest_security_level  \\\n",
       "dgst                                                                \n",
       "98c1ac41aedcdae2        True         False                  EAL4+   \n",
       "0eff4063e68d7cd6        True         False                  EAL4+   \n",
       "e62f50581d828477        True         False                  EAL3+   \n",
       "6a5cb89e80f86ce9        True         False                  EAL6+   \n",
       "41fb9717f70d3037        True         False                  EAL3+   \n",
       "cc533c087f06ad0d        True         False                  EAL5+   \n",
       "a69ec271f8651d1b        True         False                  EAL4+   \n",
       "dc45c7a6ef17f8b5        True         False                   EAL3   \n",
       "15d68159595eae09        True         False                  EAL6+   \n",
       "424f6d496746258b        True         False                  EAL5+   \n",
       "b8437dbfeeaf0f04        True         False                  EAL4+   \n",
       "90c290ed4ded479d        True         False                  EAL6+   \n",
       "05a8a84b60a30ceb        True         False                  EAL4+   \n",
       "598b6c745cdcd404        True         False                  EAL4+   \n",
       "96d69242a699323d        True         False                  EAL4+   \n",
       "4832a44c0df0bad2        True         False                  EAL4+   \n",
       "7f9eb1b8217d15ad        True         False                  EAL4+   \n",
       "59b026d889aa0309        True         False                  EAL6+   \n",
       "87286bdc06061018        True         False                  EAL5+   \n",
       "4750f5114dcaa60d        True         False                  EAL6+   \n",
       "\n",
       "                 affecting_security_levels  \n",
       "dgst                                        \n",
       "98c1ac41aedcdae2                        {}  \n",
       "0eff4063e68d7cd6              {'EAL4+': 1}  \n",
       "e62f50581d828477                        {}  \n",
       "6a5cb89e80f86ce9              {'EAL6+': 1}  \n",
       "41fb9717f70d3037               {'EAL3': 1}  \n",
       "cc533c087f06ad0d  {'EAL5+': 1, 'EAL6+': 1}  \n",
       "a69ec271f8651d1b  {'EAL6+': 1, 'EAL5+': 1}  \n",
       "dc45c7a6ef17f8b5               {'EAL3': 1}  \n",
       "15d68159595eae09              {'EAL6+': 1}  \n",
       "424f6d496746258b              {'EAL5+': 2}  \n",
       "b8437dbfeeaf0f04              {'EAL5+': 2}  \n",
       "90c290ed4ded479d              {'EAL6+': 1}  \n",
       "05a8a84b60a30ceb              {'EAL5+': 1}  \n",
       "598b6c745cdcd404              {'EAL5+': 1}  \n",
       "96d69242a699323d              {'EAL5+': 1}  \n",
       "4832a44c0df0bad2  {'EAL5+': 1, 'EAL4+': 1}  \n",
       "7f9eb1b8217d15ad  {'EAL5+': 1, 'EAL4+': 1}  \n",
       "59b026d889aa0309              {'EAL6+': 1}  \n",
       "87286bdc06061018              {'EAL5+': 1}  \n",
       "4750f5114dcaa60d                        {}  \n",
       "\n",
       "[20 rows x 24 columns]"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from typing import Dict\n",
    "\n",
    "def get_cert_id_security_level(cert_id: str) -> str:\n",
    "    cert_id_df = df[df[\"cert_id\"] == cert_id]\n",
    "    \n",
    "    if cert_id_df.empty:  # we do not have record in main dset for this cert_id\n",
    "        return None\n",
    "    \n",
    "    return cert_id_df.iloc[0][\"highest_security_level\"]\n",
    "\n",
    "\n",
    "def get_levels_of_affected_certs(affected_certs: Set[str]) -> Dict[str, int]:\n",
    "    result = {}\n",
    "    \n",
    "    for affected_cert_id in affected_certs:\n",
    "        security_level = get_cert_id_security_level(affected_cert_id)\n",
    "        \n",
    "        if security_level is None:  # cert_id does not follow condition for levels_df\n",
    "            continue\n",
    "            \n",
    "        result[security_level] = result.get(security_level, 0) + 1\n",
    "        \n",
    "    return result\n",
    "        \n",
    "\n",
    "levels_df[\"affecting_security_levels\"] = levels_df[\"directly_affecting\"].apply(get_levels_of_affected_certs)\n",
    "levels_df.head(20)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "id": "79b1d0da",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Certs with security level EAL1 are directly affecting other certificates with levels: {'EAL4+': 1}\n",
      "Certs with security level EAL1+ are directly affecting other certificates with levels: {}\n",
      "Certs with security level EAL2 are directly affecting other certificates with levels: {'EAL2': 4, 'EAL4+': 1}\n",
      "Certs with security level EAL2+ are directly affecting other certificates with levels: {'EAL2+': 8}\n",
      "Certs with security level EAL3 are directly affecting other certificates with levels: {'EAL3': 8, 'EAL5+': 1}\n",
      "Certs with security level EAL3+ are directly affecting other certificates with levels: {'EAL3': 1, 'EAL3+': 14}\n",
      "Certs with security level EAL4 are directly affecting other certificates with levels: {'EAL5+': 1, 'EAL4+': 5, 'EAL4': 3, 'EAL6+': 1}\n",
      "Certs with security level EAL4+ are directly affecting other certificates with levels: {'EAL4+': 274, 'EAL6+': 41, 'EAL5+': 238, 'EAL4': 2, 'EAL3+': 3}\n",
      "Certs with security level EAL5 are directly affecting other certificates with levels: {'EAL5+': 1, 'EAL5': 3, 'EAL4+': 1}\n",
      "Certs with security level EAL5+ are directly affecting other certificates with levels: {'EAL5+': 187, 'EAL6+': 34, 'EAL4+': 44}\n",
      "Certs with security level EAL6+ are directly affecting other certificates with levels: {'EAL6+': 38, 'EAL5+': 6, 'EAL4+': 5}\n",
      "Certs with security level EAL7 are directly affecting other certificates with levels: {}\n",
      "Certs with security level EAL7+ are directly affecting other certificates with levels: {}\n"
     ]
    }
   ],
   "source": [
    "result = {}\n",
    "\n",
    "for security_level in eals:\n",
    "    security_level_list = []\n",
    "    counter = collections.Counter()\n",
    "    security_level_df = levels_df[levels_df[\"highest_security_level\"] == security_level][\"affecting_security_levels\"]\n",
    "    \n",
    "    for security_dict in security_level_df:\n",
    "        counter.update(security_dict)\n",
    "                \n",
    "    print(f\"Certs with security level {security_level} are directly affecting other certificates with levels: {dict(counter)}\")\n",
    "        \n",
    "    result[security_level] = counter"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "id": "e3701a93",
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Text(0.5, 21.5, 'Security levels affected by specific security level')"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 32076 characters]",
      "text/plain": [
       "<Figure size 720x360 with 2 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.figure(figsize=(10,5))\n",
    "plt.rcParams.update({'font.size': 20})\n",
    "heatmap_result = []\n",
    "\n",
    "\n",
    "for security_level, counter in result.items():\n",
    "    security_level_list = []\n",
    "    for security_level_key in eals:\n",
    "        security_level_list.append(counter.get(security_level_key, 0))\n",
    "    \n",
    "    heatmap_result.append(security_level_list)\n",
    "    \n",
    "sns.set(style=\"whitegrid\")\n",
    "ax = sns.heatmap(heatmap_result, xticklabels=eals, yticklabels=eals,cmap=\"Greens\").set_title(\"Archived certs vs. active certs\")\n",
    "plt.ylabel(\"Specific security level\")\n",
    "plt.xlabel(\"Security levels affected by specific security level\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "6403ed38",
   "metadata": {},
   "source": [
    "### Basic Analysis of most common category"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "id": "ab4ed23d",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "There are total 1488 rows ICs, Smart Cards and Smart Card-Related Devices and Systems category.\n"
     ]
    }
   ],
   "source": [
    "cards_df = df[df[\"category\"] == \"ICs, Smart Cards and Smart Card-Related Devices and Systems\"]\n",
    "print(f\"There are total {cards_df.shape[0]} rows ICs, Smart Cards and Smart Card-Related Devices and Systems category.\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "39cfb0e3",
   "metadata": {},
   "source": [
    "#### How many certificates are active/archived"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "id": "cc6bb09a",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "There are total 924 archived records among smart-cards\n",
      "There are total 564 active records among smart-cards\n"
     ]
    }
   ],
   "source": [
    "total_archived_certs = sum(cards_df[\"status\"] == \"archived\")\n",
    "total_active_certs = sum(cards_df[\"status\"] == \"active\")\n",
    "\n",
    "print(f\"There are total {total_archived_certs} archived records among smart-cards\")\n",
    "print(f\"There are total {total_active_certs} active records among smart-cards\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "72f3db18",
   "metadata": {},
   "source": [
    "#### Which manufacturer is the most common in this category?"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "id": "1982c2a3",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The most common manufacturer in smart cards category is: Infineon Technologies AG\n"
     ]
    }
   ],
   "source": [
    "most_common_smart_card_manufacturer = cards_df[\"manufacturer\"].value_counts().index[0]\n",
    "print(f\"The most common manufacturer in smart cards category is: {most_common_smart_card_manufacturer}\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "22cd65ee",
   "metadata": {},
   "source": [
    "#### Analysis of security levels of smart-cards"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "id": "d47c6bd5",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Most common security level among smart-cards is EAL5+ with 671 occurences.\n"
     ]
    }
   ],
   "source": [
    "# The most common security level among smart-cards\n",
    "most_common_sec_level = cards_df[\"highest_security_level\"].value_counts().index[0]\n",
    "sec_level_amount = cards_df[\"highest_security_level\"].value_counts()[0]\n",
    "\n",
    "print(f\"Most common security level among smart-cards is {most_common_sec_level} with {sec_level_amount} occurences.\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "id": "581fc32b",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Lowest security level among smart cards in dataset: EAL1+\n"
     ]
    }
   ],
   "source": [
    "# The lowest common security level achieved in dataset\n",
    "security_level_occurences = cards_df[\"highest_security_level\"].value_counts()\n",
    "filtered_sec_levels = [sec_level for sec_level, count in security_level_occurences.items() if count > 0]\n",
    "level_numbers = {x: y for x, y in zip(eals, range(len(eals)))}\n",
    "\n",
    "lowest_smart_card_security_level = None\n",
    "lowest_security_level_int = None\n",
    "\n",
    "for sec_level in filtered_sec_levels:\n",
    "    if lowest_security_level_int is None:\n",
    "        lowest_security_level_int = level_numbers[sec_level]\n",
    "        lowest_smart_card_security_level = sec_level\n",
    "    \n",
    "    if level_numbers[sec_level] < lowest_security_level_int:\n",
    "        lowest_security_level_int = level_numbers[sec_level]\n",
    "        lowest_smart_card_security_level = sec_level\n",
    "        \n",
    "print(f\"Lowest security level among smart cards in dataset: {lowest_smart_card_security_level}\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "id": "022402ff",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Highest security level among smart cards in dataset: EAL7\n"
     ]
    }
   ],
   "source": [
    "# The highest common security level in smart-card dataset\n",
    "highest_smart_card_security_level = None\n",
    "highest_security_level_int = None\n",
    "\n",
    "for sec_level in filtered_sec_levels:\n",
    "    if highest_security_level_int is None:\n",
    "        highest_security_level_int = level_numbers[sec_level]\n",
    "        highest_smart_card_security_level = sec_level\n",
    "    \n",
    "    if level_numbers[sec_level] > highest_security_level_int:\n",
    "        highest_security_level_int = level_numbers[sec_level]\n",
    "        highest_smart_card_security_level = sec_level\n",
    "        \n",
    "print(f\"Highest security level among smart cards in dataset: {highest_smart_card_security_level}\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "7d91f895",
   "metadata": {},
   "source": [
    "#### View data with lowest security level (EAL1+)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "id": "2d6a8849",
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>cert_id</th>\n",
       "      <th>name</th>\n",
       "      <th>status</th>\n",
       "      <th>category</th>\n",
       "      <th>manufacturer</th>\n",
       "      <th>scheme</th>\n",
       "      <th>security_level</th>\n",
       "      <th>not_valid_before</th>\n",
       "      <th>not_valid_after</th>\n",
       "      <th>report_link</th>\n",
       "      <th>...</th>\n",
       "      <th>cpe_matches</th>\n",
       "      <th>verified_cpe_matches</th>\n",
       "      <th>related_cves</th>\n",
       "      <th>directly_affected_by</th>\n",
       "      <th>indirectly_affected_by</th>\n",
       "      <th>directly_affecting</th>\n",
       "      <th>indirectly_affecting</th>\n",
       "      <th>is_bsi_cert</th>\n",
       "      <th>is_anssi_cert</th>\n",
       "      <th>highest_security_level</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dgst</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>be0806db6fd6bbe8</th>\n",
       "      <td>NaN</td>\n",
       "      <td>ATMEL AT90SC6464C Integrated circuit (referenc...</td>\n",
       "      <td>archived</td>\n",
       "      <td>ICs, Smart Cards and Smart Card-Related Device...</td>\n",
       "      <td>ATMEL Smart Card ICs</td>\n",
       "      <td>FR</td>\n",
       "      <td>[AVA_VLA.2, EAL1+]</td>\n",
       "      <td>2001-01-01</td>\n",
       "      <td>2019-09-01</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>EAL1+</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1a95d138ccc7814a</th>\n",
       "      <td>Rapport de certification 2001/16</td>\n",
       "      <td>CT2000 embedded Component (reference ST16RFHD5...</td>\n",
       "      <td>archived</td>\n",
       "      <td>ICs, Smart Cards and Smart Card-Related Device...</td>\n",
       "      <td>ASK</td>\n",
       "      <td>FR</td>\n",
       "      <td>[AVA_VLA.2, EAL1+]</td>\n",
       "      <td>2001-01-01</td>\n",
       "      <td>2019-09-01</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>EAL1+</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35ac4cfd1f62df75</th>\n",
       "      <td>NaN</td>\n",
       "      <td>M/Chip Select v2.0.5.2 Application</td>\n",
       "      <td>archived</td>\n",
       "      <td>ICs, Smart Cards and Smart Card-Related Device...</td>\n",
       "      <td>Mondex International Ltd</td>\n",
       "      <td>FR</td>\n",
       "      <td>[AVA_VLA.2, EAL1+]</td>\n",
       "      <td>2001-01-01</td>\n",
       "      <td>2019-09-01</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>EAL1+</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7c062b969e50e2af</th>\n",
       "      <td>Rapport de certification 2001/20</td>\n",
       "      <td>MODEUS electronic purse : MODEUS carrier card ...</td>\n",
       "      <td>archived</td>\n",
       "      <td>ICs, Smart Cards and Smart Card-Related Device...</td>\n",
       "      <td>ASK, CP8, STMicroelectronics</td>\n",
       "      <td>FR</td>\n",
       "      <td>[AVA_VLA.2, EAL1+]</td>\n",
       "      <td>2001-01-01</td>\n",
       "      <td>2019-09-01</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>EAL1+</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>f66157c81ab85729</th>\n",
       "      <td>Rapport de certification 2001/03</td>\n",
       "      <td>Oberthur B0' application v1.0.1 and GemClub v1...</td>\n",
       "      <td>archived</td>\n",
       "      <td>ICs, Smart Cards and Smart Card-Related Device...</td>\n",
       "      <td>Oberthur Card Systems, Gemplus, Trusted Logic</td>\n",
       "      <td>FR</td>\n",
       "      <td>[AVA_VLA.2, EAL1+]</td>\n",
       "      <td>2001-01-01</td>\n",
       "      <td>2019-09-01</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>EAL1+</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 23 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                           cert_id  \\\n",
       "dgst                                                 \n",
       "be0806db6fd6bbe8                               NaN   \n",
       "1a95d138ccc7814a  Rapport de certification 2001/16   \n",
       "35ac4cfd1f62df75                               NaN   \n",
       "7c062b969e50e2af  Rapport de certification 2001/20   \n",
       "f66157c81ab85729  Rapport de certification 2001/03   \n",
       "\n",
       "                                                               name    status  \\\n",
       "dgst                                                                            \n",
       "be0806db6fd6bbe8  ATMEL AT90SC6464C Integrated circuit (referenc...  archived   \n",
       "1a95d138ccc7814a  CT2000 embedded Component (reference ST16RFHD5...  archived   \n",
       "35ac4cfd1f62df75                 M/Chip Select v2.0.5.2 Application  archived   \n",
       "7c062b969e50e2af  MODEUS electronic purse : MODEUS carrier card ...  archived   \n",
       "f66157c81ab85729  Oberthur B0' application v1.0.1 and GemClub v1...  archived   \n",
       "\n",
       "                                                           category  \\\n",
       "dgst                                                                  \n",
       "be0806db6fd6bbe8  ICs, Smart Cards and Smart Card-Related Device...   \n",
       "1a95d138ccc7814a  ICs, Smart Cards and Smart Card-Related Device...   \n",
       "35ac4cfd1f62df75  ICs, Smart Cards and Smart Card-Related Device...   \n",
       "7c062b969e50e2af  ICs, Smart Cards and Smart Card-Related Device...   \n",
       "f66157c81ab85729  ICs, Smart Cards and Smart Card-Related Device...   \n",
       "\n",
       "                                                   manufacturer scheme  \\\n",
       "dgst                                                                     \n",
       "be0806db6fd6bbe8                           ATMEL Smart Card ICs     FR   \n",
       "1a95d138ccc7814a                                            ASK     FR   \n",
       "35ac4cfd1f62df75                       Mondex International Ltd     FR   \n",
       "7c062b969e50e2af                   ASK, CP8, STMicroelectronics     FR   \n",
       "f66157c81ab85729  Oberthur Card Systems, Gemplus, Trusted Logic     FR   \n",
       "\n",
       "                      security_level not_valid_before not_valid_after  \\\n",
       "dgst                                                                    \n",
       "be0806db6fd6bbe8  [AVA_VLA.2, EAL1+]       2001-01-01      2019-09-01   \n",
       "1a95d138ccc7814a  [AVA_VLA.2, EAL1+]       2001-01-01      2019-09-01   \n",
       "35ac4cfd1f62df75  [AVA_VLA.2, EAL1+]       2001-01-01      2019-09-01   \n",
       "7c062b969e50e2af  [AVA_VLA.2, EAL1+]       2001-01-01      2019-09-01   \n",
       "f66157c81ab85729  [AVA_VLA.2, EAL1+]       2001-01-01      2019-09-01   \n",
       "\n",
       "                                                        report_link  ...  \\\n",
       "dgst                                                                 ...   \n",
       "be0806db6fd6bbe8  https://www.commoncriteriaportal.org/files/epf...  ...   \n",
       "1a95d138ccc7814a  https://www.commoncriteriaportal.org/files/epf...  ...   \n",
       "35ac4cfd1f62df75  https://www.commoncriteriaportal.org/files/epf...  ...   \n",
       "7c062b969e50e2af  https://www.commoncriteriaportal.org/files/epf...  ...   \n",
       "f66157c81ab85729  https://www.commoncriteriaportal.org/files/epf...  ...   \n",
       "\n",
       "                 cpe_matches verified_cpe_matches related_cves  \\\n",
       "dgst                                                             \n",
       "be0806db6fd6bbe8         NaN                  NaN          NaN   \n",
       "1a95d138ccc7814a         NaN                  NaN          NaN   \n",
       "35ac4cfd1f62df75         NaN                  NaN          NaN   \n",
       "7c062b969e50e2af         NaN                  NaN          NaN   \n",
       "f66157c81ab85729         NaN                  NaN          NaN   \n",
       "\n",
       "                 directly_affected_by indirectly_affected_by  \\\n",
       "dgst                                                           \n",
       "be0806db6fd6bbe8                  NaN                    NaN   \n",
       "1a95d138ccc7814a                  NaN                    NaN   \n",
       "35ac4cfd1f62df75                  NaN                    NaN   \n",
       "7c062b969e50e2af                  NaN                    NaN   \n",
       "f66157c81ab85729                  NaN                    NaN   \n",
       "\n",
       "                 directly_affecting indirectly_affecting is_bsi_cert  \\\n",
       "dgst                                                                   \n",
       "be0806db6fd6bbe8                NaN                  NaN       False   \n",
       "1a95d138ccc7814a                NaN                  NaN       False   \n",
       "35ac4cfd1f62df75                NaN                  NaN       False   \n",
       "7c062b969e50e2af                NaN                  NaN       False   \n",
       "f66157c81ab85729                NaN                  NaN       False   \n",
       "\n",
       "                 is_anssi_cert highest_security_level  \n",
       "dgst                                                   \n",
       "be0806db6fd6bbe8         False                  EAL1+  \n",
       "1a95d138ccc7814a         False                  EAL1+  \n",
       "35ac4cfd1f62df75         False                  EAL1+  \n",
       "7c062b969e50e2af         False                  EAL1+  \n",
       "f66157c81ab85729         False                  EAL1+  \n",
       "\n",
       "[5 rows x 23 columns]"
      ]
     },
     "execution_count": 36,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "eal1_plus_df = cards_df[cards_df[\"highest_security_level\"] == \"EAL1+\"]\n",
    "eal1_plus_df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "id": "04ac7242",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "FR    14\n",
       "US     0\n",
       "JP     0\n",
       "CA     0\n",
       "DE     0\n",
       "ES     0\n",
       "IN     0\n",
       "IT     0\n",
       "KR     0\n",
       "UK     0\n",
       "MY     0\n",
       "NL     0\n",
       "NO     0\n",
       "SE     0\n",
       "SG     0\n",
       "TR     0\n",
       "AU     0\n",
       "Name: scheme, dtype: int64"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "eal1_plus_df[\"scheme\"].value_counts()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1d580c0d",
   "metadata": {},
   "source": [
    "#### View data with highest security level (EAL7)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "id": "5030f8eb",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>cert_id</th>\n",
       "      <th>name</th>\n",
       "      <th>status</th>\n",
       "      <th>category</th>\n",
       "      <th>manufacturer</th>\n",
       "      <th>scheme</th>\n",
       "      <th>security_level</th>\n",
       "      <th>not_valid_before</th>\n",
       "      <th>not_valid_after</th>\n",
       "      <th>report_link</th>\n",
       "      <th>...</th>\n",
       "      <th>cpe_matches</th>\n",
       "      <th>verified_cpe_matches</th>\n",
       "      <th>related_cves</th>\n",
       "      <th>directly_affected_by</th>\n",
       "      <th>indirectly_affected_by</th>\n",
       "      <th>directly_affecting</th>\n",
       "      <th>indirectly_affecting</th>\n",
       "      <th>is_bsi_cert</th>\n",
       "      <th>is_anssi_cert</th>\n",
       "      <th>highest_security_level</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dgst</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>8ee7145a1b48b578</th>\n",
       "      <td>ANSSI-CC-2020/33</td>\n",
       "      <td>MultiApp V4 JavaCard Virtual Machine</td>\n",
       "      <td>active</td>\n",
       "      <td>ICs, Smart Cards and Smart Card-Related Device...</td>\n",
       "      <td>Gemalto</td>\n",
       "      <td>FR</td>\n",
       "      <td>[EAL7]</td>\n",
       "      <td>2020-05-28</td>\n",
       "      <td>2025-05-28</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>False</td>\n",
       "      <td>True</td>\n",
       "      <td>EAL7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>d08b5ddedd34448d</th>\n",
       "      <td>ANSSI-CC-2018/50</td>\n",
       "      <td>IDMotion V2 Multos Virtual Machine OS Multos V...</td>\n",
       "      <td>active</td>\n",
       "      <td>ICs, Smart Cards and Smart Card-Related Device...</td>\n",
       "      <td>Gemalto / Trusted Labs</td>\n",
       "      <td>FR</td>\n",
       "      <td>[EAL7]</td>\n",
       "      <td>2018-12-14</td>\n",
       "      <td>2023-12-14</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>False</td>\n",
       "      <td>True</td>\n",
       "      <td>EAL7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>ff45605151ec4eb1</th>\n",
       "      <td>ANSSI-CC-2013/40</td>\n",
       "      <td>Virtual Machine of Multos M3 G230M mask with A...</td>\n",
       "      <td>archived</td>\n",
       "      <td>ICs, Smart Cards and Smart Card-Related Device...</td>\n",
       "      <td>Multos international / Trusted Labs</td>\n",
       "      <td>FR</td>\n",
       "      <td>[EAL7]</td>\n",
       "      <td>2013-07-04</td>\n",
       "      <td>2019-09-01</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>False</td>\n",
       "      <td>True</td>\n",
       "      <td>EAL7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9231adbf747903df</th>\n",
       "      <td>ANSSI-CC-2013/12</td>\n",
       "      <td>Memory Management Unit des microcontrôleurs SA...</td>\n",
       "      <td>archived</td>\n",
       "      <td>ICs, Smart Cards and Smart Card-Related Device...</td>\n",
       "      <td>Samsung Electronics Co., Ltd. / Trusted Labs</td>\n",
       "      <td>FR</td>\n",
       "      <td>[EAL7]</td>\n",
       "      <td>2013-03-29</td>\n",
       "      <td>2019-09-01</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>False</td>\n",
       "      <td>True</td>\n",
       "      <td>EAL7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>890f788a91fc2fa1</th>\n",
       "      <td>ANSSI-CC-2013/11</td>\n",
       "      <td>Virtual Machine of ID Motion V1 G231 mask with...</td>\n",
       "      <td>archived</td>\n",
       "      <td>ICs, Smart Cards and Smart Card-Related Device...</td>\n",
       "      <td>Gemalto / Trusted Labs</td>\n",
       "      <td>FR</td>\n",
       "      <td>[EAL7]</td>\n",
       "      <td>2013-03-29</td>\n",
       "      <td>2019-09-01</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>False</td>\n",
       "      <td>True</td>\n",
       "      <td>EAL7</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 23 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                           cert_id  \\\n",
       "dgst                                 \n",
       "8ee7145a1b48b578  ANSSI-CC-2020/33   \n",
       "d08b5ddedd34448d  ANSSI-CC-2018/50   \n",
       "ff45605151ec4eb1  ANSSI-CC-2013/40   \n",
       "9231adbf747903df  ANSSI-CC-2013/12   \n",
       "890f788a91fc2fa1  ANSSI-CC-2013/11   \n",
       "\n",
       "                                                               name    status  \\\n",
       "dgst                                                                            \n",
       "8ee7145a1b48b578               MultiApp V4 JavaCard Virtual Machine    active   \n",
       "d08b5ddedd34448d  IDMotion V2 Multos Virtual Machine OS Multos V...    active   \n",
       "ff45605151ec4eb1  Virtual Machine of Multos M3 G230M mask with A...  archived   \n",
       "9231adbf747903df  Memory Management Unit des microcontrôleurs SA...  archived   \n",
       "890f788a91fc2fa1  Virtual Machine of ID Motion V1 G231 mask with...  archived   \n",
       "\n",
       "                                                           category  \\\n",
       "dgst                                                                  \n",
       "8ee7145a1b48b578  ICs, Smart Cards and Smart Card-Related Device...   \n",
       "d08b5ddedd34448d  ICs, Smart Cards and Smart Card-Related Device...   \n",
       "ff45605151ec4eb1  ICs, Smart Cards and Smart Card-Related Device...   \n",
       "9231adbf747903df  ICs, Smart Cards and Smart Card-Related Device...   \n",
       "890f788a91fc2fa1  ICs, Smart Cards and Smart Card-Related Device...   \n",
       "\n",
       "                                                  manufacturer scheme  \\\n",
       "dgst                                                                    \n",
       "8ee7145a1b48b578                                       Gemalto     FR   \n",
       "d08b5ddedd34448d                        Gemalto / Trusted Labs     FR   \n",
       "ff45605151ec4eb1           Multos international / Trusted Labs     FR   \n",
       "9231adbf747903df  Samsung Electronics Co., Ltd. / Trusted Labs     FR   \n",
       "890f788a91fc2fa1                        Gemalto / Trusted Labs     FR   \n",
       "\n",
       "                 security_level not_valid_before not_valid_after  \\\n",
       "dgst                                                               \n",
       "8ee7145a1b48b578         [EAL7]       2020-05-28      2025-05-28   \n",
       "d08b5ddedd34448d         [EAL7]       2018-12-14      2023-12-14   \n",
       "ff45605151ec4eb1         [EAL7]       2013-07-04      2019-09-01   \n",
       "9231adbf747903df         [EAL7]       2013-03-29      2019-09-01   \n",
       "890f788a91fc2fa1         [EAL7]       2013-03-29      2019-09-01   \n",
       "\n",
       "                                                        report_link  ...  \\\n",
       "dgst                                                                 ...   \n",
       "8ee7145a1b48b578  https://www.commoncriteriaportal.org/files/epf...  ...   \n",
       "d08b5ddedd34448d  https://www.commoncriteriaportal.org/files/epf...  ...   \n",
       "ff45605151ec4eb1  https://www.commoncriteriaportal.org/files/epf...  ...   \n",
       "9231adbf747903df  https://www.commoncriteriaportal.org/files/epf...  ...   \n",
       "890f788a91fc2fa1  https://www.commoncriteriaportal.org/files/epf...  ...   \n",
       "\n",
       "                 cpe_matches verified_cpe_matches related_cves  \\\n",
       "dgst                                                             \n",
       "8ee7145a1b48b578         NaN                  NaN          NaN   \n",
       "d08b5ddedd34448d         NaN                  NaN          NaN   \n",
       "ff45605151ec4eb1         NaN                  NaN          NaN   \n",
       "9231adbf747903df         NaN                  NaN          NaN   \n",
       "890f788a91fc2fa1         NaN                  NaN          NaN   \n",
       "\n",
       "                 directly_affected_by indirectly_affected_by  \\\n",
       "dgst                                                           \n",
       "8ee7145a1b48b578                  NaN                    NaN   \n",
       "d08b5ddedd34448d                  NaN                    NaN   \n",
       "ff45605151ec4eb1                  NaN                    NaN   \n",
       "9231adbf747903df                  NaN                    NaN   \n",
       "890f788a91fc2fa1                  NaN                    NaN   \n",
       "\n",
       "                 directly_affecting indirectly_affecting is_bsi_cert  \\\n",
       "dgst                                                                   \n",
       "8ee7145a1b48b578                NaN                  NaN       False   \n",
       "d08b5ddedd34448d                NaN                  NaN       False   \n",
       "ff45605151ec4eb1                NaN                  NaN       False   \n",
       "9231adbf747903df                NaN                  NaN       False   \n",
       "890f788a91fc2fa1                NaN                  NaN       False   \n",
       "\n",
       "                 is_anssi_cert highest_security_level  \n",
       "dgst                                                   \n",
       "8ee7145a1b48b578          True                   EAL7  \n",
       "d08b5ddedd34448d          True                   EAL7  \n",
       "ff45605151ec4eb1          True                   EAL7  \n",
       "9231adbf747903df          True                   EAL7  \n",
       "890f788a91fc2fa1          True                   EAL7  \n",
       "\n",
       "[5 rows x 23 columns]"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "eal7_df = cards_df[cards_df[\"highest_security_level\"] == highest_smart_card_security_level]\n",
    "eal7_df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "id": "9b577aca",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "FR    6\n",
       "US    0\n",
       "JP    0\n",
       "CA    0\n",
       "DE    0\n",
       "ES    0\n",
       "IN    0\n",
       "IT    0\n",
       "KR    0\n",
       "UK    0\n",
       "MY    0\n",
       "NL    0\n",
       "NO    0\n",
       "SE    0\n",
       "SG    0\n",
       "TR    0\n",
       "AU    0\n",
       "Name: scheme, dtype: int64"
      ]
     },
     "execution_count": 39,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "eal7_df[\"scheme\"].value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "id": "0452927f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>cert_id</th>\n",
       "      <th>name</th>\n",
       "      <th>status</th>\n",
       "      <th>category</th>\n",
       "      <th>manufacturer</th>\n",
       "      <th>scheme</th>\n",
       "      <th>security_level</th>\n",
       "      <th>not_valid_before</th>\n",
       "      <th>not_valid_after</th>\n",
       "      <th>report_link</th>\n",
       "      <th>...</th>\n",
       "      <th>cpe_matches</th>\n",
       "      <th>verified_cpe_matches</th>\n",
       "      <th>related_cves</th>\n",
       "      <th>directly_affected_by</th>\n",
       "      <th>indirectly_affected_by</th>\n",
       "      <th>directly_affecting</th>\n",
       "      <th>indirectly_affecting</th>\n",
       "      <th>is_bsi_cert</th>\n",
       "      <th>is_anssi_cert</th>\n",
       "      <th>highest_security_level</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dgst</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>8ee7145a1b48b578</th>\n",
       "      <td>ANSSI-CC-2020/33</td>\n",
       "      <td>MultiApp V4 JavaCard Virtual Machine</td>\n",
       "      <td>active</td>\n",
       "      <td>ICs, Smart Cards and Smart Card-Related Device...</td>\n",
       "      <td>Gemalto</td>\n",
       "      <td>FR</td>\n",
       "      <td>[EAL7]</td>\n",
       "      <td>2020-05-28</td>\n",
       "      <td>2025-05-28</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>False</td>\n",
       "      <td>True</td>\n",
       "      <td>EAL7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>d08b5ddedd34448d</th>\n",
       "      <td>ANSSI-CC-2018/50</td>\n",
       "      <td>IDMotion V2 Multos Virtual Machine OS Multos V...</td>\n",
       "      <td>active</td>\n",
       "      <td>ICs, Smart Cards and Smart Card-Related Device...</td>\n",
       "      <td>Gemalto / Trusted Labs</td>\n",
       "      <td>FR</td>\n",
       "      <td>[EAL7]</td>\n",
       "      <td>2018-12-14</td>\n",
       "      <td>2023-12-14</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>False</td>\n",
       "      <td>True</td>\n",
       "      <td>EAL7</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>2 rows × 23 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                           cert_id  \\\n",
       "dgst                                 \n",
       "8ee7145a1b48b578  ANSSI-CC-2020/33   \n",
       "d08b5ddedd34448d  ANSSI-CC-2018/50   \n",
       "\n",
       "                                                               name  status  \\\n",
       "dgst                                                                          \n",
       "8ee7145a1b48b578               MultiApp V4 JavaCard Virtual Machine  active   \n",
       "d08b5ddedd34448d  IDMotion V2 Multos Virtual Machine OS Multos V...  active   \n",
       "\n",
       "                                                           category  \\\n",
       "dgst                                                                  \n",
       "8ee7145a1b48b578  ICs, Smart Cards and Smart Card-Related Device...   \n",
       "d08b5ddedd34448d  ICs, Smart Cards and Smart Card-Related Device...   \n",
       "\n",
       "                            manufacturer scheme security_level  \\\n",
       "dgst                                                             \n",
       "8ee7145a1b48b578                 Gemalto     FR         [EAL7]   \n",
       "d08b5ddedd34448d  Gemalto / Trusted Labs     FR         [EAL7]   \n",
       "\n",
       "                 not_valid_before not_valid_after  \\\n",
       "dgst                                                \n",
       "8ee7145a1b48b578       2020-05-28      2025-05-28   \n",
       "d08b5ddedd34448d       2018-12-14      2023-12-14   \n",
       "\n",
       "                                                        report_link  ...  \\\n",
       "dgst                                                                 ...   \n",
       "8ee7145a1b48b578  https://www.commoncriteriaportal.org/files/epf...  ...   \n",
       "d08b5ddedd34448d  https://www.commoncriteriaportal.org/files/epf...  ...   \n",
       "\n",
       "                 cpe_matches verified_cpe_matches related_cves  \\\n",
       "dgst                                                             \n",
       "8ee7145a1b48b578         NaN                  NaN          NaN   \n",
       "d08b5ddedd34448d         NaN                  NaN          NaN   \n",
       "\n",
       "                 directly_affected_by indirectly_affected_by  \\\n",
       "dgst                                                           \n",
       "8ee7145a1b48b578                  NaN                    NaN   \n",
       "d08b5ddedd34448d                  NaN                    NaN   \n",
       "\n",
       "                 directly_affecting indirectly_affecting is_bsi_cert  \\\n",
       "dgst                                                                   \n",
       "8ee7145a1b48b578                NaN                  NaN       False   \n",
       "d08b5ddedd34448d                NaN                  NaN       False   \n",
       "\n",
       "                 is_anssi_cert highest_security_level  \n",
       "dgst                                                   \n",
       "8ee7145a1b48b578          True                   EAL7  \n",
       "d08b5ddedd34448d          True                   EAL7  \n",
       "\n",
       "[2 rows x 23 columns]"
      ]
     },
     "execution_count": 40,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "eal7_df[eal7_df[\"status\"] == \"active\"]"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "556ea87d",
   "metadata": {},
   "source": [
    "#### BSI certs in smart cards dataset"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "id": "9c685c2e",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "There is total of 487 BSI records among smart cards\n"
     ]
    }
   ],
   "source": [
    "bsi_smart_cards_df = cards_df[cards_df[\"is_bsi_cert\"]]\n",
    "\n",
    "print(f\"There is total of {bsi_smart_cards_df.shape[0]} BSI records among smart cards\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "462627db",
   "metadata": {},
   "source": [
    "#### Most common security levels among BSI smart card records"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "id": "41736158",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "EAL4+    198\n",
       "EAL5+    185\n",
       "EAL6+     70\n",
       "EAL3+     14\n",
       "EAL3      11\n",
       "EAL4       8\n",
       "EAL7+      0\n",
       "EAL7       0\n",
       "EAL5       0\n",
       "EAL2+      0\n",
       "EAL2       0\n",
       "EAL1+      0\n",
       "EAL1       0\n",
       "Name: highest_security_level, dtype: int64"
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "bsi_smart_cards_df[\"highest_security_level\"].value_counts()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "13a58439",
   "metadata": {},
   "source": [
    "#### ANSSI certs in smart cards dataset\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "id": "941699e7",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "There is total of 595 records ANSSI among smart cards\n"
     ]
    }
   ],
   "source": [
    "anssi_smart_cards_df = cards_df[cards_df[\"is_anssi_cert\"]]\n",
    "\n",
    "print(f\"There is total of {anssi_smart_cards_df.shape[0]} records ANSSI among smart cards\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "be2911f7",
   "metadata": {},
   "source": [
    "#### Most common security levels among ANSSI smart card records "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "id": "454287f5",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "EAL5+    366\n",
       "EAL4+    183\n",
       "EAL6+     29\n",
       "EAL7       6\n",
       "EAL5       6\n",
       "EAL3+      3\n",
       "EAL4       2\n",
       "EAL7+      0\n",
       "EAL3       0\n",
       "EAL2+      0\n",
       "EAL2       0\n",
       "EAL1+      0\n",
       "EAL1       0\n",
       "Name: highest_security_level, dtype: int64"
      ]
     },
     "execution_count": 44,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "anssi_smart_cards_df[\"highest_security_level\"].value_counts()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "7e955c25",
   "metadata": {},
   "source": [
    "#### Smarts cards which expires next year\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "id": "59fbcf9b",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>cert_id</th>\n",
       "      <th>name</th>\n",
       "      <th>status</th>\n",
       "      <th>category</th>\n",
       "      <th>manufacturer</th>\n",
       "      <th>scheme</th>\n",
       "      <th>security_level</th>\n",
       "      <th>not_valid_before</th>\n",
       "      <th>not_valid_after</th>\n",
       "      <th>report_link</th>\n",
       "      <th>...</th>\n",
       "      <th>cpe_matches</th>\n",
       "      <th>verified_cpe_matches</th>\n",
       "      <th>related_cves</th>\n",
       "      <th>directly_affected_by</th>\n",
       "      <th>indirectly_affected_by</th>\n",
       "      <th>directly_affecting</th>\n",
       "      <th>indirectly_affecting</th>\n",
       "      <th>is_bsi_cert</th>\n",
       "      <th>is_anssi_cert</th>\n",
       "      <th>highest_security_level</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dgst</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>503a0d9db4445cbc</th>\n",
       "      <td>BTBD-03-01-FR-01</td>\n",
       "      <td>Udea SSR_Core v1.0</td>\n",
       "      <td>active</td>\n",
       "      <td>ICs, Smart Cards and Smart Card-Related Device...</td>\n",
       "      <td>UDEA ELEKTRONİK SAN. TİC. A.Ş</td>\n",
       "      <td>TR</td>\n",
       "      <td>[ALC_DVS.2, EAL4+]</td>\n",
       "      <td>2020-02-11</td>\n",
       "      <td>2023-02-11</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>EAL4+</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>a269f33d8469d45f</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NXP Secure Smart Card Controller P60x080/052/0...</td>\n",
       "      <td>active</td>\n",
       "      <td>ICs, Smart Cards and Smart Card-Related Device...</td>\n",
       "      <td>NXP Semiconductors Germany GmbH, Business Unit...</td>\n",
       "      <td>NL</td>\n",
       "      <td>[ALC_FLR.1, ASE_TSS.2, EAL6+]</td>\n",
       "      <td>2019-07-30</td>\n",
       "      <td>2023-02-21</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>EAL6+</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>ed10036ddfbda912</th>\n",
       "      <td>NaN</td>\n",
       "      <td>IDeal Pass v2.3-n JC with Privacy Protection (...</td>\n",
       "      <td>active</td>\n",
       "      <td>ICs, Smart Cards and Smart Card-Related Device...</td>\n",
       "      <td>Idemia</td>\n",
       "      <td>NL</td>\n",
       "      <td>[ADV_FSP.5, ADV_INT.2, ADV_TDS.4, ALC_CMC.5, A...</td>\n",
       "      <td>2019-02-18</td>\n",
       "      <td>2023-06-26</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>EAL4+</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>625b243397001f01</th>\n",
       "      <td>NaN</td>\n",
       "      <td>IDeal Pass v2.3-n JC with Privacy Protection (...</td>\n",
       "      <td>active</td>\n",
       "      <td>ICs, Smart Cards and Smart Card-Related Device...</td>\n",
       "      <td>Idemia</td>\n",
       "      <td>NL</td>\n",
       "      <td>[ALC_DVS.2, AVA_VAN.5, EAL5+]</td>\n",
       "      <td>2019-02-18</td>\n",
       "      <td>2023-06-26</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>EAL5+</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6dde54b8c6d592ef</th>\n",
       "      <td>BSI-DSZ-CC-1100-2018</td>\n",
       "      <td>Infineon Technologies AG OPTIGA™ Trusted Platf...</td>\n",
       "      <td>active</td>\n",
       "      <td>ICs, Smart Cards and Smart Card-Related Device...</td>\n",
       "      <td>Infineon Technologies AG</td>\n",
       "      <td>DE</td>\n",
       "      <td>[ALC_FLR.1, AVA_VAN.4, EAL4+]</td>\n",
       "      <td>2018-12-18</td>\n",
       "      <td>2023-12-18</td>\n",
       "      <td>https://www.commoncriteriaportal.org/files/epf...</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>{BSI-DSZ-CC-1086-2018}</td>\n",
       "      <td>{BSI-DSZ-CC-0998-2016, BSI-DSZ-CC-1086-2018, B...</td>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>EAL4+</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 23 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                               cert_id  \\\n",
       "dgst                                     \n",
       "503a0d9db4445cbc      BTBD-03-01-FR-01   \n",
       "a269f33d8469d45f                   NaN   \n",
       "ed10036ddfbda912                   NaN   \n",
       "625b243397001f01                   NaN   \n",
       "6dde54b8c6d592ef  BSI-DSZ-CC-1100-2018   \n",
       "\n",
       "                                                               name  status  \\\n",
       "dgst                                                                          \n",
       "503a0d9db4445cbc                                 Udea SSR_Core v1.0  active   \n",
       "a269f33d8469d45f  NXP Secure Smart Card Controller P60x080/052/0...  active   \n",
       "ed10036ddfbda912  IDeal Pass v2.3-n JC with Privacy Protection (...  active   \n",
       "625b243397001f01  IDeal Pass v2.3-n JC with Privacy Protection (...  active   \n",
       "6dde54b8c6d592ef  Infineon Technologies AG OPTIGA™ Trusted Platf...  active   \n",
       "\n",
       "                                                           category  \\\n",
       "dgst                                                                  \n",
       "503a0d9db4445cbc  ICs, Smart Cards and Smart Card-Related Device...   \n",
       "a269f33d8469d45f  ICs, Smart Cards and Smart Card-Related Device...   \n",
       "ed10036ddfbda912  ICs, Smart Cards and Smart Card-Related Device...   \n",
       "625b243397001f01  ICs, Smart Cards and Smart Card-Related Device...   \n",
       "6dde54b8c6d592ef  ICs, Smart Cards and Smart Card-Related Device...   \n",
       "\n",
       "                                                       manufacturer scheme  \\\n",
       "dgst                                                                         \n",
       "503a0d9db4445cbc                      UDEA ELEKTRONİK SAN. TİC. A.Ş     TR   \n",
       "a269f33d8469d45f  NXP Semiconductors Germany GmbH, Business Unit...     NL   \n",
       "ed10036ddfbda912                                             Idemia     NL   \n",
       "625b243397001f01                                             Idemia     NL   \n",
       "6dde54b8c6d592ef                           Infineon Technologies AG     DE   \n",
       "\n",
       "                                                     security_level  \\\n",
       "dgst                                                                  \n",
       "503a0d9db4445cbc                                 [ALC_DVS.2, EAL4+]   \n",
       "a269f33d8469d45f                      [ALC_FLR.1, ASE_TSS.2, EAL6+]   \n",
       "ed10036ddfbda912  [ADV_FSP.5, ADV_INT.2, ADV_TDS.4, ALC_CMC.5, A...   \n",
       "625b243397001f01                      [ALC_DVS.2, AVA_VAN.5, EAL5+]   \n",
       "6dde54b8c6d592ef                      [ALC_FLR.1, AVA_VAN.4, EAL4+]   \n",
       "\n",
       "                 not_valid_before not_valid_after  \\\n",
       "dgst                                                \n",
       "503a0d9db4445cbc       2020-02-11      2023-02-11   \n",
       "a269f33d8469d45f       2019-07-30      2023-02-21   \n",
       "ed10036ddfbda912       2019-02-18      2023-06-26   \n",
       "625b243397001f01       2019-02-18      2023-06-26   \n",
       "6dde54b8c6d592ef       2018-12-18      2023-12-18   \n",
       "\n",
       "                                                        report_link  ...  \\\n",
       "dgst                                                                 ...   \n",
       "503a0d9db4445cbc  https://www.commoncriteriaportal.org/files/epf...  ...   \n",
       "a269f33d8469d45f  https://www.commoncriteriaportal.org/files/epf...  ...   \n",
       "ed10036ddfbda912  https://www.commoncriteriaportal.org/files/epf...  ...   \n",
       "625b243397001f01  https://www.commoncriteriaportal.org/files/epf...  ...   \n",
       "6dde54b8c6d592ef  https://www.commoncriteriaportal.org/files/epf...  ...   \n",
       "\n",
       "                 cpe_matches verified_cpe_matches related_cves  \\\n",
       "dgst                                                             \n",
       "503a0d9db4445cbc         NaN                  NaN          NaN   \n",
       "a269f33d8469d45f         NaN                  NaN          NaN   \n",
       "ed10036ddfbda912         NaN                  NaN          NaN   \n",
       "625b243397001f01         NaN                  NaN          NaN   \n",
       "6dde54b8c6d592ef         NaN                  NaN          NaN   \n",
       "\n",
       "                 directly_affected_by indirectly_affected_by  \\\n",
       "dgst                                                           \n",
       "503a0d9db4445cbc                  NaN                    NaN   \n",
       "a269f33d8469d45f                  NaN                    NaN   \n",
       "ed10036ddfbda912                  NaN                    NaN   \n",
       "625b243397001f01                  NaN                    NaN   \n",
       "6dde54b8c6d592ef                  NaN                    NaN   \n",
       "\n",
       "                      directly_affecting  \\\n",
       "dgst                                       \n",
       "503a0d9db4445cbc                     NaN   \n",
       "a269f33d8469d45f                     NaN   \n",
       "ed10036ddfbda912                     NaN   \n",
       "625b243397001f01                     NaN   \n",
       "6dde54b8c6d592ef  {BSI-DSZ-CC-1086-2018}   \n",
       "\n",
       "                                               indirectly_affecting  \\\n",
       "dgst                                                                  \n",
       "503a0d9db4445cbc                                                NaN   \n",
       "a269f33d8469d45f                                                NaN   \n",
       "ed10036ddfbda912                                                NaN   \n",
       "625b243397001f01                                                NaN   \n",
       "6dde54b8c6d592ef  {BSI-DSZ-CC-0998-2016, BSI-DSZ-CC-1086-2018, B...   \n",
       "\n",
       "                 is_bsi_cert is_anssi_cert highest_security_level  \n",
       "dgst                                                               \n",
       "503a0d9db4445cbc       False         False                  EAL4+  \n",
       "a269f33d8469d45f       False         False                  EAL6+  \n",
       "ed10036ddfbda912       False         False                  EAL4+  \n",
       "625b243397001f01       False         False                  EAL5+  \n",
       "6dde54b8c6d592ef        True         False                  EAL4+  \n",
       "\n",
       "[5 rows x 23 columns]"
      ]
     },
     "execution_count": 45,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "next_year = datetime.datetime.now().year + 1\n",
    "\n",
    "def is_expiring_next_year(series_datetime):\n",
    "    return series_datetime.year == next_year\n",
    "\n",
    "\n",
    "cards_next_year_expires_df = cards_df[cards_df[\"not_valid_after\"].apply(is_expiring_next_year)]\n",
    "cards_next_year_expires_df.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "aab6cbec",
   "metadata": {},
   "source": [
    "### Which schemes are directly affecting certs with other schemes"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "id": "dc154008",
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "US    884\n",
       "FR    859\n",
       "DE    854\n",
       "JP    522\n",
       "CA    431\n",
       "NL    153\n",
       "ES    147\n",
       "KR    130\n",
       "UK    121\n",
       "AU    101\n",
       "NO    100\n",
       "SE     98\n",
       "MY     66\n",
       "TR     66\n",
       "IT     60\n",
       "IN     16\n",
       "SG      8\n",
       "Name: scheme, dtype: int64"
      ]
     },
     "execution_count": 46,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df[\"scheme\"].value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "id": "b5758f83",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Total of 646 certs are directly affecting other certs.\n"
     ]
    }
   ],
   "source": [
    "scheme_df = df[df[\"directly_affecting\"].notna()]\n",
    "print(f\"Total of {scheme_df.shape[0]} certs are directly affecting other certs.\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "id": "ec96a506",
   "metadata": {},
   "outputs": [],
   "source": [
    "def get_scheme_from_cert_id(cert_id: str) -> str:\n",
    "    scheme_list = df[df[\"cert_id\"] == cert_id][\"scheme\"].tolist()\n",
    "    \n",
    "    if not scheme_list:\n",
    "        return None \n",
    "    \n",
    "    \n",
    "    return df[df[\"cert_id\"] == cert_id][\"scheme\"].tolist()[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "id": "7c537844",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{'US': Counter(), 'FR': Counter({'FR': 57, 'DE': 56, None: 25, 'KR': 17}), 'DE': Counter({'DE': 723, None: 134, 'FR': 22, 'KR': 14, 'ES': 13, 'NL': 9, 'TR': 7, 'US': 2}), 'JP': Counter({'DE': 2}), 'CA': Counter(), 'NL': Counter({'KR': 1, None: 1}), 'ES': Counter({'DE': 1}), 'KR': Counter({'KR': 3, None: 3, 'DE': 1}), 'UK': Counter(), 'AU': Counter(), 'NO': Counter(), 'SE': Counter(), 'MY': Counter(), 'TR': Counter(), 'IT': Counter(), 'IN': Counter(), 'SG': Counter()}\n"
     ]
    }
   ],
   "source": [
    "CC_SCHEMES = [\"US\", \"FR\", \"DE\", \"JP\", \"CA\", \"NL\", \"ES\", \"KR\", \"UK\", \"AU\", \"NO\", \"SE\", \"MY\", \"TR\", \"IT\", \"IN\", \"SG\"]\n",
    "result = {}\n",
    "\n",
    "\n",
    "for scheme in CC_SCHEMES:\n",
    "    counter = collections.Counter()\n",
    "    scheme_affecting_series = scheme_df[scheme_df[\"scheme\"] == scheme][\"directly_affecting\"]\n",
    "    \n",
    "    for affecting_set in scheme_affecting_series:\n",
    "        tmp_dict = {}\n",
    "        \n",
    "        for cert_id in affecting_set:\n",
    "            current_scheme = get_scheme_from_cert_id(cert_id)\n",
    "            tmp_dict[current_scheme] = tmp_dict.get(current_scheme, 0) + 1\n",
    "            \n",
    "        counter.update(tmp_dict)\n",
    "    \n",
    "    result[scheme] = counter    \n",
    "\n",
    "print(result)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "id": "67c2b3c7",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "US Counter()\n",
      "FR Counter({'FR': 57, 'DE': 56, None: 25, 'KR': 17})\n",
      "DE Counter({'DE': 723, None: 134, 'FR': 22, 'KR': 14, 'ES': 13, 'NL': 9, 'TR': 7, 'US': 2})\n",
      "JP Counter({'DE': 2})\n",
      "CA Counter()\n",
      "NL Counter({'KR': 1, None: 1})\n",
      "ES Counter({'DE': 1})\n",
      "KR Counter({'KR': 3, None: 3, 'DE': 1})\n",
      "UK Counter()\n",
      "AU Counter()\n",
      "NO Counter()\n",
      "SE Counter()\n",
      "MY Counter()\n",
      "TR Counter()\n",
      "IT Counter()\n",
      "IN Counter()\n",
      "SG Counter()\n",
      "[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 57, 56, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0], [2, 22, 723, 0, 0, 9, 13, 14, 0, 0, 0, 0, 0, 7, 0, 0, 0], [0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "Text(0.5, 21.5, 'Schemes affected by specific scheme')"
      ]
     },
     "execution_count": 50,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "[encoded data, 30284 characters]",
      "text/plain": [
       "<Figure size 720x360 with 2 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.figure(figsize=(10,5))\n",
    "plt.rcParams.update({'font.size': 20})\n",
    "heatmap_result = []\n",
    "\n",
    "\n",
    "for scheme, counter in result.items():\n",
    "    print(scheme, counter)\n",
    "    scheme_list = []\n",
    "    for scheme_key in CC_SCHEMES:\n",
    "        scheme_list.append(counter.get(scheme_key, 0))\n",
    "    \n",
    "    heatmap_result.append(scheme_list)\n",
    "    \n",
    "print(heatmap_result)\n",
    "sns.set(style=\"whitegrid\")\n",
    "ax = sns.heatmap(heatmap_result, xticklabels=CC_SCHEMES, yticklabels=CC_SCHEMES,cmap=\"Greens\").set_title(\"Archived certs vs. active certs\")\n",
    "plt.ylabel(\"Specific cert scheme\")\n",
    "plt.xlabel(\"Schemes affected by specific scheme\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "cd388919",
   "metadata": {},
   "source": [
    "#### Dependencies among scheme\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 66,
   "id": "c956178b",
   "metadata": {},
   "outputs": [],
   "source": [
    "def return_unique_years_in_dataset():    \n",
    "    unique_years = set()\n",
    "\n",
    "    for timestamp_record in scheme_df[\"not_valid_before\"]:\n",
    "        unique_years.add(timestamp_record.year)\n",
    "        \n",
    "    return unique_years"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 69,
   "id": "be0b4b80",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'US': Counter(),\n",
       " 'FR': Counter({'DE': 56, 'FR': 57, None: 25, 'KR': 17}),\n",
       " 'DE': Counter({None: 134,\n",
       "          'DE': 723,\n",
       "          'FR': 22,\n",
       "          'NL': 9,\n",
       "          'KR': 14,\n",
       "          'US': 2,\n",
       "          'ES': 13,\n",
       "          'TR': 7}),\n",
       " 'JP': Counter({'DE': 2}),\n",
       " 'CA': Counter(),\n",
       " 'NL': Counter({'KR': 1, None: 1}),\n",
       " 'ES': Counter({'DE': 1}),\n",
       " 'KR': Counter({'KR': 3, None: 3, 'DE': 1}),\n",
       " 'UK': Counter(),\n",
       " 'AU': Counter(),\n",
       " 'NO': Counter(),\n",
       " 'SE': Counter(),\n",
       " 'MY': Counter(),\n",
       " 'TR': Counter(),\n",
       " 'IT': Counter(),\n",
       " 'IN': Counter(),\n",
       " 'SG': Counter()}"
      ]
     },
     "execution_count": 69,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "CC_SCHEMES = [\"US\", \"FR\", \"DE\", \"JP\", \"CA\", \"NL\", \"ES\", \"KR\", \"UK\", \"AU\", \"NO\", \"SE\", \"MY\", \"TR\", \"IT\", \"IN\", \"SG\"]\n",
    "\n",
    "def discover_scheme_dependiencies_in_dataset(dataset):\n",
    "    result = {}\n",
    "\n",
    "    for scheme in CC_SCHEMES:\n",
    "        counter = collections.Counter()\n",
    "        scheme_affecting_series = dataset[dataset[\"scheme\"] == scheme][\"directly_affecting\"]\n",
    "\n",
    "        for affecting_set in scheme_affecting_series:\n",
    "            tmp_dict = {}\n",
    "\n",
    "            for cert_id in affecting_set:\n",
    "                current_scheme = get_scheme_from_cert_id(cert_id)\n",
    "                tmp_dict[current_scheme] = tmp_dict.get(current_scheme, 0) + 1\n",
    "\n",
    "            counter.update(tmp_dict)\n",
    "\n",
    "        result[scheme] = counter\n",
    "\n",
    "    return result\n",
    "\n",
    "discover_scheme_dependiencies_in_dataset(scheme_df)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 103,
   "id": "cc3b31bd",
   "metadata": {},
   "outputs": [],
   "source": [
    "CC_SCHEMES = [\"US\", \"FR\", \"DE\", \"JP\", \"CA\", \"NL\", \"ES\", \"KR\", \"UK\", \"AU\", \"NO\", \"SE\", \"MY\", \"TR\", \"IT\", \"IN\", \"SG\"]\n",
    "\n",
    "def discover_scheme_dependiencies_in_dataset(year: int):\n",
    "    result = {}\n",
    "\n",
    "    for scheme in CC_SCHEMES:\n",
    "        counter = collections.Counter()\n",
    "        current_scheme_df = scheme_df[scheme_df[\"scheme\"] == scheme]  # [\"directly_affecting\"]\n",
    "        \n",
    "        for index, row in current_scheme_df.iterrows():\n",
    "            if row[\"not_valid_before\"].year != year:\n",
    "                continue\n",
    "            \n",
    "            tmp_dict = {}\n",
    "            for cert_id in row[\"directly_affecting\"]:\n",
    "                current_scheme = get_scheme_from_cert_id(cert_id)\n",
    "                tmp_dict[current_scheme] = tmp_dict.get(current_scheme, 0) + 1\n",
    "\n",
    "            counter.update(tmp_dict)\n",
    "\n",
    "        result[scheme] = counter\n",
    "\n",
    "    return result"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 104,
   "id": "965e6f3e",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{2016: {'US': Counter(), 'FR': Counter({'DE': 28}), 'DE': Counter({'DE': 28, 'NL': 6, None: 3}), 'JP': Counter(), 'CA': Counter(), 'NL': Counter({'KR': 1, None: 1}), 'ES': Counter(), 'KR': Counter(), 'UK': Counter(), 'AU': Counter(), 'NO': Counter(), 'SE': Counter(), 'MY': Counter(), 'TR': Counter(), 'IT': Counter(), 'IN': Counter(), 'SG': Counter()}, 2017: {'US': Counter(), 'FR': Counter(), 'DE': Counter({'DE': 44, None: 9, 'NL': 1, 'FR': 1}), 'JP': Counter(), 'CA': Counter(), 'NL': Counter(), 'ES': Counter(), 'KR': Counter(), 'UK': Counter(), 'AU': Counter(), 'NO': Counter(), 'SE': Counter(), 'MY': Counter(), 'TR': Counter(), 'IT': Counter(), 'IN': Counter(), 'SG': Counter()}, 2018: {'US': Counter(), 'FR': Counter({'DE': 1}), 'DE': Counter({'DE': 46, None: 11, 'FR': 7}), 'JP': Counter(), 'CA': Counter(), 'NL': Counter(), 'ES': Counter(), 'KR': Counter(), 'UK': Counter(), 'AU': Counter(), 'NO': Counter(), 'SE': Counter(), 'MY': Counter(), 'TR': Counter(), 'IT': Counter(), 'IN': Counter(), 'SG': Counter()}, 2019: {'US': Counter(), 'FR': Counter(), 'DE': Counter({'DE': 44, None: 15, 'FR': 3}), 'JP': Counter({'DE': 2}), 'CA': Counter(), 'NL': Counter(), 'ES': Counter(), 'KR': Counter(), 'UK': Counter(), 'AU': Counter(), 'NO': Counter(), 'SE': Counter(), 'MY': Counter(), 'TR': Counter(), 'IT': Counter(), 'IN': Counter(), 'SG': Counter()}, 2020: {'US': Counter(), 'FR': Counter(), 'DE': Counter({'DE': 33, None: 9, 'FR': 7}), 'JP': Counter(), 'CA': Counter(), 'NL': Counter(), 'ES': Counter(), 'KR': Counter(), 'UK': Counter(), 'AU': Counter(), 'NO': Counter(), 'SE': Counter(), 'MY': Counter(), 'TR': Counter(), 'IT': Counter(), 'IN': Counter(), 'SG': Counter()}, 2021: {'US': Counter(), 'FR': Counter(), 'DE': Counter({'DE': 14, None: 4}), 'JP': Counter(), 'CA': Counter(), 'NL': Counter(), 'ES': Counter(), 'KR': Counter(), 'UK': Counter(), 'AU': Counter(), 'NO': Counter(), 'SE': Counter(), 'MY': Counter(), 'TR': Counter(), 'IT': Counter(), 'IN': Counter(), 'SG': Counter()}, 2004: {'US': Counter(), 'FR': Counter(), 'DE': Counter({None: 5}), 'JP': Counter(), 'CA': Counter(), 'NL': Counter(), 'ES': Counter(), 'KR': Counter(), 'UK': Counter(), 'AU': Counter(), 'NO': Counter(), 'SE': Counter(), 'MY': Counter(), 'TR': Counter(), 'IT': Counter(), 'IN': Counter(), 'SG': Counter()}, 2005: {'US': Counter(), 'FR': Counter(), 'DE': Counter({'DE': 9, None: 4}), 'JP': Counter(), 'CA': Counter(), 'NL': Counter(), 'ES': Counter(), 'KR': Counter(), 'UK': Counter(), 'AU': Counter(), 'NO': Counter(), 'SE': Counter(), 'MY': Counter(), 'TR': Counter(), 'IT': Counter(), 'IN': Counter(), 'SG': Counter()}, 2006: {'US': Counter(), 'FR': Counter({None: 5, 'DE': 1}), 'DE': Counter({'DE': 24, None: 5}), 'JP': Counter(), 'CA': Counter(), 'NL': Counter(), 'ES': Counter(), 'KR': Counter(), 'UK': Counter(), 'AU': Counter(), 'NO': Counter(), 'SE': Counter(), 'MY': Counter(), 'TR': Counter(), 'IT': Counter(), 'IN': Counter(), 'SG': Counter()}, 2007: {'US': Counter(), 'FR': Counter({None: 8, 'FR': 1, 'DE': 1}), 'DE': Counter({'DE': 40, None: 8, 'US': 1, 'TR': 1, 'FR': 1, 'ES': 1}), 'JP': Counter(), 'CA': Counter(), 'NL': Counter(), 'ES': Counter(), 'KR': Counter(), 'UK': Counter(), 'AU': Counter(), 'NO': Counter(), 'SE': Counter(), 'MY': Counter(), 'TR': Counter(), 'IT': Counter(), 'IN': Counter(), 'SG': Counter()}, 2008: {'US': Counter(), 'FR': Counter({'FR': 9, 'DE': 2, None: 1}), 'DE': Counter({'DE': 53, None: 16, 'TR': 5, 'FR': 2, 'US': 1, 'ES': 1}), 'JP': Counter(), 'CA': Counter(), 'NL': Counter(), 'ES': Counter({'DE': 1}), 'KR': Counter(), 'UK': Counter(), 'AU': Counter(), 'NO': Counter(), 'SE': Counter(), 'MY': Counter(), 'TR': Counter(), 'IT': Counter(), 'IN': Counter(), 'SG': Counter()}, 2009: {'US': Counter(), 'FR': Counter({'DE': 18, 'FR': 10, None: 5}), 'DE': Counter({'DE': 49, None: 8}), 'JP': Counter(), 'CA': Counter(), 'NL': Counter(), 'ES': Counter(), 'KR': Counter(), 'UK': Counter(), 'AU': Counter(), 'NO': Counter(), 'SE': Counter(), 'MY': Counter(), 'TR': Counter(), 'IT': Counter(), 'IN': Counter(), 'SG': Counter()}, 2010: {'US': Counter(), 'FR': Counter({'KR': 16, 'FR': 16, None: 4, 'DE': 1}), 'DE': Counter({'DE': 47, None: 5, 'ES': 1, 'TR': 1, 'KR': 1}), 'JP': Counter(), 'CA': Counter(), 'NL': Counter(), 'ES': Counter(), 'KR': Counter(), 'UK': Counter(), 'AU': Counter(), 'NO': Counter(), 'SE': Counter(), 'MY': Counter(), 'TR': Counter(), 'IT': Counter(), 'IN': Counter(), 'SG': Counter()}, 2011: {'US': Counter(), 'FR': Counter({'FR': 5, None: 2, 'DE': 2, 'KR': 1}), 'DE': Counter({'DE': 67, 'ES': 7, None: 4, 'KR': 3}), 'JP': Counter(), 'CA': Counter(), 'NL': Counter(), 'ES': Counter(), 'KR': Counter(), 'UK': Counter(), 'AU': Counter(), 'NO': Counter(), 'SE': Counter(), 'MY': Counter(), 'TR': Counter(), 'IT': Counter(), 'IN': Counter(), 'SG': Counter()}, 2012: {'US': Counter(), 'FR': Counter({'FR': 8, 'DE': 1}), 'DE': Counter({'DE': 82, None: 3, 'ES': 1}), 'JP': Counter(), 'CA': Counter(), 'NL': Counter(), 'ES': Counter(), 'KR': Counter({'DE': 1, 'KR': 1, None: 1}), 'UK': Counter(), 'AU': Counter(), 'NO': Counter(), 'SE': Counter(), 'MY': Counter(), 'TR': Counter(), 'IT': Counter(), 'IN': Counter(), 'SG': Counter()}, 2013: {'US': Counter(), 'FR': Counter({'FR': 4}), 'DE': Counter({'DE': 57, None: 9, 'ES': 2, 'KR': 2}), 'JP': Counter(), 'CA': Counter(), 'NL': Counter(), 'ES': Counter(), 'KR': Counter(), 'UK': Counter(), 'AU': Counter(), 'NO': Counter(), 'SE': Counter(), 'MY': Counter(), 'TR': Counter(), 'IT': Counter(), 'IN': Counter(), 'SG': Counter()}, 2014: {'US': Counter(), 'FR': Counter({'FR': 1}), 'DE': Counter({'DE': 60, None: 9, 'KR': 5, 'FR': 1}), 'JP': Counter(), 'CA': Counter(), 'NL': Counter(), 'ES': Counter(), 'KR': Counter(), 'UK': Counter(), 'AU': Counter(), 'NO': Counter(), 'SE': Counter(), 'MY': Counter(), 'TR': Counter(), 'IT': Counter(), 'IN': Counter(), 'SG': Counter()}, 2015: {'US': Counter(), 'FR': Counter({'FR': 3, 'DE': 1}), 'DE': Counter({'DE': 26, None: 7, 'KR': 3, 'NL': 2}), 'JP': Counter(), 'CA': Counter(), 'NL': Counter(), 'ES': Counter(), 'KR': Counter({'KR': 2, None: 2}), 'UK': Counter(), 'AU': Counter(), 'NO': Counter(), 'SE': Counter(), 'MY': Counter(), 'TR': Counter(), 'IT': Counter(), 'IN': Counter(), 'SG': Counter()}}\n"
     ]
    }
   ],
   "source": [
    "UNIQUE_YEARS = return_unique_years_in_dataset()\n",
    "year_result = {}\n",
    "\n",
    "for year in UNIQUE_YEARS:\n",
    "    scheme_year_df = scheme_df[scheme_df[\"not_valid_before\"] == year]\n",
    "    year_result[year] = discover_scheme_dependiencies_in_dataset(year)\n",
    "\n",
    "print(year_result)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
