diff --git a/src/Controller/DomainsController.php b/src/Controller/DomainsController.php index 2928a55..629b602 100644 --- a/src/Controller/DomainsController.php +++ b/src/Controller/DomainsController.php @@ -40,7 +40,7 @@ public function __construct(EntityManagerInterface $em, UrlGeneratorInterface $r } #[Route('/domains', name: 'app_domains')] - public function index(): Response + public function index(Request $request): Response { if (!$this->getUser() || !$this->isGranted('IS_AUTHENTICATED')) { return $this->redirectToRoute('app_login'); @@ -99,6 +99,7 @@ public function index(): Response 'domains' => $domains, 'bimivmcinfo' => $bimivmcinfo, 'pages' => $pages, + //'now' => , //Todo-Ante: this is the now for VMC date checking, it needs to be current time but check time notation 'page' => array( 'menu' => array( 'category' => 'domains', diff --git a/src/Twig/RSABits.php b/src/Twig/RSABits.php new file mode 100644 index 0000000..613924e --- /dev/null +++ b/src/Twig/RSABits.php @@ -0,0 +1,41 @@ +getRsaKeyBitLengthFromDnsRecord($rsakey); + return $keyDetails['bits']; + } + + function getRsaKeyBitLengthFromDnsRecord($dkimKeyStr) { + $dkimKeyStr = str_replace(["\n", "\r", " "], "", $dkimKeyStr); + $binaryKey = base64_decode($dkimKeyStr); + if ($binaryKey === false) { + throw new Exception("Invalid base64 encoding in DKIM key."); + } + $formattedKey = "-----BEGIN PUBLIC KEY-----\n" . chunk_split(base64_encode($binaryKey), 64, "\n") . "-----END PUBLIC KEY-----"; + $publicKey = openssl_pkey_get_public($formattedKey); + if ($publicKey === false) { + throw new Exception("Failed to parse DKIM key."); + } + $keyDetails = openssl_pkey_get_details($publicKey); + openssl_free_key($publicKey); + + return $keyDetails; + } +} \ No newline at end of file diff --git a/templates/domains/check.html.twig b/templates/domains/check.html.twig index a6f9b43..711e2ec 100644 --- a/templates/domains/check.html.twig +++ b/templates/domains/check.html.twig @@ -37,7 +37,7 @@