Home | History | Annotate | Download | only in ber

Lines Matching refs:substrate

27     def valueDecoder(self, substrate, asn1Spec,
33 def indefLenValueDecoder(self, substrate, asn1Spec,
42 def substrateCollector(asn1Object, substrate, length):
43 return substrate[:length], substrate[length:]
59 def valueDecoder(self, substrate, asn1Spec,
66 substrate, length
69 head, tail = substrate[:length], substrate[length:]
75 def indefLenValueDecoder(self, substrate, asn1Spec,
82 substrate, length
85 value, substrate = decodeFun(substrate, asn1Spec, tagSet, length, **options)
87 eooMarker, substrate = decodeFun(substrate, allowEoo=True, **options)
90 return value, substrate
101 def valueDecoder(self, substrate, asn1Spec,
109 head, tail = substrate[:length], substrate[length:]
130 def valueDecoder(self, substrate, asn1Spec,
134 head, tail = substrate[:length], substrate[length:]
138 substrate, length)
141 raise error.PyAsn1Error('Empty BIT STRING substrate')
180 def indefLenValueDecoder(self, substrate, asn1Spec,
186 return substrateFun(self._createComponent(asn1Spec, tagSet, noValue, **options), substrate, length)
193 while substrate:
194 component, substrate = decodeFun(substrate, self.protoComponent,
212 raise error.SubstrateUnderrunError('No EOO seen before substrate ends')
214 return self._createComponent(asn1Spec, tagSet, bitString, **options), substrate
221 def valueDecoder(self, substrate, asn1Spec,
225 head, tail = substrate[:length], substrate[length:]
229 substrate, length)
250 def indefLenValueDecoder(self, substrate, asn1Spec,
256 return substrateFun(asn1Object, substrate, length)
263 while substrate:
264 component, substrate = decodeFun(substrate,
273 'No EOO seen before substrate ends'
276 return self._createComponent(asn1Spec, tagSet, header, **options), substrate
282 def valueDecoder(self, substrate, asn1Spec,
290 head, tail = substrate[:length], substrate[length:]
295 raise error.PyAsn1Error('Unexpected %d-octet substrate for Null' % length)
303 def valueDecoder(self, substrate, asn1Spec,
310 head, tail = substrate[:length], substrate[length:]
312 raise error.PyAsn1Error('Empty substrate')
332 'Short substrate for sub-OID past %s' % (oid,)
360 def valueDecoder(self, substrate, asn1Spec,
367 head, tail = substrate[:length], substrate[length:]
447 def _decodeComponents(self, substrate, tagSet=None, decodeFun=None, **options):
450 substrate:
451 component, substrate = decodeFun(substrate, **options)
468 # and additional tags recovered from the substrate
479 return asn1Object, substrate
481 def valueDecoder(self, substrate, asn1Spec,
488 head, tail = substrate[:length], substrate[length:]
498 return substrateFun(asn1Object, substrate, length)
614 def indefLenValueDecoder(self, substrate, asn1Spec,
629 return substrateFun(asn1Object, substrate, length)
633 substrate, tagSet=tagSet, decodeFun=decodeFun, allowEoo=True, **options
647 while substrate:
665 component, substrate = decodeFun(substrate, asn1Spec, allowEoo=True, **options)
686 'No EOO seen before substrate ends'
739 while substrate:
740 component, substrate = decodeFun(substrate, componentType, allowEoo=True, **options)
753 'No EOO seen before substrate ends'
756 return asn1Object, substrate
789 def valueDecoder(self, substrate, asn1Spec,
793 head, tail = substrate[:length], substrate[length:]
801 return substrateFun(asn1Object, substrate, length)
825 def indefLenValueDecoder(self, substrate, asn1Spec,
835 return substrateFun(asn1Object, substrate, length)
838 component, substrate = decodeFun(
839 substrate, asn1Object.componentType.tagMapUnique, **options
842 eooMarker, substrate = decodeFun(
843 substrate, allowEoo=True, **options
846 raise error.PyAsn1Error('No EOO seen before substrate ends')
849 component, substrate = decodeFun(
850 substrate, asn1Object.componentType.tagMapUnique,
863 return asn1Object, substrate
869 def valueDecoder(self, substrate, asn1Spec,
876 # untagged Any container, recover inner header substrate
877 length += len(fullSubstrate) - len(substrate)
878 substrate = fullSubstrate
882 substrate, length)
884 head, tail = substrate[:length], substrate[length:]
888 def indefLenValueDecoder(self, substrate, asn1Spec,
893 # tagged Any type -- consume header substrate
898 # untagged Any, recover header substrate
899 header = fullSubstrate[:-len(substrate)]
906 return substrateFun(asn1Object, header + substrate, length + len(header))
911 while substrate:
912 component, substrate = decodeFun(substrate, asn1Spec,
920 'No EOO seen before substrate ends'
923 return header, substrate
925 return self._createComponent(asn1Spec, tagSet, header, **options), substrate
1061 def __call__(self, substrate, asn1Spec=None,
1072 logger('decoder called at scope %s with state %d, working with up to %d octets of substrate: %s' % (debug.scope, state, len(substrate), debug.hexdump(substrate)))
1078 if substrate[:2] == self.__eooSentinel:
1081 return eoo.endOfOctets, substrate[2:]
1090 fullSubstrate = substrate
1094 if not substrate:
1100 firstOctet = substrate[0]
1101 substrate = substrate[1:]
1115 integerTag = oct2int(substrate[lengthOctetIdx])
1121 substrate = substrate[lengthOctetIdx:]
1149 if not substrate:
1153 firstOctet = oct2int(substrate[0])
1160 encodedLength = octs2ints(substrate[1:size + 1])
1176 substrate = substrate[size:]
1181 if len(substrate) < length:
1182 raise error.SubstrateUnderrunError('%d-octet short' % (length - len(substrate)))
1185 logger('value length decoded into %d, payload substrate is: %s' % (length, debug.hexdump(length == -1 and substrate or substrate[:length])))
1198 # The first case allows for complete tag recovery from substrate
1202 # In either case a set of tags (tagSet) is coming from substrate
1282 value, substrate = concreteDecoder.indefLenValueDecoder(
1283 substrate, asn1Spec,
1289 value, substrate = concreteDecoder.valueDecoder(
1290 substrate, asn1Spec,
1297 logger('codec %s yields type %s, value:\n%s\n...remaining substrate is: %s' % (concreteDecoder.__class__.__name__, value.__class__.__name__, isinstance(value, base.Asn1Item) and value.prettyPrint() or value, substrate and debug.hexdump(substrate) or '<none>'))
1323 return value, substrate
1334 #: substrate: :py:class:`bytes` (Python 3) or :py:class:`str` (Python 2)
1347 #: A tuple of pyasn1 object recovered from BER substrate (:py:class:`~pyasn1.type.base.PyAsn1Item` derivative)
1348 #: and the unprocessed trailing portion of the *substrate* (may be empty)
1379 # non-recursive decoding; return position rather than substrate