<commit_before><?php
$g = stream_context_create (array("ssl" => array("capture_peer_cert" => true)));
$r = stream_socket_client("ssl://$DOMAIN:$PORT", $errno, $errstr, 30,
    STREAM_CLIENT_CONNECT, $g);
$cont = stream_context_get_params($r);
$cert = openssl_x509_read($cont["options"]["ssl"]["peer_certificate"]);
$cert_data = openssl_x509_parse( $cert );
$common_name = $cert_data['subject']['CN'];
$issuer = $cert_data['issuer']['O'];
$valid_from = $cert_data['validFrom_time_t']; 
$valid_to = $cert_data['validTo_time_t'];

echo "Common Name: " . $common_name . "\n" . "Issuing CA: " . $issuer . "\n" . "Valid from: " . $valid_from . "\n" . "Valid to: " . $valid_to . "\n";
?><commit_msg>update to create class for checkCertInfo.php<commit_after><?php

class CertificateScanning {
    private $target;
    private $target_port;

    public function set_parameters($target, $target_port)
    {
        $this->target=$target;
        $this->target_port=$target_port;
    }

    public function scan_certificate()
    {
        $g = stream_context_create (array("ssl" => array("capture_peer_cert" => true)));
        $r = stream_socket_client("ssl://$this->target:$this->target_port", $errno, $errstr, 30,
                STREAM_CLIENT_CONNECT, $g);
        $cont = stream_context_get_params($r);
        $cert = openssl_x509_read($cont["options"]["ssl"]["peer_certificate"]);
        $cert_data = openssl_x509_parse( $cert );
        $this->common_name=$cert_data['subject']['CN'];
        $this->issuer=$cert_data['issuer']['O'];
        $this->valid_from=$cert_data['validFrom_time_t'];
        $this->valid_to=$cert_data['validTo_time_t'];
    }
}

?>
{'fraction_non_alphanumeric': 0.18840579710144928, 'fraction_numerical': 0.00966183574879227, 'mean_word_length': 4.432786885245902, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3355583', 'n_tokens_mistral': 585, 'n_tokens_neox': 578, 'n_words': 89}