id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
190,300 | sop/x509 | lib/X509/AttributeCertificate/Validation/ACValidator.php | ACValidator._hasMatchingTarget | private function _hasMatchingTarget(Targets $targets): bool
{
foreach ($this->_config->targets() as $target) {
if ($targets->hasTarget($target)) {
return true;
}
}
return false;
} | php | private function _hasMatchingTarget(Targets $targets): bool
{
foreach ($this->_config->targets() as $target) {
if ($targets->hasTarget($target)) {
return true;
}
}
return false;
} | [
"private",
"function",
"_hasMatchingTarget",
"(",
"Targets",
"$",
"targets",
")",
":",
"bool",
"{",
"foreach",
"(",
"$",
"this",
"->",
"_config",
"->",
"targets",
"(",
")",
"as",
"$",
"target",
")",
"{",
"if",
"(",
"$",
"targets",
"->",
"hasTarget",
"(... | Check whether validation configuration has matching targets.
@param Targets $targets Set of eligible targets
@return boolean | [
"Check",
"whether",
"validation",
"configuration",
"has",
"matching",
"targets",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/AttributeCertificate/Validation/ACValidator.php#L189-L197 |
190,301 | phpsec/phpSec | lib/phpSec/Store/Pdo.php | Pdo.parseDsn | private function parseDsn($dsn) {
$parsed = array();
$typeEnd = strpos($dsn, ':');
$dbType = substr($dsn, 0, $typeEnd);
$parsed['dbtype'] = $dbType;
$dsn = substr($dsn, $typeEnd+1);
$parts = explode(';', $dsn);
foreach($parts as $part) {
list($key, $val) = explode('=', $part);
... | php | private function parseDsn($dsn) {
$parsed = array();
$typeEnd = strpos($dsn, ':');
$dbType = substr($dsn, 0, $typeEnd);
$parsed['dbtype'] = $dbType;
$dsn = substr($dsn, $typeEnd+1);
$parts = explode(';', $dsn);
foreach($parts as $part) {
list($key, $val) = explode('=', $part);
... | [
"private",
"function",
"parseDsn",
"(",
"$",
"dsn",
")",
"{",
"$",
"parsed",
"=",
"array",
"(",
")",
";",
"$",
"typeEnd",
"=",
"strpos",
"(",
"$",
"dsn",
",",
"':'",
")",
";",
"$",
"dbType",
"=",
"substr",
"(",
"$",
"dsn",
",",
"0",
",",
"$",
... | Extract configuration variables from the DSN.
@param string $dsn
DSN to extract variables from.
@return array
Returns an array with variable names as keys with corresponding values. | [
"Extract",
"configuration",
"variables",
"from",
"the",
"DSN",
"."
] | 653e9cada38ae7f6debc3cce0d3a17402c715588 | https://github.com/phpsec/phpSec/blob/653e9cada38ae7f6debc3cce0d3a17402c715588/lib/phpSec/Store/Pdo.php#L256-L272 |
190,302 | sop/x509 | lib/X509/AttributeCertificate/IssuerSerial.php | IssuerSerial.fromPKC | public static function fromPKC(Certificate $cert): IssuerSerial
{
$tbsCert = $cert->tbsCertificate();
$issuer = new GeneralNames(new DirectoryName($tbsCert->issuer()));
$serial = $tbsCert->serialNumber();
$uid = $tbsCert->hasIssuerUniqueID() ? $tbsCert->issuerUniqueID() : null;
... | php | public static function fromPKC(Certificate $cert): IssuerSerial
{
$tbsCert = $cert->tbsCertificate();
$issuer = new GeneralNames(new DirectoryName($tbsCert->issuer()));
$serial = $tbsCert->serialNumber();
$uid = $tbsCert->hasIssuerUniqueID() ? $tbsCert->issuerUniqueID() : null;
... | [
"public",
"static",
"function",
"fromPKC",
"(",
"Certificate",
"$",
"cert",
")",
":",
"IssuerSerial",
"{",
"$",
"tbsCert",
"=",
"$",
"cert",
"->",
"tbsCertificate",
"(",
")",
";",
"$",
"issuer",
"=",
"new",
"GeneralNames",
"(",
"new",
"DirectoryName",
"(",... | Initialize from a public key certificate.
@param Certificate $cert
@return self | [
"Initialize",
"from",
"a",
"public",
"key",
"certificate",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/AttributeCertificate/IssuerSerial.php#L83-L90 |
190,303 | sop/x509 | lib/X509/AttributeCertificate/IssuerSerial.php | IssuerSerial.identifiesPKC | public function identifiesPKC(Certificate $cert): bool
{
$tbs = $cert->tbsCertificate();
if (!$tbs->issuer()->equals($this->_issuer->firstDN())) {
return false;
}
if (strval($tbs->serialNumber()) != strval($this->_serial)) {
return false;
}
if ... | php | public function identifiesPKC(Certificate $cert): bool
{
$tbs = $cert->tbsCertificate();
if (!$tbs->issuer()->equals($this->_issuer->firstDN())) {
return false;
}
if (strval($tbs->serialNumber()) != strval($this->_serial)) {
return false;
}
if ... | [
"public",
"function",
"identifiesPKC",
"(",
"Certificate",
"$",
"cert",
")",
":",
"bool",
"{",
"$",
"tbs",
"=",
"$",
"cert",
"->",
"tbsCertificate",
"(",
")",
";",
"if",
"(",
"!",
"$",
"tbs",
"->",
"issuer",
"(",
")",
"->",
"equals",
"(",
"$",
"thi... | Check whether this IssuerSerial identifies given certificate.
@param Certificate $cert
@return boolean | [
"Check",
"whether",
"this",
"IssuerSerial",
"identifies",
"given",
"certificate",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/AttributeCertificate/IssuerSerial.php#L156-L169 |
190,304 | sop/x509 | lib/X509/AttributeCertificate/IssuerSerial.php | IssuerSerial._checkUniqueID | private function _checkUniqueID(Certificate $cert): bool
{
if (!$cert->tbsCertificate()->hasIssuerUniqueID()) {
return false;
}
$uid = $cert->tbsCertificate()
->issuerUniqueID()
->string();
if ($this->_issuerUID->string() != $uid) {
ret... | php | private function _checkUniqueID(Certificate $cert): bool
{
if (!$cert->tbsCertificate()->hasIssuerUniqueID()) {
return false;
}
$uid = $cert->tbsCertificate()
->issuerUniqueID()
->string();
if ($this->_issuerUID->string() != $uid) {
ret... | [
"private",
"function",
"_checkUniqueID",
"(",
"Certificate",
"$",
"cert",
")",
":",
"bool",
"{",
"if",
"(",
"!",
"$",
"cert",
"->",
"tbsCertificate",
"(",
")",
"->",
"hasIssuerUniqueID",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"uid",
"=",... | Check whether issuerUID matches given certificate.
@param Certificate $cert
@return boolean | [
"Check",
"whether",
"issuerUID",
"matches",
"given",
"certificate",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/AttributeCertificate/IssuerSerial.php#L177-L189 |
190,305 | sop/x509 | lib/X509/CertificationPath/Policy/PolicyNode.php | PolicyNode.hasChildWithValidPolicy | public function hasChildWithValidPolicy(string $oid): bool
{
foreach ($this->_children as $node) {
if ($node->validPolicy() == $oid) {
return true;
}
}
return false;
} | php | public function hasChildWithValidPolicy(string $oid): bool
{
foreach ($this->_children as $node) {
if ($node->validPolicy() == $oid) {
return true;
}
}
return false;
} | [
"public",
"function",
"hasChildWithValidPolicy",
"(",
"string",
"$",
"oid",
")",
":",
"bool",
"{",
"foreach",
"(",
"$",
"this",
"->",
"_children",
"as",
"$",
"node",
")",
"{",
"if",
"(",
"$",
"node",
"->",
"validPolicy",
"(",
")",
"==",
"$",
"oid",
"... | Check whether node has a child node with given valid policy OID.
@param string $oid
@return boolean | [
"Check",
"whether",
"node",
"has",
"a",
"child",
"node",
"with",
"given",
"valid",
"policy",
"OID",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/CertificationPath/Policy/PolicyNode.php#L146-L154 |
190,306 | sop/x509 | lib/X509/CertificationPath/Policy/PolicyNode.php | PolicyNode.addChild | public function addChild(PolicyNode $node): self
{
$id = spl_object_hash($node);
$node->_parent = $this;
$this->_children[$id] = $node;
return $this;
} | php | public function addChild(PolicyNode $node): self
{
$id = spl_object_hash($node);
$node->_parent = $this;
$this->_children[$id] = $node;
return $this;
} | [
"public",
"function",
"addChild",
"(",
"PolicyNode",
"$",
"node",
")",
":",
"self",
"{",
"$",
"id",
"=",
"spl_object_hash",
"(",
"$",
"node",
")",
";",
"$",
"node",
"->",
"_parent",
"=",
"$",
"this",
";",
"$",
"this",
"->",
"_children",
"[",
"$",
"... | Add child node.
@param PolicyNode $node
@return self | [
"Add",
"child",
"node",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/CertificationPath/Policy/PolicyNode.php#L162-L168 |
190,307 | sop/x509 | lib/X509/CertificationPath/Policy/PolicyNode.php | PolicyNode.remove | public function remove(): self
{
if ($this->_parent) {
$id = spl_object_hash($this);
unset($this->_parent->_children[$id]);
unset($this->_parent);
}
return $this;
} | php | public function remove(): self
{
if ($this->_parent) {
$id = spl_object_hash($this);
unset($this->_parent->_children[$id]);
unset($this->_parent);
}
return $this;
} | [
"public",
"function",
"remove",
"(",
")",
":",
"self",
"{",
"if",
"(",
"$",
"this",
"->",
"_parent",
")",
"{",
"$",
"id",
"=",
"spl_object_hash",
"(",
"$",
"this",
")",
";",
"unset",
"(",
"$",
"this",
"->",
"_parent",
"->",
"_children",
"[",
"$",
... | Remove this node from the tree.
@return self The removed node | [
"Remove",
"this",
"node",
"from",
"the",
"tree",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/CertificationPath/Policy/PolicyNode.php#L185-L193 |
190,308 | sop/x509 | lib/X509/CertificationPath/Policy/PolicyNode.php | PolicyNode.parents | public function parents(): array
{
if (!$this->_parent) {
return array();
}
$nodes = $this->_parent->parents();
$nodes[] = $this->_parent;
return array_reverse($nodes);
} | php | public function parents(): array
{
if (!$this->_parent) {
return array();
}
$nodes = $this->_parent->parents();
$nodes[] = $this->_parent;
return array_reverse($nodes);
} | [
"public",
"function",
"parents",
"(",
")",
":",
"array",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_parent",
")",
"{",
"return",
"array",
"(",
")",
";",
"}",
"$",
"nodes",
"=",
"$",
"this",
"->",
"_parent",
"->",
"parents",
"(",
")",
";",
"$",
"... | Get chain of parent nodes from this node's parent to the root node.
@return PolicyNode[] | [
"Get",
"chain",
"of",
"parent",
"nodes",
"from",
"this",
"node",
"s",
"parent",
"to",
"the",
"root",
"node",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/CertificationPath/Policy/PolicyNode.php#L220-L228 |
190,309 | sop/x509 | lib/X509/CertificationPath/Policy/PolicyNode.php | PolicyNode.walkNodes | public function walkNodes(callable $fn)
{
foreach ($this->_children as $node) {
$node->walkNodes($fn);
}
$fn($this);
} | php | public function walkNodes(callable $fn)
{
foreach ($this->_children as $node) {
$node->walkNodes($fn);
}
$fn($this);
} | [
"public",
"function",
"walkNodes",
"(",
"callable",
"$",
"fn",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"_children",
"as",
"$",
"node",
")",
"{",
"$",
"node",
"->",
"walkNodes",
"(",
"$",
"fn",
")",
";",
"}",
"$",
"fn",
"(",
"$",
"this",
")",... | Walk tree from this node, applying a callback for each node.
Nodes are traversed depth-first and callback shall be applied post-order.
@param callable $fn | [
"Walk",
"tree",
"from",
"this",
"node",
"applying",
"a",
"callback",
"for",
"each",
"node",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/CertificationPath/Policy/PolicyNode.php#L237-L243 |
190,310 | sop/x509 | lib/X509/CertificationPath/Policy/PolicyNode.php | PolicyNode.nodeCount | public function nodeCount(): int
{
$c = 1;
foreach ($this->_children as $child) {
$c += $child->nodeCount();
}
return $c;
} | php | public function nodeCount(): int
{
$c = 1;
foreach ($this->_children as $child) {
$c += $child->nodeCount();
}
return $c;
} | [
"public",
"function",
"nodeCount",
"(",
")",
":",
"int",
"{",
"$",
"c",
"=",
"1",
";",
"foreach",
"(",
"$",
"this",
"->",
"_children",
"as",
"$",
"child",
")",
"{",
"$",
"c",
"+=",
"$",
"child",
"->",
"nodeCount",
"(",
")",
";",
"}",
"return",
... | Get the total number of nodes in a tree.
@return int | [
"Get",
"the",
"total",
"number",
"of",
"nodes",
"in",
"a",
"tree",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/CertificationPath/Policy/PolicyNode.php#L250-L257 |
190,311 | sop/x509 | lib/X509/Certificate/TBSCertificate.php | TBSCertificate.fromCSR | public static function fromCSR(CertificationRequest $cr): self
{
$cri = $cr->certificationRequestInfo();
$tbs_cert = new self($cri->subject(), $cri->subjectPKInfo(), new Name(),
Validity::fromStrings(null, null));
// if CSR has Extension Request attribute
if ($cri->hasAtt... | php | public static function fromCSR(CertificationRequest $cr): self
{
$cri = $cr->certificationRequestInfo();
$tbs_cert = new self($cri->subject(), $cri->subjectPKInfo(), new Name(),
Validity::fromStrings(null, null));
// if CSR has Extension Request attribute
if ($cri->hasAtt... | [
"public",
"static",
"function",
"fromCSR",
"(",
"CertificationRequest",
"$",
"cr",
")",
":",
"self",
"{",
"$",
"cri",
"=",
"$",
"cr",
"->",
"certificationRequestInfo",
"(",
")",
";",
"$",
"tbs_cert",
"=",
"new",
"self",
"(",
"$",
"cri",
"->",
"subject",
... | Initialize from certification request.
Note that signature is not verified and must be done by the caller.
@param CertificationRequest $cr
@return self | [
"Initialize",
"from",
"certification",
"request",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Certificate/TBSCertificate.php#L186-L206 |
190,312 | sop/x509 | lib/X509/Certificate/TBSCertificate.php | TBSCertificate.withIssuerCertificate | public function withIssuerCertificate(Certificate $cert): self
{
$obj = clone $this;
// set issuer DN from cert's subject
$obj->_issuer = $cert->tbsCertificate()->subject();
// add authority key identifier extension
$key_id = $cert->tbsCertificate()
->subjectPubli... | php | public function withIssuerCertificate(Certificate $cert): self
{
$obj = clone $this;
// set issuer DN from cert's subject
$obj->_issuer = $cert->tbsCertificate()->subject();
// add authority key identifier extension
$key_id = $cert->tbsCertificate()
->subjectPubli... | [
"public",
"function",
"withIssuerCertificate",
"(",
"Certificate",
"$",
"cert",
")",
":",
"self",
"{",
"$",
"obj",
"=",
"clone",
"$",
"this",
";",
"// set issuer DN from cert's subject",
"$",
"obj",
"->",
"_issuer",
"=",
"$",
"cert",
"->",
"tbsCertificate",
"(... | Get self with fields set from the issuer's certificate.
Issuer shall be set to issuing certificate's subject.
Authority key identifier extensions shall be added with a key identifier
set to issuing certificate's public key identifier.
@param Certificate $cert Issuing party's certificate
@return self | [
"Get",
"self",
"with",
"fields",
"set",
"from",
"the",
"issuer",
"s",
"certificate",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Certificate/TBSCertificate.php#L218-L230 |
190,313 | sop/x509 | lib/X509/Certificate/TBSCertificate.php | TBSCertificate.withVersion | public function withVersion(int $version): self
{
$obj = clone $this;
$obj->_version = $version;
return $obj;
} | php | public function withVersion(int $version): self
{
$obj = clone $this;
$obj->_version = $version;
return $obj;
} | [
"public",
"function",
"withVersion",
"(",
"int",
"$",
"version",
")",
":",
"self",
"{",
"$",
"obj",
"=",
"clone",
"$",
"this",
";",
"$",
"obj",
"->",
"_version",
"=",
"$",
"version",
";",
"return",
"$",
"obj",
";",
"}"
] | Get self with given version.
If version is not set, appropriate version is automatically
determined during signing.
@param int $version
@return self | [
"Get",
"self",
"with",
"given",
"version",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Certificate/TBSCertificate.php#L241-L246 |
190,314 | sop/x509 | lib/X509/Certificate/TBSCertificate.php | TBSCertificate.withIssuer | public function withIssuer(Name $issuer): self
{
$obj = clone $this;
$obj->_issuer = $issuer;
return $obj;
} | php | public function withIssuer(Name $issuer): self
{
$obj = clone $this;
$obj->_issuer = $issuer;
return $obj;
} | [
"public",
"function",
"withIssuer",
"(",
"Name",
"$",
"issuer",
")",
":",
"self",
"{",
"$",
"obj",
"=",
"clone",
"$",
"this",
";",
"$",
"obj",
"->",
"_issuer",
"=",
"$",
"issuer",
";",
"return",
"$",
"obj",
";",
"}"
] | Get self with given issuer.
@param Name $issuer
@return self | [
"Get",
"self",
"with",
"given",
"issuer",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Certificate/TBSCertificate.php#L297-L302 |
190,315 | sop/x509 | lib/X509/Certificate/TBSCertificate.php | TBSCertificate.withValidity | public function withValidity(Validity $validity): self
{
$obj = clone $this;
$obj->_validity = $validity;
return $obj;
} | php | public function withValidity(Validity $validity): self
{
$obj = clone $this;
$obj->_validity = $validity;
return $obj;
} | [
"public",
"function",
"withValidity",
"(",
"Validity",
"$",
"validity",
")",
":",
"self",
"{",
"$",
"obj",
"=",
"clone",
"$",
"this",
";",
"$",
"obj",
"->",
"_validity",
"=",
"$",
"validity",
";",
"return",
"$",
"obj",
";",
"}"
] | Get self with given validity.
@param Validity $validity
@return self | [
"Get",
"self",
"with",
"given",
"validity",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Certificate/TBSCertificate.php#L310-L315 |
190,316 | sop/x509 | lib/X509/Certificate/TBSCertificate.php | TBSCertificate.withSubjectPublicKeyInfo | public function withSubjectPublicKeyInfo(PublicKeyInfo $pub_key_info): self
{
$obj = clone $this;
$obj->_subjectPublicKeyInfo = $pub_key_info;
return $obj;
} | php | public function withSubjectPublicKeyInfo(PublicKeyInfo $pub_key_info): self
{
$obj = clone $this;
$obj->_subjectPublicKeyInfo = $pub_key_info;
return $obj;
} | [
"public",
"function",
"withSubjectPublicKeyInfo",
"(",
"PublicKeyInfo",
"$",
"pub_key_info",
")",
":",
"self",
"{",
"$",
"obj",
"=",
"clone",
"$",
"this",
";",
"$",
"obj",
"->",
"_subjectPublicKeyInfo",
"=",
"$",
"pub_key_info",
";",
"return",
"$",
"obj",
";... | Get self with given subject public key info.
@param PublicKeyInfo $pub_key_info
@return self | [
"Get",
"self",
"with",
"given",
"subject",
"public",
"key",
"info",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Certificate/TBSCertificate.php#L336-L341 |
190,317 | sop/x509 | lib/X509/Certificate/TBSCertificate.php | TBSCertificate.withIssuerUniqueID | public function withIssuerUniqueID(UniqueIdentifier $id): self
{
$obj = clone $this;
$obj->_issuerUniqueID = $id;
return $obj;
} | php | public function withIssuerUniqueID(UniqueIdentifier $id): self
{
$obj = clone $this;
$obj->_issuerUniqueID = $id;
return $obj;
} | [
"public",
"function",
"withIssuerUniqueID",
"(",
"UniqueIdentifier",
"$",
"id",
")",
":",
"self",
"{",
"$",
"obj",
"=",
"clone",
"$",
"this",
";",
"$",
"obj",
"->",
"_issuerUniqueID",
"=",
"$",
"id",
";",
"return",
"$",
"obj",
";",
"}"
] | Get self with issuer unique ID.
@param UniqueIdentifier $id
@return self | [
"Get",
"self",
"with",
"issuer",
"unique",
"ID",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Certificate/TBSCertificate.php#L349-L354 |
190,318 | sop/x509 | lib/X509/Certificate/TBSCertificate.php | TBSCertificate.withSubjectUniqueID | public function withSubjectUniqueID(UniqueIdentifier $id): self
{
$obj = clone $this;
$obj->_subjectUniqueID = $id;
return $obj;
} | php | public function withSubjectUniqueID(UniqueIdentifier $id): self
{
$obj = clone $this;
$obj->_subjectUniqueID = $id;
return $obj;
} | [
"public",
"function",
"withSubjectUniqueID",
"(",
"UniqueIdentifier",
"$",
"id",
")",
":",
"self",
"{",
"$",
"obj",
"=",
"clone",
"$",
"this",
";",
"$",
"obj",
"->",
"_subjectUniqueID",
"=",
"$",
"id",
";",
"return",
"$",
"obj",
";",
"}"
] | Get self with subject unique ID.
@param UniqueIdentifier $id
@return self | [
"Get",
"self",
"with",
"subject",
"unique",
"ID",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Certificate/TBSCertificate.php#L362-L367 |
190,319 | sop/x509 | lib/X509/Certificate/TBSCertificate.php | TBSCertificate.sign | public function sign(SignatureAlgorithmIdentifier $algo,
PrivateKeyInfo $privkey_info, Crypto $crypto = null): Certificate
{
$crypto = $crypto ?: Crypto::getDefault();
$tbs_cert = clone $this;
if (!isset($tbs_cert->_version)) {
$tbs_cert->_version = $tbs_cert->_determineV... | php | public function sign(SignatureAlgorithmIdentifier $algo,
PrivateKeyInfo $privkey_info, Crypto $crypto = null): Certificate
{
$crypto = $crypto ?: Crypto::getDefault();
$tbs_cert = clone $this;
if (!isset($tbs_cert->_version)) {
$tbs_cert->_version = $tbs_cert->_determineV... | [
"public",
"function",
"sign",
"(",
"SignatureAlgorithmIdentifier",
"$",
"algo",
",",
"PrivateKeyInfo",
"$",
"privkey_info",
",",
"Crypto",
"$",
"crypto",
"=",
"null",
")",
":",
"Certificate",
"{",
"$",
"crypto",
"=",
"$",
"crypto",
"?",
":",
"Crypto",
"::",
... | Create signed certificate.
@param SignatureAlgorithmIdentifier $algo Algorithm used for signing
@param PrivateKeyInfo $privkey_info Private key used for signing
@param Crypto|null $crypto Crypto engine, use default if not set
@return Certificate | [
"Create",
"signed",
"certificate",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Certificate/TBSCertificate.php#L602-L617 |
190,320 | sop/x509 | lib/X509/Certificate/TBSCertificate.php | TBSCertificate._determineVersion | protected function _determineVersion(): int
{
// if extensions are present
if (count($this->_extensions)) {
return self::VERSION_3;
}
// if UniqueIdentifier is present
if (isset($this->_issuerUniqueID) || isset($this->_subjectUniqueID)) {
return self::... | php | protected function _determineVersion(): int
{
// if extensions are present
if (count($this->_extensions)) {
return self::VERSION_3;
}
// if UniqueIdentifier is present
if (isset($this->_issuerUniqueID) || isset($this->_subjectUniqueID)) {
return self::... | [
"protected",
"function",
"_determineVersion",
"(",
")",
":",
"int",
"{",
"// if extensions are present",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"_extensions",
")",
")",
"{",
"return",
"self",
"::",
"VERSION_3",
";",
"}",
"// if UniqueIdentifier is present",
... | Determine minimum version for the certificate.
@return int | [
"Determine",
"minimum",
"version",
"for",
"the",
"certificate",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Certificate/TBSCertificate.php#L624-L635 |
190,321 | phpsec/phpSec | lib/phpSec/Common/Session.php | Session.gc | public function gc($ttl) {
$store = $this->psl['store'];
$Ids = $store->listIds('session');
foreach($Ids as $Id) {
$data = $store->meta('session', $Id);
if($data->time + $ttl < time()) {
$store->delete('session', $Id);
}
}
return true;
} | php | public function gc($ttl) {
$store = $this->psl['store'];
$Ids = $store->listIds('session');
foreach($Ids as $Id) {
$data = $store->meta('session', $Id);
if($data->time + $ttl < time()) {
$store->delete('session', $Id);
}
}
return true;
} | [
"public",
"function",
"gc",
"(",
"$",
"ttl",
")",
"{",
"$",
"store",
"=",
"$",
"this",
"->",
"psl",
"[",
"'store'",
"]",
";",
"$",
"Ids",
"=",
"$",
"store",
"->",
"listIds",
"(",
"'session'",
")",
";",
"foreach",
"(",
"$",
"Ids",
"as",
"$",
"Id... | Do garbage collection.
@param integer $ttl
@return bool | [
"Do",
"garbage",
"collection",
"."
] | 653e9cada38ae7f6debc3cce0d3a17402c715588 | https://github.com/phpsec/phpSec/blob/653e9cada38ae7f6debc3cce0d3a17402c715588/lib/phpSec/Common/Session.php#L96-L107 |
190,322 | phpsec/phpSec | lib/phpSec/Common/Session.php | Session.open | public function open($path, $name) {
$rand = $this->psl['crypt/rand'];
/* Set some variables we need later. */
$this->savePath = $path;
$this->name = $name;
$this->keyCookie = $name.'_secret';
/* Set current and new ID. */
if(isset($_COOKIE[$name])) {
$this->currID = $_C... | php | public function open($path, $name) {
$rand = $this->psl['crypt/rand'];
/* Set some variables we need later. */
$this->savePath = $path;
$this->name = $name;
$this->keyCookie = $name.'_secret';
/* Set current and new ID. */
if(isset($_COOKIE[$name])) {
$this->currID = $_C... | [
"public",
"function",
"open",
"(",
"$",
"path",
",",
"$",
"name",
")",
"{",
"$",
"rand",
"=",
"$",
"this",
"->",
"psl",
"[",
"'crypt/rand'",
"]",
";",
"/* Set some variables we need later. */",
"$",
"this",
"->",
"savePath",
"=",
"$",
"path",
";",
"$",
... | Open a session.
@param string $path
@param string $name
@return bool | [
"Open",
"a",
"session",
"."
] | 653e9cada38ae7f6debc3cce0d3a17402c715588 | https://github.com/phpsec/phpSec/blob/653e9cada38ae7f6debc3cce0d3a17402c715588/lib/phpSec/Common/Session.php#L116-L156 |
190,323 | phpsec/phpSec | lib/phpSec/Common/Session.php | Session.read | public function read($id) {
$crypto = $this->psl['crypt/crypto'];
$store = $this->psl['store'];
/* If no cookie is set, just drop it! */
if(!isset($_COOKIE[$this->name])) {
return false;
}
/* Read from store and decrypt. */
try {
$sessData = $store->read('session', $_C... | php | public function read($id) {
$crypto = $this->psl['crypt/crypto'];
$store = $this->psl['store'];
/* If no cookie is set, just drop it! */
if(!isset($_COOKIE[$this->name])) {
return false;
}
/* Read from store and decrypt. */
try {
$sessData = $store->read('session', $_C... | [
"public",
"function",
"read",
"(",
"$",
"id",
")",
"{",
"$",
"crypto",
"=",
"$",
"this",
"->",
"psl",
"[",
"'crypt/crypto'",
"]",
";",
"$",
"store",
"=",
"$",
"this",
"->",
"psl",
"[",
"'store'",
"]",
";",
"/* If no cookie is set, just drop it! */",
"if"... | Read and decrypt a session.
@param string $id
@return mixed | [
"Read",
"and",
"decrypt",
"a",
"session",
"."
] | 653e9cada38ae7f6debc3cce0d3a17402c715588 | https://github.com/phpsec/phpSec/blob/653e9cada38ae7f6debc3cce0d3a17402c715588/lib/phpSec/Common/Session.php#L164-L186 |
190,324 | phpsec/phpSec | lib/phpSec/Common/Session.php | Session.write | public function write($id , $data) {
$crypto = $this->psl['crypt/crypto'];
$store = $this->psl['store'];
/* Encrypt session. */
try {
$crypto->_algo = $this->cryptAlgo;
$crypto->_mode = $this->cryptMode;
$encrypted = $crypto->encrypt($data, $this->secret);
/* Destroy old... | php | public function write($id , $data) {
$crypto = $this->psl['crypt/crypto'];
$store = $this->psl['store'];
/* Encrypt session. */
try {
$crypto->_algo = $this->cryptAlgo;
$crypto->_mode = $this->cryptMode;
$encrypted = $crypto->encrypt($data, $this->secret);
/* Destroy old... | [
"public",
"function",
"write",
"(",
"$",
"id",
",",
"$",
"data",
")",
"{",
"$",
"crypto",
"=",
"$",
"this",
"->",
"psl",
"[",
"'crypt/crypto'",
"]",
";",
"$",
"store",
"=",
"$",
"this",
"->",
"psl",
"[",
"'store'",
"]",
";",
"/* Encrypt session. */",... | Encrypt and save a session.
@param string $id
@param string $data
@return bool | [
"Encrypt",
"and",
"save",
"a",
"session",
"."
] | 653e9cada38ae7f6debc3cce0d3a17402c715588 | https://github.com/phpsec/phpSec/blob/653e9cada38ae7f6debc3cce0d3a17402c715588/lib/phpSec/Common/Session.php#L195-L215 |
190,325 | phpsec/phpSec | lib/phpSec/Common/Session.php | Session.setSecret | public function setSecret() {
$rand = $this->psl['crypt/rand'];
$this->secret = $rand->bytes(32);
$cookieParam = session_get_cookie_params();
setcookie(
$this->keyCookie,
base64_encode($this->secret),
$cookieParam['lifetime'],
$cookieParam['path'],
$cooki... | php | public function setSecret() {
$rand = $this->psl['crypt/rand'];
$this->secret = $rand->bytes(32);
$cookieParam = session_get_cookie_params();
setcookie(
$this->keyCookie,
base64_encode($this->secret),
$cookieParam['lifetime'],
$cookieParam['path'],
$cooki... | [
"public",
"function",
"setSecret",
"(",
")",
"{",
"$",
"rand",
"=",
"$",
"this",
"->",
"psl",
"[",
"'crypt/rand'",
"]",
";",
"$",
"this",
"->",
"secret",
"=",
"$",
"rand",
"->",
"bytes",
"(",
"32",
")",
";",
"$",
"cookieParam",
"=",
"session_get_cook... | Set the cookie with the secret.
@return true | [
"Set",
"the",
"cookie",
"with",
"the",
"secret",
"."
] | 653e9cada38ae7f6debc3cce0d3a17402c715588 | https://github.com/phpsec/phpSec/blob/653e9cada38ae7f6debc3cce0d3a17402c715588/lib/phpSec/Common/Session.php#L222-L237 |
190,326 | sop/x509 | lib/X509/Certificate/CertificateChain.php | CertificateChain.fromPEMs | public static function fromPEMs(PEM ...$pems): self
{
$certs = array_map(
function (PEM $pem) {
return Certificate::fromPEM($pem);
}, $pems);
return new self(...$certs);
} | php | public static function fromPEMs(PEM ...$pems): self
{
$certs = array_map(
function (PEM $pem) {
return Certificate::fromPEM($pem);
}, $pems);
return new self(...$certs);
} | [
"public",
"static",
"function",
"fromPEMs",
"(",
"PEM",
"...",
"$",
"pems",
")",
":",
"self",
"{",
"$",
"certs",
"=",
"array_map",
"(",
"function",
"(",
"PEM",
"$",
"pem",
")",
"{",
"return",
"Certificate",
"::",
"fromPEM",
"(",
"$",
"pem",
")",
";",... | Initialize from a list of PEMs.
@param PEM ...$pems
@return self | [
"Initialize",
"from",
"a",
"list",
"of",
"PEMs",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Certificate/CertificateChain.php#L39-L46 |
190,327 | sop/x509 | lib/X509/Certificate/CertificateChain.php | CertificateChain.fromPEMString | public static function fromPEMString(string $str): self
{
$pems = PEMBundle::fromString($str)->all();
return self::fromPEMs(...$pems);
} | php | public static function fromPEMString(string $str): self
{
$pems = PEMBundle::fromString($str)->all();
return self::fromPEMs(...$pems);
} | [
"public",
"static",
"function",
"fromPEMString",
"(",
"string",
"$",
"str",
")",
":",
"self",
"{",
"$",
"pems",
"=",
"PEMBundle",
"::",
"fromString",
"(",
"$",
"str",
")",
"->",
"all",
"(",
")",
";",
"return",
"self",
"::",
"fromPEMs",
"(",
"...",
"$... | Initialize from a string containing multiple PEM blocks.
@param string $str
@return self | [
"Initialize",
"from",
"a",
"string",
"containing",
"multiple",
"PEM",
"blocks",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Certificate/CertificateChain.php#L54-L58 |
190,328 | sop/x509 | lib/X509/Certificate/CertificateChain.php | CertificateChain.trustAnchorCertificate | public function trustAnchorCertificate(): Certificate
{
if (!count($this->_certs)) {
throw new \LogicException("No certificates.");
}
return $this->_certs[count($this->_certs) - 1];
} | php | public function trustAnchorCertificate(): Certificate
{
if (!count($this->_certs)) {
throw new \LogicException("No certificates.");
}
return $this->_certs[count($this->_certs) - 1];
} | [
"public",
"function",
"trustAnchorCertificate",
"(",
")",
":",
"Certificate",
"{",
"if",
"(",
"!",
"count",
"(",
"$",
"this",
"->",
"_certs",
")",
")",
"{",
"throw",
"new",
"\\",
"LogicException",
"(",
"\"No certificates.\"",
")",
";",
"}",
"return",
"$",
... | Get the trust anchor certificate.
@throws \LogicException
@return Certificate | [
"Get",
"the",
"trust",
"anchor",
"certificate",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Certificate/CertificateChain.php#L91-L97 |
190,329 | sop/x509 | lib/X509/Certificate/CertificateChain.php | CertificateChain.toPEMString | public function toPEMString(): string
{
return implode("\n",
array_map(
function (Certificate $cert) {
return $cert->toPEM()->string();
}, $this->_certs));
} | php | public function toPEMString(): string
{
return implode("\n",
array_map(
function (Certificate $cert) {
return $cert->toPEM()->string();
}, $this->_certs));
} | [
"public",
"function",
"toPEMString",
"(",
")",
":",
"string",
"{",
"return",
"implode",
"(",
"\"\\n\"",
",",
"array_map",
"(",
"function",
"(",
"Certificate",
"$",
"cert",
")",
"{",
"return",
"$",
"cert",
"->",
"toPEM",
"(",
")",
"->",
"string",
"(",
"... | Convert certificate chain to string of PEM blocks.
@return string | [
"Convert",
"certificate",
"chain",
"to",
"string",
"of",
"PEM",
"blocks",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Certificate/CertificateChain.php#L114-L121 |
190,330 | sop/x509 | lib/X509/CertificationRequest/CertificationRequest.php | CertificationRequest.verify | public function verify(Crypto $crypto = null): bool
{
$crypto = $crypto ?: Crypto::getDefault();
$data = $this->_certificationRequestInfo->toASN1()->toDER();
$pk_info = $this->_certificationRequestInfo->subjectPKInfo();
return $crypto->verify($data, $this->_signature, $pk_info,
... | php | public function verify(Crypto $crypto = null): bool
{
$crypto = $crypto ?: Crypto::getDefault();
$data = $this->_certificationRequestInfo->toASN1()->toDER();
$pk_info = $this->_certificationRequestInfo->subjectPKInfo();
return $crypto->verify($data, $this->_signature, $pk_info,
... | [
"public",
"function",
"verify",
"(",
"Crypto",
"$",
"crypto",
"=",
"null",
")",
":",
"bool",
"{",
"$",
"crypto",
"=",
"$",
"crypto",
"?",
":",
"Crypto",
"::",
"getDefault",
"(",
")",
";",
"$",
"data",
"=",
"$",
"this",
"->",
"_certificationRequestInfo"... | Verify certification request signature.
@param Crypto|null $crypto Crypto engine, use default if not set
@return bool True if signature matches | [
"Verify",
"certification",
"request",
"signature",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/CertificationRequest/CertificationRequest.php#L172-L179 |
190,331 | sop/x509 | lib/X509/Certificate/Extension/DistributionPoint/DistributionPointName.php | DistributionPointName.fromTaggedType | public static function fromTaggedType(TaggedType $el): self
{
switch ($el->tag()) {
case self::TAG_FULL_NAME:
return new FullName(
GeneralNames::fromASN1(
$el->asImplicit(Element::TYPE_SEQUENCE)->asSequence()));
case self::T... | php | public static function fromTaggedType(TaggedType $el): self
{
switch ($el->tag()) {
case self::TAG_FULL_NAME:
return new FullName(
GeneralNames::fromASN1(
$el->asImplicit(Element::TYPE_SEQUENCE)->asSequence()));
case self::T... | [
"public",
"static",
"function",
"fromTaggedType",
"(",
"TaggedType",
"$",
"el",
")",
":",
"self",
"{",
"switch",
"(",
"$",
"el",
"->",
"tag",
"(",
")",
")",
"{",
"case",
"self",
"::",
"TAG_FULL_NAME",
":",
"return",
"new",
"FullName",
"(",
"GeneralNames"... | Initialize from TaggedType.
@param TaggedType $el
@throws \UnexpectedValueException
@return self | [
"Initialize",
"from",
"TaggedType",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Certificate/Extension/DistributionPoint/DistributionPointName.php#L45-L59 |
190,332 | sop/x509 | lib/X509/Certificate/Extension/PolicyMappingsExtension.php | PolicyMappingsExtension.flattenedMappings | public function flattenedMappings(): array
{
$mappings = array();
foreach ($this->_mappings as $mapping) {
$idp = $mapping->issuerDomainPolicy();
if (!isset($mappings[$idp])) {
$mappings[$idp] = array();
}
array_push($mappings[$idp], $m... | php | public function flattenedMappings(): array
{
$mappings = array();
foreach ($this->_mappings as $mapping) {
$idp = $mapping->issuerDomainPolicy();
if (!isset($mappings[$idp])) {
$mappings[$idp] = array();
}
array_push($mappings[$idp], $m... | [
"public",
"function",
"flattenedMappings",
"(",
")",
":",
"array",
"{",
"$",
"mappings",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"_mappings",
"as",
"$",
"mapping",
")",
"{",
"$",
"idp",
"=",
"$",
"mapping",
"->",
"issuerDomainPo... | Get mappings flattened into a single array of arrays of subject domains
keyed by issuer domain.
Eg. if policy mappings contains multiple mappings with the same issuer
domain policy, their corresponding subject domain policies are placed
under the same key.
@return (string[])[] | [
"Get",
"mappings",
"flattened",
"into",
"a",
"single",
"array",
"of",
"arrays",
"of",
"subject",
"domains",
"keyed",
"by",
"issuer",
"domain",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Certificate/Extension/PolicyMappingsExtension.php#L95-L106 |
190,333 | sop/x509 | lib/X509/Certificate/Extension/PolicyMappingsExtension.php | PolicyMappingsExtension.issuerMappings | public function issuerMappings(string $oid): array
{
$oids = array();
foreach ($this->_mappings as $mapping) {
if ($mapping->issuerDomainPolicy() == $oid) {
$oids[] = $mapping->subjectDomainPolicy();
}
}
return $oids;
} | php | public function issuerMappings(string $oid): array
{
$oids = array();
foreach ($this->_mappings as $mapping) {
if ($mapping->issuerDomainPolicy() == $oid) {
$oids[] = $mapping->subjectDomainPolicy();
}
}
return $oids;
} | [
"public",
"function",
"issuerMappings",
"(",
"string",
"$",
"oid",
")",
":",
"array",
"{",
"$",
"oids",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"_mappings",
"as",
"$",
"mapping",
")",
"{",
"if",
"(",
"$",
"mapping",
"->",
"i... | Get all subject domain policy OIDs that are mapped to given issuer
domain policy OID.
@param string $oid Issuer domain policy
@return string[] List of OIDs in dotted format | [
"Get",
"all",
"subject",
"domain",
"policy",
"OIDs",
"that",
"are",
"mapped",
"to",
"given",
"issuer",
"domain",
"policy",
"OID",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Certificate/Extension/PolicyMappingsExtension.php#L115-L124 |
190,334 | sop/x509 | lib/X509/Certificate/Extension/PolicyMappingsExtension.php | PolicyMappingsExtension.issuerDomainPolicies | public function issuerDomainPolicies(): array
{
$idps = array_map(
function (PolicyMapping $mapping) {
return $mapping->issuerDomainPolicy();
}, $this->_mappings);
return array_values(array_unique($idps));
} | php | public function issuerDomainPolicies(): array
{
$idps = array_map(
function (PolicyMapping $mapping) {
return $mapping->issuerDomainPolicy();
}, $this->_mappings);
return array_values(array_unique($idps));
} | [
"public",
"function",
"issuerDomainPolicies",
"(",
")",
":",
"array",
"{",
"$",
"idps",
"=",
"array_map",
"(",
"function",
"(",
"PolicyMapping",
"$",
"mapping",
")",
"{",
"return",
"$",
"mapping",
"->",
"issuerDomainPolicy",
"(",
")",
";",
"}",
",",
"$",
... | Get all mapped issuer domain policy OIDs.
@return string[] | [
"Get",
"all",
"mapped",
"issuer",
"domain",
"policy",
"OIDs",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Certificate/Extension/PolicyMappingsExtension.php#L131-L138 |
190,335 | sop/x509 | lib/X509/Certificate/Extension/PolicyMappingsExtension.php | PolicyMappingsExtension.hasAnyPolicyMapping | public function hasAnyPolicyMapping(): bool
{
foreach ($this->_mappings as $mapping) {
if ($mapping->issuerDomainPolicy() ==
PolicyInformation::OID_ANY_POLICY) {
return true;
}
if ($mapping->subjectDomainPolicy() ==
Policy... | php | public function hasAnyPolicyMapping(): bool
{
foreach ($this->_mappings as $mapping) {
if ($mapping->issuerDomainPolicy() ==
PolicyInformation::OID_ANY_POLICY) {
return true;
}
if ($mapping->subjectDomainPolicy() ==
Policy... | [
"public",
"function",
"hasAnyPolicyMapping",
"(",
")",
":",
"bool",
"{",
"foreach",
"(",
"$",
"this",
"->",
"_mappings",
"as",
"$",
"mapping",
")",
"{",
"if",
"(",
"$",
"mapping",
"->",
"issuerDomainPolicy",
"(",
")",
"==",
"PolicyInformation",
"::",
"OID_... | Check whether policy mappings have anyPolicy mapped.
RFC 5280 section 4.2.1.5 states that "Policies MUST NOT be mapped either
to or from the special value anyPolicy".
@return bool | [
"Check",
"whether",
"policy",
"mappings",
"have",
"anyPolicy",
"mapped",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Certificate/Extension/PolicyMappingsExtension.php#L148-L161 |
190,336 | sop/x509 | lib/X509/Certificate/Extension/TargetInformationExtension.php | TargetInformationExtension.targets | public function targets(): Targets
{
if (!isset($this->_merged)) {
$a = array();
foreach ($this->_targets as $targets) {
$a = array_merge($a, $targets->all());
}
$this->_merged = new Targets(...$a);
}
return $this->_merged;
... | php | public function targets(): Targets
{
if (!isset($this->_merged)) {
$a = array();
foreach ($this->_targets as $targets) {
$a = array_merge($a, $targets->all());
}
$this->_merged = new Targets(...$a);
}
return $this->_merged;
... | [
"public",
"function",
"targets",
"(",
")",
":",
"Targets",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"_merged",
")",
")",
"{",
"$",
"a",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"_targets",
"as",
"$",
"targets",... | Get all targets.
@return Targets | [
"Get",
"all",
"targets",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Certificate/Extension/TargetInformationExtension.php#L91-L101 |
190,337 | expalmer/php-bad-words | src/PhpBadWords.php | PhpBadWords.fillDictionaryWords | private function fillDictionaryWords() {
foreach($this->dictionary as $w):
$this->dictionaryWords[] = is_array($w) ? $w[0] : $w;
endforeach;
} | php | private function fillDictionaryWords() {
foreach($this->dictionary as $w):
$this->dictionaryWords[] = is_array($w) ? $w[0] : $w;
endforeach;
} | [
"private",
"function",
"fillDictionaryWords",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"dictionary",
"as",
"$",
"w",
")",
":",
"$",
"this",
"->",
"dictionaryWords",
"[",
"]",
"=",
"is_array",
"(",
"$",
"w",
")",
"?",
"$",
"w",
"[",
"0",
"]... | Fill the variable with only the words of the dictionary, without the original word rules
@return void | [
"Fill",
"the",
"variable",
"with",
"only",
"the",
"words",
"of",
"the",
"dictionary",
"without",
"the",
"original",
"word",
"rules"
] | 1d64f1b93b9433ed4e11df7d9d20e93f460f77dc | https://github.com/expalmer/php-bad-words/blob/1d64f1b93b9433ed4e11df7d9d20e93f460f77dc/src/PhpBadWords.php#L26-L30 |
190,338 | expalmer/php-bad-words | src/PhpBadWords.php | PhpBadWords.setDictionaryFromFile | public function setDictionaryFromFile( $path ) {
if ( file_exists( $path ) ) {
$dict = include $path;
if( is_array($dict) ) {
$this->dictionary = $dict;
$this->fillDictionaryWords();
return $this;
}
throw new \Exception('The file content must be an array!');
}
... | php | public function setDictionaryFromFile( $path ) {
if ( file_exists( $path ) ) {
$dict = include $path;
if( is_array($dict) ) {
$this->dictionary = $dict;
$this->fillDictionaryWords();
return $this;
}
throw new \Exception('The file content must be an array!');
}
... | [
"public",
"function",
"setDictionaryFromFile",
"(",
"$",
"path",
")",
"{",
"if",
"(",
"file_exists",
"(",
"$",
"path",
")",
")",
"{",
"$",
"dict",
"=",
"include",
"$",
"path",
";",
"if",
"(",
"is_array",
"(",
"$",
"dict",
")",
")",
"{",
"$",
"this"... | Set the bad words list from a file
@param string
@return this
@throws \Exception | [
"Set",
"the",
"bad",
"words",
"list",
"from",
"a",
"file"
] | 1d64f1b93b9433ed4e11df7d9d20e93f460f77dc | https://github.com/expalmer/php-bad-words/blob/1d64f1b93b9433ed4e11df7d9d20e93f460f77dc/src/PhpBadWords.php#L55-L66 |
190,339 | expalmer/php-bad-words | src/PhpBadWords.php | PhpBadWords.setText | public function setText( $text ) {
$this->textOriginal = $text;
$this->text = preg_replace("/([^\w ]*)/iu", "", $text);
return $this;
} | php | public function setText( $text ) {
$this->textOriginal = $text;
$this->text = preg_replace("/([^\w ]*)/iu", "", $text);
return $this;
} | [
"public",
"function",
"setText",
"(",
"$",
"text",
")",
"{",
"$",
"this",
"->",
"textOriginal",
"=",
"$",
"text",
";",
"$",
"this",
"->",
"text",
"=",
"preg_replace",
"(",
"\"/([^\\w ]*)/iu\"",
",",
"\"\"",
",",
"$",
"text",
")",
";",
"return",
"$",
... | Set the text to be checked
@param string
@return this | [
"Set",
"the",
"text",
"to",
"be",
"checked"
] | 1d64f1b93b9433ed4e11df7d9d20e93f460f77dc | https://github.com/expalmer/php-bad-words/blob/1d64f1b93b9433ed4e11df7d9d20e93f460f77dc/src/PhpBadWords.php#L74-L78 |
190,340 | expalmer/php-bad-words | src/PhpBadWords.php | PhpBadWords.check | public function check() {
foreach( $this->dictionary as $word ):
$rule = "alone";
if( is_array($word) ) {
$rule = isset($word[1]) ? $word[1] : $rule;
$word = $word[0];
}
$word = preg_replace("/([^\w ]*)/iu", "", $word);
if( "among" === $rule ) {
if( preg_match("... | php | public function check() {
foreach( $this->dictionary as $word ):
$rule = "alone";
if( is_array($word) ) {
$rule = isset($word[1]) ? $word[1] : $rule;
$word = $word[0];
}
$word = preg_replace("/([^\w ]*)/iu", "", $word);
if( "among" === $rule ) {
if( preg_match("... | [
"public",
"function",
"check",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"dictionary",
"as",
"$",
"word",
")",
":",
"$",
"rule",
"=",
"\"alone\"",
";",
"if",
"(",
"is_array",
"(",
"$",
"word",
")",
")",
"{",
"$",
"rule",
"=",
"isset",
"("... | Checks for bad words in the text but verifies each dictionary word rule,
like alone ou among each word in the text.
@return boolean | [
"Checks",
"for",
"bad",
"words",
"in",
"the",
"text",
"but",
"verifies",
"each",
"dictionary",
"word",
"rule",
"like",
"alone",
"ou",
"among",
"each",
"word",
"in",
"the",
"text",
"."
] | 1d64f1b93b9433ed4e11df7d9d20e93f460f77dc | https://github.com/expalmer/php-bad-words/blob/1d64f1b93b9433ed4e11df7d9d20e93f460f77dc/src/PhpBadWords.php#L86-L101 |
190,341 | phpsec/phpSec | lib/phpSec/Crypt/Hash.php | Hash.create | public function create($str) {
$rand = $this->psl['crypt/rand'];
$crypto = $this->psl['crypt/crypto'];
switch($this->method) {
case self::BCRYPT:
$saltRnd = $rand->str(22, $this->charsets['itoa64']);
$salt = sprintf('%s%s$%s', self::BCRYPT, $this->bcrypt_cost, $saltRnd);
$has... | php | public function create($str) {
$rand = $this->psl['crypt/rand'];
$crypto = $this->psl['crypt/crypto'];
switch($this->method) {
case self::BCRYPT:
$saltRnd = $rand->str(22, $this->charsets['itoa64']);
$salt = sprintf('%s%s$%s', self::BCRYPT, $this->bcrypt_cost, $saltRnd);
$has... | [
"public",
"function",
"create",
"(",
"$",
"str",
")",
"{",
"$",
"rand",
"=",
"$",
"this",
"->",
"psl",
"[",
"'crypt/rand'",
"]",
";",
"$",
"crypto",
"=",
"$",
"this",
"->",
"psl",
"[",
"'crypt/crypto'",
"]",
";",
"switch",
"(",
"$",
"this",
"->",
... | Creates a salted hash from a string.
@param string $str
String to hash.
@return string
Returns hashed string, or false on error. | [
"Creates",
"a",
"salted",
"hash",
"from",
"a",
"string",
"."
] | 653e9cada38ae7f6debc3cce0d3a17402c715588 | https://github.com/phpsec/phpSec/blob/653e9cada38ae7f6debc3cce0d3a17402c715588/lib/phpSec/Crypt/Hash.php#L96-L141 |
190,342 | phpsec/phpSec | lib/phpSec/Crypt/Hash.php | Hash.check | public function check($str, $hash) {
$crypto = $this->psl['crypt/crypto'];
$compare = $this->psl['string/compare'];
$hashInfo = $this->getInfo($hash);
switch($hashInfo['algo']) {
case self::PBKDF2:
$param = array();
list( , , $params, $hash, $salt) = explode('$', $hash);
... | php | public function check($str, $hash) {
$crypto = $this->psl['crypt/crypto'];
$compare = $this->psl['string/compare'];
$hashInfo = $this->getInfo($hash);
switch($hashInfo['algo']) {
case self::PBKDF2:
$param = array();
list( , , $params, $hash, $salt) = explode('$', $hash);
... | [
"public",
"function",
"check",
"(",
"$",
"str",
",",
"$",
"hash",
")",
"{",
"$",
"crypto",
"=",
"$",
"this",
"->",
"psl",
"[",
"'crypt/crypto'",
"]",
";",
"$",
"compare",
"=",
"$",
"this",
"->",
"psl",
"[",
"'string/compare'",
"]",
";",
"$",
"hashI... | Check a string against a hash.
@param string $str
String to check.
@param string $hash
The hash to check the string against.
@return bool
Returns true on match. | [
"Check",
"a",
"string",
"against",
"a",
"hash",
"."
] | 653e9cada38ae7f6debc3cce0d3a17402c715588 | https://github.com/phpsec/phpSec/blob/653e9cada38ae7f6debc3cce0d3a17402c715588/lib/phpSec/Crypt/Hash.php#L155-L207 |
190,343 | phpsec/phpSec | lib/phpSec/Crypt/Hash.php | Hash.getInfo | public function getInfo($hash) {
$regex_pattern = '/^\$[a-z, 1-6]{1,6}\$/i';
preg_match($regex_pattern, $hash, $matches);
if(sizeof($matches) > 0) {
list($method) = $matches;
} else {
$method = null;
}
switch($method) {
case self::SHA256:
case self::SHA512:
case s... | php | public function getInfo($hash) {
$regex_pattern = '/^\$[a-z, 1-6]{1,6}\$/i';
preg_match($regex_pattern, $hash, $matches);
if(sizeof($matches) > 0) {
list($method) = $matches;
} else {
$method = null;
}
switch($method) {
case self::SHA256:
case self::SHA512:
case s... | [
"public",
"function",
"getInfo",
"(",
"$",
"hash",
")",
"{",
"$",
"regex_pattern",
"=",
"'/^\\$[a-z, 1-6]{1,6}\\$/i'",
";",
"preg_match",
"(",
"$",
"regex_pattern",
",",
"$",
"hash",
",",
"$",
"matches",
")",
";",
"if",
"(",
"sizeof",
"(",
"$",
"matches",
... | Returns settings used to generate a hash.
@param string $hash
Hash to get settings for.
@return array
Returns an array with settings used to create $hash. | [
"Returns",
"settings",
"used",
"to",
"generate",
"a",
"hash",
"."
] | 653e9cada38ae7f6debc3cce0d3a17402c715588 | https://github.com/phpsec/phpSec/blob/653e9cada38ae7f6debc3cce0d3a17402c715588/lib/phpSec/Crypt/Hash.php#L218-L247 |
190,344 | sop/x509 | lib/X509/CertificationPath/PathValidation/PathValidationConfig.php | PathValidationConfig.withMaxLength | public function withMaxLength(int $length): self
{
$obj = clone $this;
$obj->_maxLength = $length;
return $obj;
} | php | public function withMaxLength(int $length): self
{
$obj = clone $this;
$obj->_maxLength = $length;
return $obj;
} | [
"public",
"function",
"withMaxLength",
"(",
"int",
"$",
"length",
")",
":",
"self",
"{",
"$",
"obj",
"=",
"clone",
"$",
"this",
";",
"$",
"obj",
"->",
"_maxLength",
"=",
"$",
"length",
";",
"return",
"$",
"obj",
";",
"}"
] | Get self with maximum path length.
@param int $length
@return self | [
"Get",
"self",
"with",
"maximum",
"path",
"length",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/CertificationPath/PathValidation/PathValidationConfig.php#L119-L124 |
190,345 | sop/x509 | lib/X509/CertificationPath/PathValidation/PathValidationConfig.php | PathValidationConfig.withDateTime | public function withDateTime(\DateTimeImmutable $dt): self
{
$obj = clone $this;
$obj->_dateTime = $dt;
return $obj;
} | php | public function withDateTime(\DateTimeImmutable $dt): self
{
$obj = clone $this;
$obj->_dateTime = $dt;
return $obj;
} | [
"public",
"function",
"withDateTime",
"(",
"\\",
"DateTimeImmutable",
"$",
"dt",
")",
":",
"self",
"{",
"$",
"obj",
"=",
"clone",
"$",
"this",
";",
"$",
"obj",
"->",
"_dateTime",
"=",
"$",
"dt",
";",
"return",
"$",
"obj",
";",
"}"
] | Get self with reference date and time.
@param \DateTimeImmutable $dt
@return self | [
"Get",
"self",
"with",
"reference",
"date",
"and",
"time",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/CertificationPath/PathValidation/PathValidationConfig.php#L132-L137 |
190,346 | sop/x509 | lib/X509/CertificationPath/PathValidation/PathValidationConfig.php | PathValidationConfig.withTrustAnchor | public function withTrustAnchor(Certificate $ca): self
{
$obj = clone $this;
$obj->_trustAnchor = $ca;
return $obj;
} | php | public function withTrustAnchor(Certificate $ca): self
{
$obj = clone $this;
$obj->_trustAnchor = $ca;
return $obj;
} | [
"public",
"function",
"withTrustAnchor",
"(",
"Certificate",
"$",
"ca",
")",
":",
"self",
"{",
"$",
"obj",
"=",
"clone",
"$",
"this",
";",
"$",
"obj",
"->",
"_trustAnchor",
"=",
"$",
"ca",
";",
"return",
"$",
"obj",
";",
"}"
] | Get self with trust anchor certificate.
@param Certificate $ca
@return self | [
"Get",
"self",
"with",
"trust",
"anchor",
"certificate",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/CertificationPath/PathValidation/PathValidationConfig.php#L145-L150 |
190,347 | sop/x509 | lib/X509/CertificationPath/PathValidation/PathValidationConfig.php | PathValidationConfig.withPolicyMappingInhibit | public function withPolicyMappingInhibit(bool $flag): self
{
$obj = clone $this;
$obj->_policyMappingInhibit = $flag;
return $obj;
} | php | public function withPolicyMappingInhibit(bool $flag): self
{
$obj = clone $this;
$obj->_policyMappingInhibit = $flag;
return $obj;
} | [
"public",
"function",
"withPolicyMappingInhibit",
"(",
"bool",
"$",
"flag",
")",
":",
"self",
"{",
"$",
"obj",
"=",
"clone",
"$",
"this",
";",
"$",
"obj",
"->",
"_policyMappingInhibit",
"=",
"$",
"flag",
";",
"return",
"$",
"obj",
";",
"}"
] | Get self with initial-policy-mapping-inhibit set.
@param bool $flag
@return self | [
"Get",
"self",
"with",
"initial",
"-",
"policy",
"-",
"mapping",
"-",
"inhibit",
"set",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/CertificationPath/PathValidation/PathValidationConfig.php#L158-L163 |
190,348 | sop/x509 | lib/X509/CertificationPath/PathValidation/PathValidationConfig.php | PathValidationConfig.withExplicitPolicy | public function withExplicitPolicy(bool $flag): self
{
$obj = clone $this;
$obj->_explicitPolicy = $flag;
return $obj;
} | php | public function withExplicitPolicy(bool $flag): self
{
$obj = clone $this;
$obj->_explicitPolicy = $flag;
return $obj;
} | [
"public",
"function",
"withExplicitPolicy",
"(",
"bool",
"$",
"flag",
")",
":",
"self",
"{",
"$",
"obj",
"=",
"clone",
"$",
"this",
";",
"$",
"obj",
"->",
"_explicitPolicy",
"=",
"$",
"flag",
";",
"return",
"$",
"obj",
";",
"}"
] | Get self with initial-explicit-policy set.
@param bool $flag
@return self | [
"Get",
"self",
"with",
"initial",
"-",
"explicit",
"-",
"policy",
"set",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/CertificationPath/PathValidation/PathValidationConfig.php#L171-L176 |
190,349 | sop/x509 | lib/X509/CertificationPath/PathValidation/PathValidationConfig.php | PathValidationConfig.withAnyPolicyInhibit | public function withAnyPolicyInhibit(bool $flag): self
{
$obj = clone $this;
$obj->_anyPolicyInhibit = $flag;
return $obj;
} | php | public function withAnyPolicyInhibit(bool $flag): self
{
$obj = clone $this;
$obj->_anyPolicyInhibit = $flag;
return $obj;
} | [
"public",
"function",
"withAnyPolicyInhibit",
"(",
"bool",
"$",
"flag",
")",
":",
"self",
"{",
"$",
"obj",
"=",
"clone",
"$",
"this",
";",
"$",
"obj",
"->",
"_anyPolicyInhibit",
"=",
"$",
"flag",
";",
"return",
"$",
"obj",
";",
"}"
] | Get self with initial-any-policy-inhibit set.
@param bool $flag
@return self | [
"Get",
"self",
"with",
"initial",
"-",
"any",
"-",
"policy",
"-",
"inhibit",
"set",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/CertificationPath/PathValidation/PathValidationConfig.php#L184-L189 |
190,350 | sop/x509 | lib/X509/CertificationPath/PathValidation/PathValidationConfig.php | PathValidationConfig.withPolicySet | public function withPolicySet(string ...$policies): self
{
$obj = clone $this;
$obj->_policySet = $policies;
return $obj;
} | php | public function withPolicySet(string ...$policies): self
{
$obj = clone $this;
$obj->_policySet = $policies;
return $obj;
} | [
"public",
"function",
"withPolicySet",
"(",
"string",
"...",
"$",
"policies",
")",
":",
"self",
"{",
"$",
"obj",
"=",
"clone",
"$",
"this",
";",
"$",
"obj",
"->",
"_policySet",
"=",
"$",
"policies",
";",
"return",
"$",
"obj",
";",
"}"
] | Get self with user-initial-policy-set set to policy OIDs.
@param string ...$policies List of policy OIDs
@return self | [
"Get",
"self",
"with",
"user",
"-",
"initial",
"-",
"policy",
"-",
"set",
"set",
"to",
"policy",
"OIDs",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/CertificationPath/PathValidation/PathValidationConfig.php#L197-L202 |
190,351 | phpsec/phpSec | lib/phpSec/Auth/Google.php | Google.verify | public function verify($otp, $secret) {
$timeTick = $this->getTimestamp();
$storeId = $this->getStoreId($secret);
try {
$store = $this->psl['store']->read('google-auth', $storeId);
for($tick = $timeTick - $this->_deviate ; $tick <= $timeTick + $this->_deviate; $tick++) {
$tickOtp = $thi... | php | public function verify($otp, $secret) {
$timeTick = $this->getTimestamp();
$storeId = $this->getStoreId($secret);
try {
$store = $this->psl['store']->read('google-auth', $storeId);
for($tick = $timeTick - $this->_deviate ; $tick <= $timeTick + $this->_deviate; $tick++) {
$tickOtp = $thi... | [
"public",
"function",
"verify",
"(",
"$",
"otp",
",",
"$",
"secret",
")",
"{",
"$",
"timeTick",
"=",
"$",
"this",
"->",
"getTimestamp",
"(",
")",
";",
"$",
"storeId",
"=",
"$",
"this",
"->",
"getStoreId",
"(",
"$",
"secret",
")",
";",
"try",
"{",
... | Verify a OTP token.
@param string $otp
OTP token to verify.
@param string $secret
User secret key.
@return boolean
Returns true if the OTP is valid. | [
"Verify",
"a",
"OTP",
"token",
"."
] | 653e9cada38ae7f6debc3cce0d3a17402c715588 | https://github.com/phpsec/phpSec/blob/653e9cada38ae7f6debc3cce0d3a17402c715588/lib/phpSec/Auth/Google.php#L57-L87 |
190,352 | phpsec/phpSec | lib/phpSec/Auth/Google.php | Google.getToken | public function getToken($secret, $timeTick = null) {
$base32 = $this->psl['string/base32'];
$secret = $base32->decode($secret);
if($timeTick === null) {
$timeTick = $this->getTimestamp();
}
$timestamp = pack('N*', 0) . pack('N*', $timeTick);
$hash = hash_hmac ('sha1', $timestamp, $sec... | php | public function getToken($secret, $timeTick = null) {
$base32 = $this->psl['string/base32'];
$secret = $base32->decode($secret);
if($timeTick === null) {
$timeTick = $this->getTimestamp();
}
$timestamp = pack('N*', 0) . pack('N*', $timeTick);
$hash = hash_hmac ('sha1', $timestamp, $sec... | [
"public",
"function",
"getToken",
"(",
"$",
"secret",
",",
"$",
"timeTick",
"=",
"null",
")",
"{",
"$",
"base32",
"=",
"$",
"this",
"->",
"psl",
"[",
"'string/base32'",
"]",
";",
"$",
"secret",
"=",
"$",
"base32",
"->",
"decode",
"(",
"$",
"secret",
... | Generate a OTP from a secret and time.
@param string $secret
@param integer $timeTick
@return string | [
"Generate",
"a",
"OTP",
"from",
"a",
"secret",
"and",
"time",
"."
] | 653e9cada38ae7f6debc3cce0d3a17402c715588 | https://github.com/phpsec/phpSec/blob/653e9cada38ae7f6debc3cce0d3a17402c715588/lib/phpSec/Auth/Google.php#L98-L121 |
190,353 | sop/x509 | lib/X509/Certificate/Extensions.php | Extensions.get | public function get(string $oid): Ext\Extension
{
if (!$this->has($oid)) {
throw new \LogicException("No extension by OID $oid.");
}
return $this->_extensions[$oid];
} | php | public function get(string $oid): Ext\Extension
{
if (!$this->has($oid)) {
throw new \LogicException("No extension by OID $oid.");
}
return $this->_extensions[$oid];
} | [
"public",
"function",
"get",
"(",
"string",
"$",
"oid",
")",
":",
"Ext",
"\\",
"Extension",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"has",
"(",
"$",
"oid",
")",
")",
"{",
"throw",
"new",
"\\",
"LogicException",
"(",
"\"No extension by OID $oid.\"",
")"... | Get extension by OID.
@param string $oid
@throws \LogicException If extension is not present
@return Extension\Extension | [
"Get",
"extension",
"by",
"OID",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Certificate/Extensions.php#L104-L110 |
190,354 | sop/x509 | lib/X509/Certificate/Extensions.php | Extensions.authorityKeyIdentifier | public function authorityKeyIdentifier(): Ext\AuthorityKeyIdentifierExtension
{
/** @var Extension\AuthorityKeyIdentifierExtension $keyIdentifier */
$keyIdentifier = $this->get(Ext\Extension::OID_AUTHORITY_KEY_IDENTIFIER);
return $keyIdentifier;
} | php | public function authorityKeyIdentifier(): Ext\AuthorityKeyIdentifierExtension
{
/** @var Extension\AuthorityKeyIdentifierExtension $keyIdentifier */
$keyIdentifier = $this->get(Ext\Extension::OID_AUTHORITY_KEY_IDENTIFIER);
return $keyIdentifier;
} | [
"public",
"function",
"authorityKeyIdentifier",
"(",
")",
":",
"Ext",
"\\",
"AuthorityKeyIdentifierExtension",
"{",
"/** @var Extension\\AuthorityKeyIdentifierExtension $keyIdentifier */",
"$",
"keyIdentifier",
"=",
"$",
"this",
"->",
"get",
"(",
"Ext",
"\\",
"Extension",
... | Get 'Authority Key Identifier' extension.
@throws \LogicException If extension is not present
@return \X509\Certificate\Extension\AuthorityKeyIdentifierExtension | [
"Get",
"Authority",
"Key",
"Identifier",
"extension",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Certificate/Extensions.php#L128-L133 |
190,355 | sop/x509 | lib/X509/Certificate/Extensions.php | Extensions.subjectKeyIdentifier | public function subjectKeyIdentifier(): Ext\SubjectKeyIdentifierExtension
{
/** @var Extension\SubjectKeyIdentifierExtension $subjectKeyIdentifier */
$subjectKeyIdentifier = $this->get(
Ext\Extension::OID_SUBJECT_KEY_IDENTIFIER);
return $subjectKeyIdentifier;
} | php | public function subjectKeyIdentifier(): Ext\SubjectKeyIdentifierExtension
{
/** @var Extension\SubjectKeyIdentifierExtension $subjectKeyIdentifier */
$subjectKeyIdentifier = $this->get(
Ext\Extension::OID_SUBJECT_KEY_IDENTIFIER);
return $subjectKeyIdentifier;
} | [
"public",
"function",
"subjectKeyIdentifier",
"(",
")",
":",
"Ext",
"\\",
"SubjectKeyIdentifierExtension",
"{",
"/** @var Extension\\SubjectKeyIdentifierExtension $subjectKeyIdentifier */",
"$",
"subjectKeyIdentifier",
"=",
"$",
"this",
"->",
"get",
"(",
"Ext",
"\\",
"Exten... | Get 'Subject Key Identifier' extension.
@throws \LogicException If extension is not present
@return \X509\Certificate\Extension\SubjectKeyIdentifierExtension | [
"Get",
"Subject",
"Key",
"Identifier",
"extension",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Certificate/Extensions.php#L151-L157 |
190,356 | sop/x509 | lib/X509/Certificate/Extensions.php | Extensions.keyUsage | public function keyUsage(): Ext\KeyUsageExtension
{
/** @var Extension\KeyUsageExtension $keyUsage */
$keyUsage = $this->get(Ext\Extension::OID_KEY_USAGE);
return $keyUsage;
} | php | public function keyUsage(): Ext\KeyUsageExtension
{
/** @var Extension\KeyUsageExtension $keyUsage */
$keyUsage = $this->get(Ext\Extension::OID_KEY_USAGE);
return $keyUsage;
} | [
"public",
"function",
"keyUsage",
"(",
")",
":",
"Ext",
"\\",
"KeyUsageExtension",
"{",
"/** @var Extension\\KeyUsageExtension $keyUsage */",
"$",
"keyUsage",
"=",
"$",
"this",
"->",
"get",
"(",
"Ext",
"\\",
"Extension",
"::",
"OID_KEY_USAGE",
")",
";",
"return",
... | Get 'Key Usage' extension.
@throws \LogicException If extension is not present
@return \X509\Certificate\Extension\KeyUsageExtension | [
"Get",
"Key",
"Usage",
"extension",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Certificate/Extensions.php#L175-L180 |
190,357 | sop/x509 | lib/X509/Certificate/Extensions.php | Extensions.certificatePolicies | public function certificatePolicies(): Ext\CertificatePoliciesExtension
{
/** @var Extension\CertificatePoliciesExtension $certPolicies */
$certPolicies = $this->get(Ext\Extension::OID_CERTIFICATE_POLICIES);
return $certPolicies;
} | php | public function certificatePolicies(): Ext\CertificatePoliciesExtension
{
/** @var Extension\CertificatePoliciesExtension $certPolicies */
$certPolicies = $this->get(Ext\Extension::OID_CERTIFICATE_POLICIES);
return $certPolicies;
} | [
"public",
"function",
"certificatePolicies",
"(",
")",
":",
"Ext",
"\\",
"CertificatePoliciesExtension",
"{",
"/** @var Extension\\CertificatePoliciesExtension $certPolicies */",
"$",
"certPolicies",
"=",
"$",
"this",
"->",
"get",
"(",
"Ext",
"\\",
"Extension",
"::",
"O... | Get 'Certificate Policies' extension.
@throws \LogicException If extension is not present
@return \X509\Certificate\Extension\CertificatePoliciesExtension | [
"Get",
"Certificate",
"Policies",
"extension",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Certificate/Extensions.php#L198-L203 |
190,358 | sop/x509 | lib/X509/Certificate/Extensions.php | Extensions.policyMappings | public function policyMappings(): Ext\PolicyMappingsExtension
{
/** @var Extension\PolicyMappingsExtension $policyMappings */
$policyMappings = $this->get(Ext\Extension::OID_POLICY_MAPPINGS);
return $policyMappings;
} | php | public function policyMappings(): Ext\PolicyMappingsExtension
{
/** @var Extension\PolicyMappingsExtension $policyMappings */
$policyMappings = $this->get(Ext\Extension::OID_POLICY_MAPPINGS);
return $policyMappings;
} | [
"public",
"function",
"policyMappings",
"(",
")",
":",
"Ext",
"\\",
"PolicyMappingsExtension",
"{",
"/** @var Extension\\PolicyMappingsExtension $policyMappings */",
"$",
"policyMappings",
"=",
"$",
"this",
"->",
"get",
"(",
"Ext",
"\\",
"Extension",
"::",
"OID_POLICY_M... | Get 'Policy Mappings' extension.
@throws \LogicException If extension is not present
@return \X509\Certificate\Extension\PolicyMappingsExtension | [
"Get",
"Policy",
"Mappings",
"extension",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Certificate/Extensions.php#L221-L226 |
190,359 | sop/x509 | lib/X509/Certificate/Extensions.php | Extensions.subjectAlternativeName | public function subjectAlternativeName(): Ext\SubjectAlternativeNameExtension
{
/** @var Extension\SubjectAlternativeNameExtension $subjectAltName */
$subjectAltName = $this->get(Ext\Extension::OID_SUBJECT_ALT_NAME);
return $subjectAltName;
} | php | public function subjectAlternativeName(): Ext\SubjectAlternativeNameExtension
{
/** @var Extension\SubjectAlternativeNameExtension $subjectAltName */
$subjectAltName = $this->get(Ext\Extension::OID_SUBJECT_ALT_NAME);
return $subjectAltName;
} | [
"public",
"function",
"subjectAlternativeName",
"(",
")",
":",
"Ext",
"\\",
"SubjectAlternativeNameExtension",
"{",
"/** @var Extension\\SubjectAlternativeNameExtension $subjectAltName */",
"$",
"subjectAltName",
"=",
"$",
"this",
"->",
"get",
"(",
"Ext",
"\\",
"Extension",... | Get 'Subject Alternative Name' extension.
@throws \LogicException If extension is not present
@return \X509\Certificate\Extension\SubjectAlternativeNameExtension | [
"Get",
"Subject",
"Alternative",
"Name",
"extension",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Certificate/Extensions.php#L244-L249 |
190,360 | sop/x509 | lib/X509/Certificate/Extensions.php | Extensions.issuerAlternativeName | public function issuerAlternativeName(): Ext\IssuerAlternativeNameExtension
{
/** @var Extension\IssuerAlternativeNameExtension $issuerAltName */
$issuerAltName = $this->get(Ext\Extension::OID_ISSUER_ALT_NAME);
return $issuerAltName;
} | php | public function issuerAlternativeName(): Ext\IssuerAlternativeNameExtension
{
/** @var Extension\IssuerAlternativeNameExtension $issuerAltName */
$issuerAltName = $this->get(Ext\Extension::OID_ISSUER_ALT_NAME);
return $issuerAltName;
} | [
"public",
"function",
"issuerAlternativeName",
"(",
")",
":",
"Ext",
"\\",
"IssuerAlternativeNameExtension",
"{",
"/** @var Extension\\IssuerAlternativeNameExtension $issuerAltName */",
"$",
"issuerAltName",
"=",
"$",
"this",
"->",
"get",
"(",
"Ext",
"\\",
"Extension",
":... | Get 'Issuer Alternative Name' extension.
@return \X509\Certificate\Extension\IssuerAlternativeNameExtension | [
"Get",
"Issuer",
"Alternative",
"Name",
"extension",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Certificate/Extensions.php#L266-L271 |
190,361 | sop/x509 | lib/X509/Certificate/Extensions.php | Extensions.basicConstraints | public function basicConstraints(): Ext\BasicConstraintsExtension
{
/** @var Extension\BasicConstraintsExtension $basicConstraints */
$basicConstraints = $this->get(Ext\Extension::OID_BASIC_CONSTRAINTS);
return $basicConstraints;
} | php | public function basicConstraints(): Ext\BasicConstraintsExtension
{
/** @var Extension\BasicConstraintsExtension $basicConstraints */
$basicConstraints = $this->get(Ext\Extension::OID_BASIC_CONSTRAINTS);
return $basicConstraints;
} | [
"public",
"function",
"basicConstraints",
"(",
")",
":",
"Ext",
"\\",
"BasicConstraintsExtension",
"{",
"/** @var Extension\\BasicConstraintsExtension $basicConstraints */",
"$",
"basicConstraints",
"=",
"$",
"this",
"->",
"get",
"(",
"Ext",
"\\",
"Extension",
"::",
"OI... | Get 'Basic Constraints' extension.
@throws \LogicException If extension is not present
@return \X509\Certificate\Extension\BasicConstraintsExtension | [
"Get",
"Basic",
"Constraints",
"extension",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Certificate/Extensions.php#L289-L294 |
190,362 | sop/x509 | lib/X509/Certificate/Extensions.php | Extensions.nameConstraints | public function nameConstraints(): Ext\NameConstraintsExtension
{
/** @var Extension\NameConstraintsExtension $nameConstraints */
$nameConstraints = $this->get(Ext\Extension::OID_NAME_CONSTRAINTS);
return $nameConstraints;
} | php | public function nameConstraints(): Ext\NameConstraintsExtension
{
/** @var Extension\NameConstraintsExtension $nameConstraints */
$nameConstraints = $this->get(Ext\Extension::OID_NAME_CONSTRAINTS);
return $nameConstraints;
} | [
"public",
"function",
"nameConstraints",
"(",
")",
":",
"Ext",
"\\",
"NameConstraintsExtension",
"{",
"/** @var Extension\\NameConstraintsExtension $nameConstraints */",
"$",
"nameConstraints",
"=",
"$",
"this",
"->",
"get",
"(",
"Ext",
"\\",
"Extension",
"::",
"OID_NAM... | Get 'Name Constraints' extension.
@throws \LogicException If extension is not present
@return \X509\Certificate\Extension\NameConstraintsExtension | [
"Get",
"Name",
"Constraints",
"extension",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Certificate/Extensions.php#L312-L317 |
190,363 | sop/x509 | lib/X509/Certificate/Extensions.php | Extensions.policyConstraints | public function policyConstraints(): Ext\PolicyConstraintsExtension
{
/** @var Extension\PolicyConstraintsExtension $policyConstraints */
$policyConstraints = $this->get(Ext\Extension::OID_POLICY_CONSTRAINTS);
return $policyConstraints;
} | php | public function policyConstraints(): Ext\PolicyConstraintsExtension
{
/** @var Extension\PolicyConstraintsExtension $policyConstraints */
$policyConstraints = $this->get(Ext\Extension::OID_POLICY_CONSTRAINTS);
return $policyConstraints;
} | [
"public",
"function",
"policyConstraints",
"(",
")",
":",
"Ext",
"\\",
"PolicyConstraintsExtension",
"{",
"/** @var Extension\\PolicyConstraintsExtension $policyConstraints */",
"$",
"policyConstraints",
"=",
"$",
"this",
"->",
"get",
"(",
"Ext",
"\\",
"Extension",
"::",
... | Get 'Policy Constraints' extension.
@throws \LogicException If extension is not present
@return \X509\Certificate\Extension\PolicyConstraintsExtension | [
"Get",
"Policy",
"Constraints",
"extension",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Certificate/Extensions.php#L335-L340 |
190,364 | sop/x509 | lib/X509/Certificate/Extensions.php | Extensions.extendedKeyUsage | public function extendedKeyUsage(): Ext\ExtendedKeyUsageExtension
{
/** @var Extension\ExtendedKeyUsageExtension $keyUsage */
$keyUsage = $this->get(Ext\Extension::OID_EXT_KEY_USAGE);
return $keyUsage;
} | php | public function extendedKeyUsage(): Ext\ExtendedKeyUsageExtension
{
/** @var Extension\ExtendedKeyUsageExtension $keyUsage */
$keyUsage = $this->get(Ext\Extension::OID_EXT_KEY_USAGE);
return $keyUsage;
} | [
"public",
"function",
"extendedKeyUsage",
"(",
")",
":",
"Ext",
"\\",
"ExtendedKeyUsageExtension",
"{",
"/** @var Extension\\ExtendedKeyUsageExtension $keyUsage */",
"$",
"keyUsage",
"=",
"$",
"this",
"->",
"get",
"(",
"Ext",
"\\",
"Extension",
"::",
"OID_EXT_KEY_USAGE"... | Get 'Extended Key Usage' extension.
@throws \LogicException If extension is not present
@return \X509\Certificate\Extension\ExtendedKeyUsageExtension | [
"Get",
"Extended",
"Key",
"Usage",
"extension",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Certificate/Extensions.php#L358-L363 |
190,365 | sop/x509 | lib/X509/Certificate/Extensions.php | Extensions.crlDistributionPoints | public function crlDistributionPoints(): Ext\CRLDistributionPointsExtension
{
/** @var Extension\CRLDistributionPointsExtension $crlDist */
$crlDist = $this->get(Ext\Extension::OID_CRL_DISTRIBUTION_POINTS);
return $crlDist;
} | php | public function crlDistributionPoints(): Ext\CRLDistributionPointsExtension
{
/** @var Extension\CRLDistributionPointsExtension $crlDist */
$crlDist = $this->get(Ext\Extension::OID_CRL_DISTRIBUTION_POINTS);
return $crlDist;
} | [
"public",
"function",
"crlDistributionPoints",
"(",
")",
":",
"Ext",
"\\",
"CRLDistributionPointsExtension",
"{",
"/** @var Extension\\CRLDistributionPointsExtension $crlDist */",
"$",
"crlDist",
"=",
"$",
"this",
"->",
"get",
"(",
"Ext",
"\\",
"Extension",
"::",
"OID_C... | Get 'CRL Distribution Points' extension.
@throws \LogicException If extension is not present
@return \X509\Certificate\Extension\CRLDistributionPointsExtension | [
"Get",
"CRL",
"Distribution",
"Points",
"extension",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Certificate/Extensions.php#L381-L386 |
190,366 | sop/x509 | lib/X509/Certificate/Extensions.php | Extensions.inhibitAnyPolicy | public function inhibitAnyPolicy(): Ext\InhibitAnyPolicyExtension
{
/** @var Extension\InhibitAnyPolicyExtension $inhibitAny */
$inhibitAny = $this->get(Ext\Extension::OID_INHIBIT_ANY_POLICY);
return $inhibitAny;
} | php | public function inhibitAnyPolicy(): Ext\InhibitAnyPolicyExtension
{
/** @var Extension\InhibitAnyPolicyExtension $inhibitAny */
$inhibitAny = $this->get(Ext\Extension::OID_INHIBIT_ANY_POLICY);
return $inhibitAny;
} | [
"public",
"function",
"inhibitAnyPolicy",
"(",
")",
":",
"Ext",
"\\",
"InhibitAnyPolicyExtension",
"{",
"/** @var Extension\\InhibitAnyPolicyExtension $inhibitAny */",
"$",
"inhibitAny",
"=",
"$",
"this",
"->",
"get",
"(",
"Ext",
"\\",
"Extension",
"::",
"OID_INHIBIT_AN... | Get 'Inhibit anyPolicy' extension.
@throws \LogicException If extension is not present
@return \X509\Certificate\Extension\InhibitAnyPolicyExtension | [
"Get",
"Inhibit",
"anyPolicy",
"extension",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Certificate/Extensions.php#L404-L409 |
190,367 | phpsec/phpSec | lib/phpSec/String/Base32.php | Base32.decode | public function decode($str) {
$str = strtoupper($str);
$l = strlen($str);
$n = 0;
$b = 0;
$decoded = null;
for ($i = 0; $i < $l; $i++) {
$n = $n << 5;
$n = $n + $this->decodeTable[$str[$i]];
$b = $b + 5;
if ($b >= 8) {
$b = $b - 8;
$decoded .= chr(($n & (0xFF << $b)) >> $b);
}
... | php | public function decode($str) {
$str = strtoupper($str);
$l = strlen($str);
$n = 0;
$b = 0;
$decoded = null;
for ($i = 0; $i < $l; $i++) {
$n = $n << 5;
$n = $n + $this->decodeTable[$str[$i]];
$b = $b + 5;
if ($b >= 8) {
$b = $b - 8;
$decoded .= chr(($n & (0xFF << $b)) >> $b);
}
... | [
"public",
"function",
"decode",
"(",
"$",
"str",
")",
"{",
"$",
"str",
"=",
"strtoupper",
"(",
"$",
"str",
")",
";",
"$",
"l",
"=",
"strlen",
"(",
"$",
"str",
")",
";",
"$",
"n",
"=",
"0",
";",
"$",
"b",
"=",
"0",
";",
"$",
"decoded",
"=",
... | Decode a Base32 encoded string.
@param string $str
Base 32 encoded string.
@return string | [
"Decode",
"a",
"Base32",
"encoded",
"string",
"."
] | 653e9cada38ae7f6debc3cce0d3a17402c715588 | https://github.com/phpsec/phpSec/blob/653e9cada38ae7f6debc3cce0d3a17402c715588/lib/phpSec/String/Base32.php#L62-L84 |
190,368 | sop/x509 | lib/X509/Certificate/Extension/CertificatePolicy/PolicyInformation.php | PolicyInformation.get | public function get(string $oid): PolicyQualifierInfo
{
if (!$this->has($oid)) {
throw new \LogicException("No $oid qualifier.");
}
return $this->_qualifiers[$oid];
} | php | public function get(string $oid): PolicyQualifierInfo
{
if (!$this->has($oid)) {
throw new \LogicException("No $oid qualifier.");
}
return $this->_qualifiers[$oid];
} | [
"public",
"function",
"get",
"(",
"string",
"$",
"oid",
")",
":",
"PolicyQualifierInfo",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"has",
"(",
"$",
"oid",
")",
")",
"{",
"throw",
"new",
"\\",
"LogicException",
"(",
"\"No $oid qualifier.\"",
")",
";",
"}"... | Get qualifier by OID.
@param string $oid
@throws \OutOfBoundsException
@return PolicyQualifierInfo | [
"Get",
"qualifier",
"by",
"OID",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Certificate/Extension/CertificatePolicy/PolicyInformation.php#L127-L133 |
190,369 | sop/x509 | lib/X509/Feature/DateTimeHelper.php | DateTimeHelper._createDateTime | private static function _createDateTime($time = null, $tz = null): \DateTimeImmutable
{
if (!isset($time)) {
$time = 'now';
}
if (!isset($tz)) {
$tz = date_default_timezone_get();
}
try {
$dt = new \DateTimeImmutable($time, self::_createTim... | php | private static function _createDateTime($time = null, $tz = null): \DateTimeImmutable
{
if (!isset($time)) {
$time = 'now';
}
if (!isset($tz)) {
$tz = date_default_timezone_get();
}
try {
$dt = new \DateTimeImmutable($time, self::_createTim... | [
"private",
"static",
"function",
"_createDateTime",
"(",
"$",
"time",
"=",
"null",
",",
"$",
"tz",
"=",
"null",
")",
":",
"\\",
"DateTimeImmutable",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"time",
")",
")",
"{",
"$",
"time",
"=",
"'now'",
";",
"}",... | Create DateTime object from time string and timezone.
@param string|null $time Time string, default to 'now'
@param string|null $tz Timezone, default if omitted
@throws \RuntimeException
@return \DateTimeImmutable | [
"Create",
"DateTime",
"object",
"from",
"time",
"string",
"and",
"timezone",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Feature/DateTimeHelper.php#L20-L36 |
190,370 | sop/x509 | lib/X509/Feature/DateTimeHelper.php | DateTimeHelper._roundDownFractionalSeconds | private static function _roundDownFractionalSeconds(\DateTimeImmutable $dt): \DateTimeImmutable
{
return \DateTimeImmutable::createFromFormat("Y-m-d H:i:s",
$dt->format("Y-m-d H:i:s"), $dt->getTimezone());
} | php | private static function _roundDownFractionalSeconds(\DateTimeImmutable $dt): \DateTimeImmutable
{
return \DateTimeImmutable::createFromFormat("Y-m-d H:i:s",
$dt->format("Y-m-d H:i:s"), $dt->getTimezone());
} | [
"private",
"static",
"function",
"_roundDownFractionalSeconds",
"(",
"\\",
"DateTimeImmutable",
"$",
"dt",
")",
":",
"\\",
"DateTimeImmutable",
"{",
"return",
"\\",
"DateTimeImmutable",
"::",
"createFromFormat",
"(",
"\"Y-m-d H:i:s\"",
",",
"$",
"dt",
"->",
"format"... | Rounds a \DateTimeImmutable value such that fractional
seconds are removed.
@param \DateTimeImmutable $dt
@return \DateTimeImmutable | [
"Rounds",
"a",
"\\",
"DateTimeImmutable",
"value",
"such",
"that",
"fractional",
"seconds",
"are",
"removed",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Feature/DateTimeHelper.php#L45-L49 |
190,371 | sop/x509 | lib/X509/Feature/DateTimeHelper.php | DateTimeHelper._createTimeZone | private static function _createTimeZone(string $tz): \DateTimeZone
{
try {
return new \DateTimeZone($tz);
} catch (\Exception $e) {
throw new \UnexpectedValueException("Invalid timezone.", 0, $e);
}
} | php | private static function _createTimeZone(string $tz): \DateTimeZone
{
try {
return new \DateTimeZone($tz);
} catch (\Exception $e) {
throw new \UnexpectedValueException("Invalid timezone.", 0, $e);
}
} | [
"private",
"static",
"function",
"_createTimeZone",
"(",
"string",
"$",
"tz",
")",
":",
"\\",
"DateTimeZone",
"{",
"try",
"{",
"return",
"new",
"\\",
"DateTimeZone",
"(",
"$",
"tz",
")",
";",
"}",
"catch",
"(",
"\\",
"Exception",
"$",
"e",
")",
"{",
... | Create DateTimeZone object from string.
@param string $tz
@throws \UnexpectedValueException
@return \DateTimeZone | [
"Create",
"DateTimeZone",
"object",
"from",
"string",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Feature/DateTimeHelper.php#L58-L65 |
190,372 | phpsec/phpSec | lib/phpSec/Common/Exec.php | Exec.run | public function run($cmd, $args = array(), $stdin = null) {
$cmd = $this->buildCommand($cmd, $args);
$process = proc_open($cmd, $this->descSpecs, $pipes, $this->_cwd, $this->_env);
if(is_resource($process)) {
/* Write stuff to STDIN, and close it. */
fwrite($pipes[self::STDIN], $stdin);
... | php | public function run($cmd, $args = array(), $stdin = null) {
$cmd = $this->buildCommand($cmd, $args);
$process = proc_open($cmd, $this->descSpecs, $pipes, $this->_cwd, $this->_env);
if(is_resource($process)) {
/* Write stuff to STDIN, and close it. */
fwrite($pipes[self::STDIN], $stdin);
... | [
"public",
"function",
"run",
"(",
"$",
"cmd",
",",
"$",
"args",
"=",
"array",
"(",
")",
",",
"$",
"stdin",
"=",
"null",
")",
"{",
"$",
"cmd",
"=",
"$",
"this",
"->",
"buildCommand",
"(",
"$",
"cmd",
",",
"$",
"args",
")",
";",
"$",
"process",
... | Execute an external program.
This method uses as PDO like syntax to build commands.
@param string $cmd
Command to execute. If you need to pass arguments to a command. A PDO like syntax can be used.
For example: "ls -lsa %path".
@param array $args
An associative array containing the arguments to pass to $cmd.
For exa... | [
"Execute",
"an",
"external",
"program",
"."
] | 653e9cada38ae7f6debc3cce0d3a17402c715588 | https://github.com/phpsec/phpSec/blob/653e9cada38ae7f6debc3cce0d3a17402c715588/lib/phpSec/Common/Exec.php#L61-L87 |
190,373 | phpsec/phpSec | lib/phpSec/Common/Exec.php | Exec.buildCommand | private function buildCommand($cmd, $args = array()) {
while(list($name, $data) = each($args)) {
$safeData = false;
$filterType = mb_substr($name, 0, 1);
switch($filterType) {
case '%':
$safeData = escapeshellarg($data);
break;
case '!':
$safeData = esca... | php | private function buildCommand($cmd, $args = array()) {
while(list($name, $data) = each($args)) {
$safeData = false;
$filterType = mb_substr($name, 0, 1);
switch($filterType) {
case '%':
$safeData = escapeshellarg($data);
break;
case '!':
$safeData = esca... | [
"private",
"function",
"buildCommand",
"(",
"$",
"cmd",
",",
"$",
"args",
"=",
"array",
"(",
")",
")",
"{",
"while",
"(",
"list",
"(",
"$",
"name",
",",
"$",
"data",
")",
"=",
"each",
"(",
"$",
"args",
")",
")",
"{",
"$",
"safeData",
"=",
"fals... | Builds a command that is safe to execute.
@param string $cmd
Base command (with placeholders) to execute.
@param array $args
An associative array containing data to filter.
@return string
Returns a command that is safe to execute. | [
"Builds",
"a",
"command",
"that",
"is",
"safe",
"to",
"execute",
"."
] | 653e9cada38ae7f6debc3cce0d3a17402c715588 | https://github.com/phpsec/phpSec/blob/653e9cada38ae7f6debc3cce0d3a17402c715588/lib/phpSec/Common/Exec.php#L101-L121 |
190,374 | sop/x509 | lib/X509/CertificationPath/CertificationPath.php | CertificationPath.toTarget | public static function toTarget(Certificate $target,
CertificateBundle $trust_anchors, CertificateBundle $intermediate = null): self
{
$builder = new CertificationPathBuilder($trust_anchors);
return $builder->shortestPathToTarget($target, $intermediate);
} | php | public static function toTarget(Certificate $target,
CertificateBundle $trust_anchors, CertificateBundle $intermediate = null): self
{
$builder = new CertificationPathBuilder($trust_anchors);
return $builder->shortestPathToTarget($target, $intermediate);
} | [
"public",
"static",
"function",
"toTarget",
"(",
"Certificate",
"$",
"target",
",",
"CertificateBundle",
"$",
"trust_anchors",
",",
"CertificateBundle",
"$",
"intermediate",
"=",
"null",
")",
":",
"self",
"{",
"$",
"builder",
"=",
"new",
"CertificationPathBuilder"... | Build certification path to given target.
@param Certificate $target Target end-entity certificate
@param CertificateBundle $trust_anchors List of trust anchors
@param CertificateBundle|null $intermediate Optional intermediate
certificates
@return self | [
"Build",
"certification",
"path",
"to",
"given",
"target",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/CertificationPath/CertificationPath.php#L64-L69 |
190,375 | sop/x509 | lib/X509/CertificationPath/CertificationPath.php | CertificationPath.fromTrustAnchorToTarget | public static function fromTrustAnchorToTarget(Certificate $trust_anchor,
Certificate $target, CertificateBundle $intermediate = null): self
{
return self::toTarget($target, new CertificateBundle($trust_anchor),
$intermediate);
} | php | public static function fromTrustAnchorToTarget(Certificate $trust_anchor,
Certificate $target, CertificateBundle $intermediate = null): self
{
return self::toTarget($target, new CertificateBundle($trust_anchor),
$intermediate);
} | [
"public",
"static",
"function",
"fromTrustAnchorToTarget",
"(",
"Certificate",
"$",
"trust_anchor",
",",
"Certificate",
"$",
"target",
",",
"CertificateBundle",
"$",
"intermediate",
"=",
"null",
")",
":",
"self",
"{",
"return",
"self",
"::",
"toTarget",
"(",
"$"... | Build certification path from given trust anchor to target certificate,
using intermediate certificates from given bundle.
@param Certificate $trust_anchor Trust anchor certificate
@param Certificate $target Target end-entity certificate
@param CertificateBundle|null $intermediate Optional intermediate
certificates
@r... | [
"Build",
"certification",
"path",
"from",
"given",
"trust",
"anchor",
"to",
"target",
"certificate",
"using",
"intermediate",
"certificates",
"from",
"given",
"bundle",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/CertificationPath/CertificationPath.php#L81-L86 |
190,376 | sop/x509 | lib/X509/CertificationPath/CertificationPath.php | CertificationPath.endEntityCertificate | public function endEntityCertificate(): Certificate
{
if (!count($this->_certificates)) {
throw new \LogicException("No certificates.");
}
return $this->_certificates[count($this->_certificates) - 1];
} | php | public function endEntityCertificate(): Certificate
{
if (!count($this->_certificates)) {
throw new \LogicException("No certificates.");
}
return $this->_certificates[count($this->_certificates) - 1];
} | [
"public",
"function",
"endEntityCertificate",
"(",
")",
":",
"Certificate",
"{",
"if",
"(",
"!",
"count",
"(",
"$",
"this",
"->",
"_certificates",
")",
")",
"{",
"throw",
"new",
"\\",
"LogicException",
"(",
"\"No certificates.\"",
")",
";",
"}",
"return",
... | Get the end-entity certificate from the path.
@throws \LogicException If path is empty
@return Certificate | [
"Get",
"the",
"end",
"-",
"entity",
"certificate",
"from",
"the",
"path",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/CertificationPath/CertificationPath.php#L118-L124 |
190,377 | sop/x509 | lib/X509/CertificationPath/CertificationPath.php | CertificationPath.startsWith | public function startsWith(Certificate ...$certs): bool
{
$n = count($certs);
if ($n > count($this->_certificates)) {
return false;
}
for ($i = 0; $i < $n; ++$i) {
if (!$certs[$i]->equals($this->_certificates[$i])) {
return false;
}... | php | public function startsWith(Certificate ...$certs): bool
{
$n = count($certs);
if ($n > count($this->_certificates)) {
return false;
}
for ($i = 0; $i < $n; ++$i) {
if (!$certs[$i]->equals($this->_certificates[$i])) {
return false;
}... | [
"public",
"function",
"startsWith",
"(",
"Certificate",
"...",
"$",
"certs",
")",
":",
"bool",
"{",
"$",
"n",
"=",
"count",
"(",
"$",
"certs",
")",
";",
"if",
"(",
"$",
"n",
">",
"count",
"(",
"$",
"this",
"->",
"_certificates",
")",
")",
"{",
"r... | Check whether certification path starts with one ore more given
certificates in parameter order.
@param Certificate ...$certs Certificates
@return true | [
"Check",
"whether",
"certification",
"path",
"starts",
"with",
"one",
"ore",
"more",
"given",
"certificates",
"in",
"parameter",
"order",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/CertificationPath/CertificationPath.php#L144-L156 |
190,378 | sop/x509 | lib/X509/CertificationPath/Policy/PolicyTree.php | PolicyTree.processPolicies | public function processPolicies(ValidatorState $state, Certificate $cert): ValidatorState
{
$policies = $cert->tbsCertificate()
->extensions()
->certificatePolicies();
$tree = clone $this;
// (d.1) for each policy P not equal to anyPolicy
foreach ($policies as... | php | public function processPolicies(ValidatorState $state, Certificate $cert): ValidatorState
{
$policies = $cert->tbsCertificate()
->extensions()
->certificatePolicies();
$tree = clone $this;
// (d.1) for each policy P not equal to anyPolicy
foreach ($policies as... | [
"public",
"function",
"processPolicies",
"(",
"ValidatorState",
"$",
"state",
",",
"Certificate",
"$",
"cert",
")",
":",
"ValidatorState",
"{",
"$",
"policies",
"=",
"$",
"cert",
"->",
"tbsCertificate",
"(",
")",
"->",
"extensions",
"(",
")",
"->",
"certific... | Process policy information from the certificate.
Certificate policies extension must be present.
@param ValidatorState $state
@param Certificate $cert
@return ValidatorState | [
"Process",
"policy",
"information",
"from",
"the",
"certificate",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/CertificationPath/Policy/PolicyTree.php#L39-L58 |
190,379 | sop/x509 | lib/X509/CertificationPath/Policy/PolicyTree.php | PolicyTree.processMappings | public function processMappings(ValidatorState $state, Certificate $cert): ValidatorState
{
$tree = clone $this;
if ($state->policyMapping() > 0) {
$tree->_applyMappings($cert, $state);
} else if ($state->policyMapping() == 0) {
$tree->_deleteMappings($cert, $state);
... | php | public function processMappings(ValidatorState $state, Certificate $cert): ValidatorState
{
$tree = clone $this;
if ($state->policyMapping() > 0) {
$tree->_applyMappings($cert, $state);
} else if ($state->policyMapping() == 0) {
$tree->_deleteMappings($cert, $state);
... | [
"public",
"function",
"processMappings",
"(",
"ValidatorState",
"$",
"state",
",",
"Certificate",
"$",
"cert",
")",
":",
"ValidatorState",
"{",
"$",
"tree",
"=",
"clone",
"$",
"this",
";",
"if",
"(",
"$",
"state",
"->",
"policyMapping",
"(",
")",
">",
"0... | Process policy mappings from the certificate.
@param ValidatorState $state
@param Certificate $cert
@return ValidatorState | [
"Process",
"policy",
"mappings",
"from",
"the",
"certificate",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/CertificationPath/Policy/PolicyTree.php#L67-L80 |
190,380 | sop/x509 | lib/X509/CertificationPath/Policy/PolicyTree.php | PolicyTree.calculateIntersection | public function calculateIntersection(ValidatorState $state, array $policies): ValidatorState
{
$tree = clone $this;
$valid_policy_node_set = $tree->_validPolicyNodeSet();
// 2. If the valid_policy of any node in the valid_policy_node_set
// is not in the user-initial-policy-set and ... | php | public function calculateIntersection(ValidatorState $state, array $policies): ValidatorState
{
$tree = clone $this;
$valid_policy_node_set = $tree->_validPolicyNodeSet();
// 2. If the valid_policy of any node in the valid_policy_node_set
// is not in the user-initial-policy-set and ... | [
"public",
"function",
"calculateIntersection",
"(",
"ValidatorState",
"$",
"state",
",",
"array",
"$",
"policies",
")",
":",
"ValidatorState",
"{",
"$",
"tree",
"=",
"clone",
"$",
"this",
";",
"$",
"valid_policy_node_set",
"=",
"$",
"tree",
"->",
"_validPolicy... | Calculate policy intersection as specified in Wrap-Up Procedure 6.1.5.g.
@param ValidatorState $state
@param array $policies
@return ValidatorState | [
"Calculate",
"policy",
"intersection",
"as",
"specified",
"in",
"Wrap",
"-",
"Up",
"Procedure",
"6",
".",
"1",
".",
"5",
".",
"g",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/CertificationPath/Policy/PolicyTree.php#L89-L149 |
190,381 | sop/x509 | lib/X509/CertificationPath/Policy/PolicyTree.php | PolicyTree.policiesAtDepth | public function policiesAtDepth(int $i): array
{
$policies = array();
foreach ($this->_nodesAtDepth($i) as $node) {
$policies[] = new PolicyInformation($node->validPolicy(),
...$node->qualifiers());
}
return $policies;
} | php | public function policiesAtDepth(int $i): array
{
$policies = array();
foreach ($this->_nodesAtDepth($i) as $node) {
$policies[] = new PolicyInformation($node->validPolicy(),
...$node->qualifiers());
}
return $policies;
} | [
"public",
"function",
"policiesAtDepth",
"(",
"int",
"$",
"i",
")",
":",
"array",
"{",
"$",
"policies",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"_nodesAtDepth",
"(",
"$",
"i",
")",
"as",
"$",
"node",
")",
"{",
"$",
"policies... | Get policies at given policy tree depth.
@param int $i Depth in range 1..n
@return PolicyInformation[] | [
"Get",
"policies",
"at",
"given",
"policy",
"tree",
"depth",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/CertificationPath/Policy/PolicyTree.php#L157-L165 |
190,382 | sop/x509 | lib/X509/CertificationPath/Policy/PolicyTree.php | PolicyTree._processPolicy | protected function _processPolicy(PolicyInformation $policy,
ValidatorState $state)
{
$p_oid = $policy->oid();
$i = $state->index();
$match_count = 0;
// (d.1.i) for each node of depth i-1 in the valid_policy_tree...
foreach ($this->_nodesAtDepth($i - 1) as $node) {
... | php | protected function _processPolicy(PolicyInformation $policy,
ValidatorState $state)
{
$p_oid = $policy->oid();
$i = $state->index();
$match_count = 0;
// (d.1.i) for each node of depth i-1 in the valid_policy_tree...
foreach ($this->_nodesAtDepth($i - 1) as $node) {
... | [
"protected",
"function",
"_processPolicy",
"(",
"PolicyInformation",
"$",
"policy",
",",
"ValidatorState",
"$",
"state",
")",
"{",
"$",
"p_oid",
"=",
"$",
"policy",
"->",
"oid",
"(",
")",
";",
"$",
"i",
"=",
"$",
"state",
"->",
"index",
"(",
")",
";",
... | Process single policy information.
@param PolicyInformation $policy
@param ValidatorState $state | [
"Process",
"single",
"policy",
"information",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/CertificationPath/Policy/PolicyTree.php#L173-L200 |
190,383 | sop/x509 | lib/X509/CertificationPath/Policy/PolicyTree.php | PolicyTree._processAnyPolicy | protected function _processAnyPolicy(PolicyInformation $policy,
Certificate $cert, ValidatorState $state)
{
$i = $state->index();
// if (a) inhibit_anyPolicy is greater than 0 or
// (b) i<n and the certificate is self-issued
if (!($state->inhibitAnyPolicy() > 0 ||
... | php | protected function _processAnyPolicy(PolicyInformation $policy,
Certificate $cert, ValidatorState $state)
{
$i = $state->index();
// if (a) inhibit_anyPolicy is greater than 0 or
// (b) i<n and the certificate is self-issued
if (!($state->inhibitAnyPolicy() > 0 ||
... | [
"protected",
"function",
"_processAnyPolicy",
"(",
"PolicyInformation",
"$",
"policy",
",",
"Certificate",
"$",
"cert",
",",
"ValidatorState",
"$",
"state",
")",
"{",
"$",
"i",
"=",
"$",
"state",
"->",
"index",
"(",
")",
";",
"// if (a) inhibit_anyPolicy is grea... | Process anyPolicy policy information.
@param PolicyInformation $policy
@param Certificate $cert
@param ValidatorState $state | [
"Process",
"anyPolicy",
"policy",
"information",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/CertificationPath/Policy/PolicyTree.php#L209-L231 |
190,384 | sop/x509 | lib/X509/CertificationPath/Policy/PolicyTree.php | PolicyTree._applyMappings | protected function _applyMappings(Certificate $cert, ValidatorState $state)
{
$policy_mappings = $cert->tbsCertificate()
->extensions()
->policyMappings();
// (6.1.4. b.1.) for each node in the valid_policy_tree of depth i...
foreach ($policy_mappings->flattenedMappin... | php | protected function _applyMappings(Certificate $cert, ValidatorState $state)
{
$policy_mappings = $cert->tbsCertificate()
->extensions()
->policyMappings();
// (6.1.4. b.1.) for each node in the valid_policy_tree of depth i...
foreach ($policy_mappings->flattenedMappin... | [
"protected",
"function",
"_applyMappings",
"(",
"Certificate",
"$",
"cert",
",",
"ValidatorState",
"$",
"state",
")",
"{",
"$",
"policy_mappings",
"=",
"$",
"cert",
"->",
"tbsCertificate",
"(",
")",
"->",
"extensions",
"(",
")",
"->",
"policyMappings",
"(",
... | Apply policy mappings to the policy tree.
@param Certificate $cert
@param ValidatorState $state | [
"Apply",
"policy",
"mappings",
"to",
"the",
"policy",
"tree",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/CertificationPath/Policy/PolicyTree.php#L239-L263 |
190,385 | sop/x509 | lib/X509/CertificationPath/Policy/PolicyTree.php | PolicyTree._pruneTree | protected function _pruneTree(int $depth): int
{
for ($i = $depth; $i > 0; --$i) {
foreach ($this->_nodesAtDepth($i) as $node) {
if (!count($node)) {
$node->remove();
}
}
}
// if root has no children left
if ... | php | protected function _pruneTree(int $depth): int
{
for ($i = $depth; $i > 0; --$i) {
foreach ($this->_nodesAtDepth($i) as $node) {
if (!count($node)) {
$node->remove();
}
}
}
// if root has no children left
if ... | [
"protected",
"function",
"_pruneTree",
"(",
"int",
"$",
"depth",
")",
":",
"int",
"{",
"for",
"(",
"$",
"i",
"=",
"$",
"depth",
";",
"$",
"i",
">",
"0",
";",
"--",
"$",
"i",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"_nodesAtDepth",
"(",
"$"... | Prune tree starting from given depth.
@param int $depth
@return int The number of nodes left in a tree | [
"Prune",
"tree",
"starting",
"from",
"given",
"depth",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/CertificationPath/Policy/PolicyTree.php#L335-L350 |
190,386 | sop/x509 | lib/X509/CertificationPath/Policy/PolicyTree.php | PolicyTree._nodesAtDepth | protected function _nodesAtDepth(int $i): array
{
if (!$this->_root) {
return array();
}
$depth = 0;
$nodes = array($this->_root);
while ($depth < $i) {
$nodes = self::_gatherChildren(...$nodes);
if (!count($nodes)) {
break;... | php | protected function _nodesAtDepth(int $i): array
{
if (!$this->_root) {
return array();
}
$depth = 0;
$nodes = array($this->_root);
while ($depth < $i) {
$nodes = self::_gatherChildren(...$nodes);
if (!count($nodes)) {
break;... | [
"protected",
"function",
"_nodesAtDepth",
"(",
"int",
"$",
"i",
")",
":",
"array",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_root",
")",
"{",
"return",
"array",
"(",
")",
";",
"}",
"$",
"depth",
"=",
"0",
";",
"$",
"nodes",
"=",
"array",
"(",
"... | Get all nodes at given depth.
@param int $i
@return PolicyNode[] | [
"Get",
"all",
"nodes",
"at",
"given",
"depth",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/CertificationPath/Policy/PolicyTree.php#L358-L373 |
190,387 | sop/x509 | lib/X509/CertificationPath/Policy/PolicyTree.php | PolicyTree._gatherChildren | private static function _gatherChildren(PolicyNode ...$nodes): array
{
$children = array();
foreach ($nodes as $node) {
$children = array_merge($children, $node->children());
}
return $children;
} | php | private static function _gatherChildren(PolicyNode ...$nodes): array
{
$children = array();
foreach ($nodes as $node) {
$children = array_merge($children, $node->children());
}
return $children;
} | [
"private",
"static",
"function",
"_gatherChildren",
"(",
"PolicyNode",
"...",
"$",
"nodes",
")",
":",
"array",
"{",
"$",
"children",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"nodes",
"as",
"$",
"node",
")",
"{",
"$",
"children",
"=",
"array_me... | Gather all children of given nodes to a flattened array.
@param PolicyNode ...$nodes
@return PolicyNode[] | [
"Gather",
"all",
"children",
"of",
"given",
"nodes",
"to",
"a",
"flattened",
"array",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/CertificationPath/Policy/PolicyTree.php#L412-L419 |
190,388 | sop/x509 | lib/X509/Certificate/Extension/ExtendedKeyUsageExtension.php | ExtendedKeyUsageExtension.has | public function has(string ...$oids): bool
{
foreach ($oids as $oid) {
if (!in_array($oid, $this->_purposes)) {
return false;
}
}
return true;
} | php | public function has(string ...$oids): bool
{
foreach ($oids as $oid) {
if (!in_array($oid, $this->_purposes)) {
return false;
}
}
return true;
} | [
"public",
"function",
"has",
"(",
"string",
"...",
"$",
"oids",
")",
":",
"bool",
"{",
"foreach",
"(",
"$",
"oids",
"as",
"$",
"oid",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"oid",
",",
"$",
"this",
"->",
"_purposes",
")",
")",
"{",
"re... | Whether purposes are present.
If multiple purposes are checked, all must be present.
@param string ...$oids
@return bool | [
"Whether",
"purposes",
"are",
"present",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Certificate/Extension/ExtendedKeyUsageExtension.php#L91-L99 |
190,389 | phpsec/phpSec | lib/phpSec/Http/Url.php | Url.create | public function create($url) {
$part = parse_url($url);
$appendQuery = false;
if(isset($part['query'])) {
$appendQuery = true;
}
$request = $this->getRequest($url);
$token = $this->getToken($request);
if($appendQuery === true) {
return $url.'&'.$this->getParam.'='.$token;... | php | public function create($url) {
$part = parse_url($url);
$appendQuery = false;
if(isset($part['query'])) {
$appendQuery = true;
}
$request = $this->getRequest($url);
$token = $this->getToken($request);
if($appendQuery === true) {
return $url.'&'.$this->getParam.'='.$token;... | [
"public",
"function",
"create",
"(",
"$",
"url",
")",
"{",
"$",
"part",
"=",
"parse_url",
"(",
"$",
"url",
")",
";",
"$",
"appendQuery",
"=",
"false",
";",
"if",
"(",
"isset",
"(",
"$",
"part",
"[",
"'query'",
"]",
")",
")",
"{",
"$",
"appendQuer... | Create a security token for a URL.
@param string $url
URL to create token for.
@return string
Return a URL with the security token included. | [
"Create",
"a",
"security",
"token",
"for",
"a",
"URL",
"."
] | 653e9cada38ae7f6debc3cce0d3a17402c715588 | https://github.com/phpsec/phpSec/blob/653e9cada38ae7f6debc3cce0d3a17402c715588/lib/phpSec/Http/Url.php#L48-L65 |
190,390 | phpsec/phpSec | lib/phpSec/Http/Url.php | Url.verify | public function verify($url = null) {
if($url === null) {
$url = $_SERVER['REQUEST_URI'];
}
$part = parse_url($url);
if(isset($part['query'])) {
parse_str($part['query'], $query);
}
if(!isset($query[$this->getParam])) {
return false;
}
$request = $this->getReques... | php | public function verify($url = null) {
if($url === null) {
$url = $_SERVER['REQUEST_URI'];
}
$part = parse_url($url);
if(isset($part['query'])) {
parse_str($part['query'], $query);
}
if(!isset($query[$this->getParam])) {
return false;
}
$request = $this->getReques... | [
"public",
"function",
"verify",
"(",
"$",
"url",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"url",
"===",
"null",
")",
"{",
"$",
"url",
"=",
"$",
"_SERVER",
"[",
"'REQUEST_URI'",
"]",
";",
"}",
"$",
"part",
"=",
"parse_url",
"(",
"$",
"url",
")",
"... | Verify if a URL.
@return boolean
Return true if a security token was included in the request
and the URL was not manipulated. | [
"Verify",
"if",
"a",
"URL",
"."
] | 653e9cada38ae7f6debc3cce0d3a17402c715588 | https://github.com/phpsec/phpSec/blob/653e9cada38ae7f6debc3cce0d3a17402c715588/lib/phpSec/Http/Url.php#L74-L94 |
190,391 | phpsec/phpSec | lib/phpSec/Http/Url.php | Url.getRequest | private function getRequest($url) {
$part = parse_url($url);
if(isset($part['query'])) {
parse_str($part['query'], $query);
if(isset($query[$this->getParam])) {
unset($query[$this->getParam]);
}
if(sizeof($query) > 0) {
$request = $part['path'].http_build_query($query... | php | private function getRequest($url) {
$part = parse_url($url);
if(isset($part['query'])) {
parse_str($part['query'], $query);
if(isset($query[$this->getParam])) {
unset($query[$this->getParam]);
}
if(sizeof($query) > 0) {
$request = $part['path'].http_build_query($query... | [
"private",
"function",
"getRequest",
"(",
"$",
"url",
")",
"{",
"$",
"part",
"=",
"parse_url",
"(",
"$",
"url",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"part",
"[",
"'query'",
"]",
")",
")",
"{",
"parse_str",
"(",
"$",
"part",
"[",
"'query'",
"]"... | Get the request from a string to create a security token from.
@param string $url
URL to get request striong from.
@return string
Request string. | [
"Get",
"the",
"request",
"from",
"a",
"string",
"to",
"create",
"a",
"security",
"token",
"from",
"."
] | 653e9cada38ae7f6debc3cce0d3a17402c715588 | https://github.com/phpsec/phpSec/blob/653e9cada38ae7f6debc3cce0d3a17402c715588/lib/phpSec/Http/Url.php#L105-L123 |
190,392 | phpsec/phpSec | lib/phpSec/Http/Url.php | Url.getToken | private function getToken($request) {
$hash = hash('sha256', $request.$this->psl->getUid());
return substr($hash, 0, 4).substr($hash, 16, 4).substr($hash, 32, 4).substr($hash, 48, 4);
} | php | private function getToken($request) {
$hash = hash('sha256', $request.$this->psl->getUid());
return substr($hash, 0, 4).substr($hash, 16, 4).substr($hash, 32, 4).substr($hash, 48, 4);
} | [
"private",
"function",
"getToken",
"(",
"$",
"request",
")",
"{",
"$",
"hash",
"=",
"hash",
"(",
"'sha256'",
",",
"$",
"request",
".",
"$",
"this",
"->",
"psl",
"->",
"getUid",
"(",
")",
")",
";",
"return",
"substr",
"(",
"$",
"hash",
",",
"0",
"... | Get a security token from a request.
@param string $request
Request to create token from.
@return string
Returns a security token. | [
"Get",
"a",
"security",
"token",
"from",
"a",
"request",
"."
] | 653e9cada38ae7f6debc3cce0d3a17402c715588 | https://github.com/phpsec/phpSec/blob/653e9cada38ae7f6debc3cce0d3a17402c715588/lib/phpSec/Http/Url.php#L134-L139 |
190,393 | phpsec/phpSec | lib/phpSec/Auth/Otpcard.php | Otpcard.create | public static function create($length = 6, $num = 32) {
$card['list'] = array();
for($i = 0; $i < $num; $i++) {
$card['list'][$i] = phpsecRand::str($length);
$card['usable'][$i] = true;
}
$card = self::save($card);
return $card['id'];
} | php | public static function create($length = 6, $num = 32) {
$card['list'] = array();
for($i = 0; $i < $num; $i++) {
$card['list'][$i] = phpsecRand::str($length);
$card['usable'][$i] = true;
}
$card = self::save($card);
return $card['id'];
} | [
"public",
"static",
"function",
"create",
"(",
"$",
"length",
"=",
"6",
",",
"$",
"num",
"=",
"32",
")",
"{",
"$",
"card",
"[",
"'list'",
"]",
"=",
"array",
"(",
")",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"$",
"num",
";",... | Create a list of 64 pre shared one-time-passwords,
or a so called password card.
This differs from phpsecOtp::generate() because passwords generated by
this function is saved permanent and can be validated on a later time. | [
"Create",
"a",
"list",
"of",
"64",
"pre",
"shared",
"one",
"-",
"time",
"-",
"passwords",
"or",
"a",
"so",
"called",
"password",
"card",
"."
] | 653e9cada38ae7f6debc3cce0d3a17402c715588 | https://github.com/phpsec/phpSec/blob/653e9cada38ae7f6debc3cce0d3a17402c715588/lib/phpSec/Auth/Otpcard.php#L28-L38 |
190,394 | phpsec/phpSec | lib/phpSec/Auth/Otpcard.php | Otpcard.validate | public static function validate($cardId, $selected, $otp) {
$card = self::load($cardId);
if(isset($card['usable'][$selected]) && $card['usable'][$selected] === true) {
if($card['list'][$selected] == $otp) {
unset($card['usable'][$selected]);
self::save($card);
return true;
}... | php | public static function validate($cardId, $selected, $otp) {
$card = self::load($cardId);
if(isset($card['usable'][$selected]) && $card['usable'][$selected] === true) {
if($card['list'][$selected] == $otp) {
unset($card['usable'][$selected]);
self::save($card);
return true;
}... | [
"public",
"static",
"function",
"validate",
"(",
"$",
"cardId",
",",
"$",
"selected",
",",
"$",
"otp",
")",
"{",
"$",
"card",
"=",
"self",
"::",
"load",
"(",
"$",
"cardId",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"card",
"[",
"'usable'",
"]",
"["... | Validates a pre shared one-time-password.
@param string $cardId
Card ID.
@param integer $selected
OTP ID the user is expected to use. Usually
provided by phpsecOtp::cardSelect().
@param string $otp
The password provided by the user.
@return bolean | [
"Validates",
"a",
"pre",
"shared",
"one",
"-",
"time",
"-",
"password",
"."
] | 653e9cada38ae7f6debc3cce0d3a17402c715588 | https://github.com/phpsec/phpSec/blob/653e9cada38ae7f6debc3cce0d3a17402c715588/lib/phpSec/Auth/Otpcard.php#L55-L66 |
190,395 | phpsec/phpSec | lib/phpSec/Auth/Otpcard.php | Otpcard.select | public static function select($cardId) {
$card = self::load($cardId);
$available = array_keys($card['usable']);
$selected = Rand::int(0, count($available)-1);
return $available[$selected];
} | php | public static function select($cardId) {
$card = self::load($cardId);
$available = array_keys($card['usable']);
$selected = Rand::int(0, count($available)-1);
return $available[$selected];
} | [
"public",
"static",
"function",
"select",
"(",
"$",
"cardId",
")",
"{",
"$",
"card",
"=",
"self",
"::",
"load",
"(",
"$",
"cardId",
")",
";",
"$",
"available",
"=",
"array_keys",
"(",
"$",
"card",
"[",
"'usable'",
"]",
")",
";",
"$",
"selected",
"=... | Select a pre shared OTP from a list that a user can use.
@param string $cardId
Card ID to select a OTP from.
@return integer
OTP ID of a available OTP. | [
"Select",
"a",
"pre",
"shared",
"OTP",
"from",
"a",
"list",
"that",
"a",
"user",
"can",
"use",
"."
] | 653e9cada38ae7f6debc3cce0d3a17402c715588 | https://github.com/phpsec/phpSec/blob/653e9cada38ae7f6debc3cce0d3a17402c715588/lib/phpSec/Auth/Otpcard.php#L77-L84 |
190,396 | phpsec/phpSec | lib/phpSec/Auth/Otpcard.php | Otpcard.load | public static function load($cardId) {
$card = Core::$store->read('otp-card', $cardId);
if($card !== false) {
if($card['hash'] !== hash(self::HASH_TYPE, $card['list'])) {
return false;
}
$card['list'] = json_decode(base64_decode($card['list']), true);
return $card;
}
retu... | php | public static function load($cardId) {
$card = Core::$store->read('otp-card', $cardId);
if($card !== false) {
if($card['hash'] !== hash(self::HASH_TYPE, $card['list'])) {
return false;
}
$card['list'] = json_decode(base64_decode($card['list']), true);
return $card;
}
retu... | [
"public",
"static",
"function",
"load",
"(",
"$",
"cardId",
")",
"{",
"$",
"card",
"=",
"Core",
"::",
"$",
"store",
"->",
"read",
"(",
"'otp-card'",
",",
"$",
"cardId",
")",
";",
"if",
"(",
"$",
"card",
"!==",
"false",
")",
"{",
"if",
"(",
"$",
... | Load a password card.
@param string $cardId
Card ID.
@return array
A array containing the card data. | [
"Load",
"a",
"password",
"card",
"."
] | 653e9cada38ae7f6debc3cce0d3a17402c715588 | https://github.com/phpsec/phpSec/blob/653e9cada38ae7f6debc3cce0d3a17402c715588/lib/phpSec/Auth/Otpcard.php#L94-L104 |
190,397 | phpsec/phpSec | lib/phpSec/Auth/Otpcard.php | Otpcard.save | private static function save($card) {
$card = self::hash($card);
/* TODO: Encrypt before saving. */
if(Core::$store->write('otp-card', $card['id'], $card)) {
return $card;
}
return false;
} | php | private static function save($card) {
$card = self::hash($card);
/* TODO: Encrypt before saving. */
if(Core::$store->write('otp-card', $card['id'], $card)) {
return $card;
}
return false;
} | [
"private",
"static",
"function",
"save",
"(",
"$",
"card",
")",
"{",
"$",
"card",
"=",
"self",
"::",
"hash",
"(",
"$",
"card",
")",
";",
"/* TODO: Encrypt before saving. */",
"if",
"(",
"Core",
"::",
"$",
"store",
"->",
"write",
"(",
"'otp-card'",
",",
... | Save a password card.
@param array $card
Array containing a already hashed card.
@return mixed
Returns card arryar on success and false on error. | [
"Save",
"a",
"password",
"card",
"."
] | 653e9cada38ae7f6debc3cce0d3a17402c715588 | https://github.com/phpsec/phpSec/blob/653e9cada38ae7f6debc3cce0d3a17402c715588/lib/phpSec/Auth/Otpcard.php#L130-L138 |
190,398 | phpsec/phpSec | lib/phpSec/Auth/Otpcard.php | Otpcard.hash | private static function hash($card) {
/* We are encoding the password list just because we want to make
* the file look nice, and to avoid bugs with special characters. */
$card['list'] = base64_encode(json_encode($card['list']));
$card['hash'] = hash(self::HASH_TYPE, $card['list']);
$card['id'] ... | php | private static function hash($card) {
/* We are encoding the password list just because we want to make
* the file look nice, and to avoid bugs with special characters. */
$card['list'] = base64_encode(json_encode($card['list']));
$card['hash'] = hash(self::HASH_TYPE, $card['list']);
$card['id'] ... | [
"private",
"static",
"function",
"hash",
"(",
"$",
"card",
")",
"{",
"/* We are encoding the password list just because we want to make\n * the file look nice, and to avoid bugs with special characters. */",
"$",
"card",
"[",
"'list'",
"]",
"=",
"base64_encode",
"(",
"json_en... | Prepeare the password card for saving.
@param array $card
Array containing the card data to hash.
@return array
Array containing hashed card data. Ready for phpsecOtpcard::save(). | [
"Prepeare",
"the",
"password",
"card",
"for",
"saving",
"."
] | 653e9cada38ae7f6debc3cce0d3a17402c715588 | https://github.com/phpsec/phpSec/blob/653e9cada38ae7f6debc3cce0d3a17402c715588/lib/phpSec/Auth/Otpcard.php#L149-L157 |
190,399 | sop/x509 | lib/X509/Certificate/Extension/CertificatePolicy/DisplayText.php | DisplayText.toASN1 | public function toASN1(): StringType
{
switch ($this->_tag) {
case Element::TYPE_IA5_STRING:
return new IA5String($this->_text);
case Element::TYPE_VISIBLE_STRING:
return new VisibleString($this->_text);
case Element::TYPE_BMP_STRING:
... | php | public function toASN1(): StringType
{
switch ($this->_tag) {
case Element::TYPE_IA5_STRING:
return new IA5String($this->_text);
case Element::TYPE_VISIBLE_STRING:
return new VisibleString($this->_text);
case Element::TYPE_BMP_STRING:
... | [
"public",
"function",
"toASN1",
"(",
")",
":",
"StringType",
"{",
"switch",
"(",
"$",
"this",
"->",
"_tag",
")",
"{",
"case",
"Element",
"::",
"TYPE_IA5_STRING",
":",
"return",
"new",
"IA5String",
"(",
"$",
"this",
"->",
"_text",
")",
";",
"case",
"Ele... | Generate ASN.1 element.
@throws \UnexpectedValueException
@return StringType | [
"Generate",
"ASN",
".",
"1",
"element",
"."
] | 405cf31f253225b45f0868c5ea4ef2e1a7b75f87 | https://github.com/sop/x509/blob/405cf31f253225b45f0868c5ea4ef2e1a7b75f87/lib/X509/Certificate/Extension/CertificatePolicy/DisplayText.php#L86-L101 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.