Lines Matching refs:mapping

90      * ASN.1 object identifier reverse mapping
107 * If the mapping type is self::TYPE_ANY what do we actually encode it as?
135 * Type mapping table for the ANY type.
138 * Unambiguous types get the direct mapping (int/real/bool).
169 * String type to character size mapping table.
510 * Provides an ASN.1 semantic mapping ($mapping) from a parsed BER-encoding to a human readable format.
515 * @param array $mapping
519 public static function asn1map(array $decoded, $mapping, $special = [])
521 if (isset($mapping['explicit']) && is_array($decoded['content'])) {
526 case $mapping['type'] == self::TYPE_ANY:
534 return [$inmap => self::asn1map($decoded, ['type' => $intype] + $mapping, $special)];
537 case $mapping['type'] == self::TYPE_CHOICE:
538 foreach ($mapping['children'] as $key => $option) {
558 case isset($mapping['implicit']):
559 case isset($mapping['explicit']):
560 case $decoded['type'] == $mapping['type']:
563 // if $decoded['type'] and $mapping['type'] are both strings, but different types of strings,
568 case $mapping['type'] < 18:
569 case $mapping['type'] > 30:
574 if (isset($mapping['implicit'])) {
575 $decoded['type'] = $mapping['type'];
583 if (isset($mapping['min']) && isset($mapping['max'])) {
584 $child = $mapping['children'];
597 foreach ($mapping['children'] as $key => $child) {
603 // Get the mapping and input class & constant.
647 // Fail mapping if all input items have not been consumed.
655 if (isset($mapping['min']) && isset($mapping['max'])) {
656 $child = $mapping['children'];
673 foreach ($mapping['children'] as $key => $child) {
717 foreach ($mapping['children'] as $key => $child) {
736 // in theory, doing isset($mapping['implicit']) would work but malformed certs do exist
743 if (isset($mapping['mapping'])) {
754 $bits = count($mapping['mapping']) == $size ? [] : array_fill(0, count($mapping['mapping']) - $size, false);
763 $map = array_reverse($mapping['mapping']);
792 if (isset($mapping['implicit'])) {
795 if (isset($mapping['mapping'])) {
797 return isset($mapping['mapping'][$temp]) ?
798 $mapping['mapping'][$temp] :
828 * DER-encodes an ASN.1 semantic mapping ($mapping). Some libraries would probably call this function
834 * @param array $mapping
838 public static function encodeDER($source, $mapping, $special = [])
841 return self::encode_der($source, $mapping, null, $special);
848 * @param array $mapping
853 private static function encode_der($source, array $mapping, $idx = null, array $special = [])
860 if (isset($mapping['default']) && $source === $mapping['default']) {
871 $tag = $mapping['type'];
879 if (isset($mapping['min']) && isset($mapping['max'])) {
881 $child = $mapping['children'];
895 if ($mapping['type'] == self::TYPE_SET) {
903 foreach ($mapping['children'] as $key => $child) {
947 foreach ($mapping['children'] as $key => $child) {
981 if ($temp && isset($mapping['cast'])) {
982 $temp[0] = chr(($mapping['class'] << 6) | ($tag & 0x20) | $mapping['cast']);
988 if (!isset($mapping['mapping'])) {
994 $value = array_search($source, $mapping['mapping']);
1007 $format = $mapping['type'] == self::TYPE_UTC_TIME ? 'y' : 'Y';
1016 if (isset($mapping['mapping'])) {
1017 $bits = array_fill(0, count($mapping['mapping']), 0);
1019 for ($i = 0; $i < count($mapping['mapping']); $i++) {
1020 if (in_array($mapping['mapping'][$i], $source)) {
1026 if (isset($mapping['min']) && $mapping['min'] >= 1 && $size < $mapping['min']) {
1027 $size = $mapping['min'] - 1;
1035 for ($i = $size + 1; $i < count($mapping['mapping']); $i++) {
1066 return self::encode_der(null, ['type' => self::TYPE_NULL] + $mapping, null, $special);
1069 return self::encode_der($source, ['type' => self::TYPE_INTEGER] + $mapping, null, $special);
1071 return self::encode_der($source, ['type' => self::TYPE_REAL] + $mapping, null, $special);
1073 return self::encode_der($source, ['type' => self::TYPE_BOOLEAN] + $mapping, null, $special);
1078 return self::encode_der($source[$typename], ['type' => $outtype] + $mapping, null, $special);
1093 return self::encode_der($source, $filters + $mapping, null, $special);
1121 if (isset($mapping['cast'])) {
1122 if (isset($mapping['explicit']) || $mapping['type'] == self::TYPE_CHOICE) {
1124 $tag = ($mapping['class'] << 6) | 0x20 | $mapping['cast'];
1126 $tag = ($mapping['class'] << 6) | (ord($temp[0]) & 0x20) | $mapping['cast'];
1309 * Load the relevant OIDs for a particular ASN.1 semantic mapping.
1495 * no OID to name mapping is available. The problem with this is that what may be an unmapped OID in one version
1499 * This method will return the OID if a name is passed to it and if no mapping is avialable it'll assume that