/** * Map attribute values from ANY type to attribute-specific internal * format. * * @param array ref $root * @param string $path * @param object $asn1 * @access private */ function _mapInAttributes(&$root, $path, $asn1) { $attributes = &$this->_subArray($root, $path); if (is_array($attributes)) { for ($i = 0; $i < count($attributes); $i++) { $id = $attributes[$i]['type']; /* $value contains the DER encoding of an ASN.1 value corresponding to the attribute type identified by type */ $map = $this->_getMapping($id); if (is_array($attributes[$i]['value'])) { $values = &$attributes[$i]['value']; for ($j = 0; $j < count($values); $j++) { $value = $asn1->encodeDER($values[$j], $this->AttributeValue); $decoded = $asn1->decodeBER($value); if (!is_bool($map)) { $mapped = $asn1->asn1map($decoded[0], $map); if ($mapped !== false) { $values[$j] = $mapped; } if ($id == 'pkcs-9-at-extensionRequest') { $this->_mapInExtensions($values, $j, $asn1); } } elseif ($map) { $values[$j] = base64_encode($value); } } } } } }
/** * Map DN values from ANY type to DN-specific internal * format. * * @param array ref $root * @param string $path * @param object $asn1 * @access private */ function _mapInDNs(&$root, $path, $asn1) { $dns =& $this->_subArray($root, $path); if (is_array($dns)) { for ($i = 0; $i < count($dns); $i++) { for ($j = 0; $j < count($dns[$i]); $j++) { $type = $dns[$i][$j]['type']; $value =& $dns[$i][$j]['value']; if (is_object($value) && $value instanceof Element) { $map = $this->_getMapping($type); if (!is_bool($map)) { $decoded = $asn1->decodeBER($value); $value = $asn1->asn1map($decoded[0], $map); } } } } } }