Cert issuer details
554716
def gen_issuer
        name = "/C=#{EasyRSA::Config.country}"
        name += "/ST=#{EasyRSA::Config.state}" unless !EasyRSA::Config.state || EasyRSA::Config.state.empty?
        name += "/L=#{EasyRSA::Config.city}"
        name += "/O=#{EasyRSA::Config.company}"
        name += "/OU=#{EasyRSA::Config.orgunit}"
        name += "/CN=#{EasyRSA::Config.server}"
        name += "/name=#{EasyRSA::Config.name}" unless !EasyRSA::Config.name || EasyRSA::Config.name.empty?
        name += "/name=#{EasyRSA::Config.orgunit}" if !EasyRSA::Config.name || EasyRSA::Config.name.empty?
        name += "/emailAddress=#{EasyRSA::Config.email}"

        @ca_cert.issuer = OpenSSL::X509::Name.parse(name)
      end
1125251
private function _verifyIssuer(): Certificate
    {
        $path = $this->_config->issuerPath();
        $config = PathValidationConfig::defaultConfig()->withMaxLength(
            count($path))->withDateTime($this->_config->evaluationTime());
        try {
            $issuer = $path->validate($config, $this->_crypto)->certificate();
        } catch (PathValidationException $e) {
            throw new ACValidationException(
                "Failed to validate issuer PKC's certification path.", 0, $e);
        }
        if (!$this->_ac->isIssuedBy($issuer)) {
            throw new ACValidationException("Name mismatch of AC's issuer PKC.");
        }
        $pubkey_info = $issuer->tbsCertificate()->subjectPublicKeyInfo();
        if (!$this->_ac->verify($pubkey_info, $this->_crypto)) {
            throw new ACValidationException("Failed to verify signature.");
        }
        return $issuer;
    }
718656
private static String getCertIdIdByStore(KeyStore keyStore) {
		Enumeration<String> aliasenum = null;
		try {
			aliasenum = keyStore.aliases();
			String keyAlias = null;
			if (aliasenum.hasMoreElements()) {
				keyAlias = aliasenum.nextElement();
			}
			X509Certificate cert = (X509Certificate) keyStore
					.getCertificate(keyAlias);
			return cert.getSerialNumber().toString();
		} catch (KeyStoreException e) {
			LogUtil.writeErrorLog("getCertIdIdByStore Error", e);
			return null;
		}
	}
1336697
private function getCertificateIssuerName()
    {
        $publicCertData = $this->getPublicCertificateData();
        $x509Issuer = $publicCertData['issuer'];
        $x509IssuerC = isset($x509Issuer['C']) ? $x509Issuer['C'] : '';
        $x509IssuerO = isset($x509Issuer['O']) ? $x509Issuer['O'] : '';
        $x509IssuerOU = isset($x509Issuer['OU']) ? $x509Issuer['OU'] : '';

        $x509IssuerName = sprintf('OU=%s,O=%s,C=%s', $x509IssuerOU, $x509IssuerO, $x509IssuerC);

        return $x509IssuerName;
    }
205324
private void updateState(X509Certificate currCert)
        throws CertPathValidatorException
    {
        PublicKey cKey = currCert.getPublicKey();
        if (debug != null) {
            debug.println("BasicChecker.updateState issuer: " +
                currCert.getIssuerX500Principal().toString() + "; subject: " +
                currCert.getSubjectX500Principal() + "; serial#: " +
                currCert.getSerialNumber().toString());
        }
        if (PKIX.isDSAPublicKeyWithoutParams(cKey)) {
            // cKey needs to inherit DSA parameters from prev key
            cKey = makeInheritedParamsKey(cKey, prevPubKey);
            if (debug != null) debug.println("BasicChecker.updateState Made " +
                                             "key with inherited params");
        }
        prevPubKey = cKey;
        prevSubject = currCert.getSubjectX500Principal();
    }
808428
def _extract_ocsp_certs(self, ocsp_response):
        

        status = ocsp_response['response_status'].native
        if status == 'successful':
            response_bytes = ocsp_response['response_bytes']
            if response_bytes['response_type'].native == 'basic_ocsp_response':
                response = response_bytes['response'].parsed
                if response['certs']:
                    for other_cert in response['certs']:
                        if self.certificate_registry.add_other_cert(other_cert):
                            self._revocation_certs[other_cert.issuer_serial] = other_cert
967403
def sni_certs(self):
		
		if not g_ssl_has_server_sni or self._ssl_sni_entries is None:
			return tuple()
		return tuple(entry.certificate for entry in self._ssl_sni_entries.values())
1317712
public static X500Principal getIssuerX500Principal(X509Certificate cert) {
        try {
            return getX500Principal(cert, true);
        } catch (Exception e) {
            throw new RuntimeException("Could not parse issuer", e);
        }
    }
825967
def get_certificate_generator(self):
        
        for uid, metadata in self.certificates_to_issue.items():
            data_to_issue = self.certificate_handler.get_byte_array_to_issue(metadata)
            yield data_to_issue
1302141
def _are_certificates_identical(self):
        
        sni_cert = self.sni_data.get("Certificate_details")
        non_sni_cert = self.non_sni_data.get("Certificate_details")
        if all(cert for cert in (sni_cert, non_sni_cert) if cert) and sni_cert == non_sni_cert:
            return True
        return
531735
def certificate_issuer_id(self, certificate_issuer_id):
        
        if certificate_issuer_id is None:
            raise ValueError("Invalid value for `certificate_issuer_id`, must not be `None`")
        if certificate_issuer_id is not None and len(certificate_issuer_id) > 32:
            raise ValueError("Invalid value for `certificate_issuer_id`, length must be less than or equal to `32`")

        self._certificate_issuer_id = certificate_issuer_id
359150
async def certifiers_of(client: Client, search: str) -> dict:
    
    return await client.get(MODULE + '/certifiers-of/%s' % search, schema=CERTIFICATIONS_SCHEMA)
161482
public static boolean isSelfIssued(X509Certificate cert) {
        X500Principal subject = cert.getSubjectX500Principal();
        X500Principal issuer = cert.getIssuerX500Principal();
        return subject.equals(issuer);
    }
126973
function (pem) {
      var certificate = forge.pki.certificateFromPem(pem);
      var issuerCert = caStore.getIssuer(certificate);
      if (issuerCert) {
        try {
          return issuerCert.verify(certificate);
        } catch (e) {
          return false;
        }
      }
      return false;
    }
54161
def validate(self):
        """"""

        if not self.server.enabled:

            if self.security.signature_certificate_file is self.security.defaults['signature_certificate_file']:
                print("ISSUE: If you are not configuring a server, you need to set 'signature_certificate_file'")

            if self.security.signature_private_key_file is self.security.defaults['signature_private_key_file']:
                print("ISSUE: If you are not configuring a server, you need to set 'signature_private_key_file'")

        else:

            if self.client.enabled:
                print("ISSUE: Client and server enabled at the same time?")

            if self.server.protocol is self.server.defaults['protocol']:
                if self.server.server_certificate_file is self.server.defaults['server_certificate_file'] or \
                                self.server.server_private_key_file is self.server.defaults['server_private_key_file']:
                   print("ISSUE: 'server_certificate_file' and/or 'server_private_key_file' are not configured and will be auto-generated.")


            if self.server.certification_authority_certificate_file is self.server.defaults['certification_authority_certificate_file'] or \
                            self.server.certification_authority_private_key_file is self.server.defaults['certification_authority_private_key_file']:
                print("ISSUE: 'certification_authority_certificate_file' and/or 'certification_authority_private_key_file' are not configured and will be auto-generated - this is NOT recommended.")

            if self.server.authentication_script is self.server.defaults['authentication_script']:
                print("ISSUE: No 'authentication_script' has been provided and all authentication requests will be rejected!")

        if self.client.enabled:

            if self.client.server_endpoint is self.client.defaults['server_endpoint']:
                print("ISSUE: You are running in client mode, but you are using a default server address.")

            if not self.client.disable_peer_verification is self.client.defaults['disable_peer_verification'] or \
                    not self.client.disable_host_verification is self.client.defaults['disable_host_verification']:
                print("ISSUE: Disabling peer/host verification is NOT recommended - AT ALL.")

            if self.client.username is self.client.defaults['username'] or \
                            self.client.password is self.client.defaults['password']:
                print("ISSUE: No username and/or password has been configured for a client.")

        if self.fscp.contact is self.fscp.defaults['contact']:

            if not self.server.enabled and not self.client.enabled:
                print("ISSUE: You have not defined any contact points while you are neither running as server nor client.")

        ## hostname_resolution_protocol=ipv4/ipv6
        ## ipv4_address_prefix_length=9.0.0.1/24
        ## ipv6_address_prefix_length=2aa1::1/8

        if self.security.authority_certificate_file is self.security.defaults['authority_certificate_file']:
            print("ISSUE: You need to set 'authority_certificate_file'")

        if self.tap_adapter.ipv4_address_prefix_length is self.tap_adapter.defaults['ipv4_address_prefix_length']:
            print("ISSUE: You are using the default network address - make sure you set a different ip for every machine 'ipv4_address_prefix_length'")
714361
public function issuers_table($issuers) {
        global $CFG;

        $table = new html_table();
        $table->head  = [
            get_string('name'),
            get_string('configuredstatus', 'tool_oauth2'),
            get_string('loginissuer', 'tool_oauth2'),
            get_string('discoverystatus', 'tool_oauth2') . ' ' . $this->help_icon('discovered', 'tool_oauth2'),
            get_string('systemauthstatus', 'tool_oauth2') . ' ' . $this->help_icon('systemaccountconnected', 'tool_oauth2'),
            get_string('edit'),
        ];
        $table->attributes['class'] = 'admintable generaltable';
        $data = [];

        $index = 0;

        foreach ($issuers as $issuer) {
            // We need to handle the first and last ones specially.
            $first = false;
            if ($index == 0) {
                $first = true;
            }
            $last = false;
            if ($index == count($issuers) - 1) {
                $last = true;
            }

            // Name.
            $name = $issuer->get('name');
            $image = $issuer->get('image');
            if ($image) {
                $name = '<img width="24" height="24" alt="" src="' . s($image) . '"> ' . s($name);
            }
            $namecell = new html_table_cell($name);
            $namecell->header = true;

            // Configured.
            if ($issuer->is_configured()) {
                $configured = $this->pix_icon('yes', get_string('configured', 'tool_oauth2'), 'tool_oauth2');
            } else {
                $configured = $this->pix_icon('no', get_string('notconfigured', 'tool_oauth2'), 'tool_oauth2');
            }
            $configuredstatuscell = new html_table_cell($configured);

            // Login issuer.
            if (!empty($issuer->get('showonloginpage'))) {
                $loginissuer = $this->pix_icon('yes', get_string('loginissuer', 'tool_oauth2'), 'tool_oauth2');
            } else {
                $loginissuer = $this->pix_icon('no', get_string('notloginissuer', 'tool_oauth2'), 'tool_oauth2');
            }
            $loginissuerstatuscell = new html_table_cell($loginissuer);

            // Discovered.
            if (!empty($issuer->get('scopessupported'))) {
                $discovered = $this->pix_icon('yes', get_string('discovered', 'tool_oauth2'), 'tool_oauth2');
            } else {
                if (!empty($issuer->get_endpoint_url('discovery'))) {
                    $discovered = $this->pix_icon('no', get_string('notdiscovered', 'tool_oauth2'), 'tool_oauth2');
                } else {
                    $discovered = '-';
                }
            }

            $discoverystatuscell = new html_table_cell($discovered);

            // Connected.
            if ($issuer->is_system_account_connected()) {
                $systemaccount = \core\oauth2\api::get_system_account($issuer);
                $systemauth = s($systemaccount->get('email')) . ' (' . s($systemaccount->get('username')). ') ';
                $systemauth .= $this->pix_icon('yes', get_string('systemaccountconnected', 'tool_oauth2'), 'tool_oauth2');
            } else {
                $systemauth = $this->pix_icon('no', get_string('systemaccountnotconnected', 'tool_oauth2'), 'tool_oauth2');
            }

            $params = ['id' => $issuer->get('id'), 'action' => 'auth'];
            $authurl = new moodle_url('/admin/tool/oauth2/issuers.php', $params);
            $icon = $this->pix_icon('auth', get_string('connectsystemaccount', 'tool_oauth2'), 'tool_oauth2');
            $authlink = html_writer::link($authurl, $icon);
            $systemauth .= ' ' . $authlink;

            $systemauthstatuscell = new html_table_cell($systemauth);

            $links = '';
            // Action links.
            $editurl = new moodle_url('/admin/tool/oauth2/issuers.php', ['id' => $issuer->get('id'), 'action' => 'edit']);
            $editlink = html_writer::link($editurl, $this->pix_icon('t/edit', get_string('edit')));
            $links .= ' ' . $editlink;

            // Endpoints.
            $editendpointsurl = new moodle_url('/admin/tool/oauth2/endpoints.php', ['issuerid' => $issuer->get('id')]);
            $str = get_string('editendpoints', 'tool_oauth2');
            $editendpointlink = html_writer::link($editendpointsurl, $this->pix_icon('t/viewdetails', $str));
            $links .= ' ' . $editendpointlink;

            // User field mapping.
            $params = ['issuerid' => $issuer->get('id')];
            $edituserfieldmappingsurl = new moodle_url('/admin/tool/oauth2/userfieldmappings.php', $params);
            $str = get_string('edituserfieldmappings', 'tool_oauth2');
            $edituserfieldmappinglink = html_writer::link($edituserfieldmappingsurl, $this->pix_icon('t/user', $str));
            $links .= ' ' . $edituserfieldmappinglink;

            // Delete.
            $deleteurl = new moodle_url('/admin/tool/oauth2/issuers.php', ['id' => $issuer->get('id'), 'action' => 'delete']);
            $deletelink = html_writer::link($deleteurl, $this->pix_icon('t/delete', get_string('delete')));
            $links .= ' ' . $deletelink;
            // Enable / Disable.
            if ($issuer->get('enabled')) {
                // Disable.
                $disableparams = ['id' => $issuer->get('id'), 'sesskey' => sesskey(), 'action' => 'disable'];
                $disableurl = new moodle_url('/admin/tool/oauth2/issuers.php', $disableparams);
                $disablelink = html_writer::link($disableurl, $this->pix_icon('t/hide', get_string('disable')));
                $links .= ' ' . $disablelink;
            } else {
                // Enable.
                $enableparams = ['id' => $issuer->get('id'), 'sesskey' => sesskey(), 'action' => 'enable'];
                $enableurl = new moodle_url('/admin/tool/oauth2/issuers.php', $enableparams);
                $enablelink = html_writer::link($enableurl, $this->pix_icon('t/show', get_string('enable')));
                $links .= ' ' . $enablelink;
            }
            if (!$last) {
                // Move down.
                $params = ['id' => $issuer->get('id'), 'action' => 'movedown', 'sesskey' => sesskey()];
                $movedownurl = new moodle_url('/admin/tool/oauth2/issuers.php', $params);
                $movedownlink = html_writer::link($movedownurl, $this->pix_icon('t/down', get_string('movedown')));
                $links .= ' ' . $movedownlink;
            }
            if (!$first) {
                // Move up.
                $params = ['id' => $issuer->get('id'), 'action' => 'moveup', 'sesskey' => sesskey()];
                $moveupurl = new moodle_url('/admin/tool/oauth2/issuers.php', $params);
                $moveuplink = html_writer::link($moveupurl, $this->pix_icon('t/up', get_string('moveup')));
                $links .= ' ' . $moveuplink;
            }

            $editcell = new html_table_cell($links);

            $row = new html_table_row([
                $namecell,
                $configuredstatuscell,
                $loginissuerstatuscell,
                $discoverystatuscell,
                $systemauthstatuscell,
                $editcell,
            ]);

            $data[] = $row;
            $index++;
        }
        $table->data = $data;
        return html_writer::table($table);
    }
203205
def configure(cert)
      cert.version = 2
      cert.serial = serial
      cert.subject = OpenSSL::X509::Name.parse(name)
      cert.issuer = cert.subject
      cert.public_key = key.public_key
      cert.not_before = days_ago(2)
      cert.not_after = days_from_now(2)
    end