Skip to content

Instantly share code, notes, and snippets.

@mmattice
Created April 27, 2016 18:41
Show Gist options
  • Save mmattice/6e5dcc422ccea596f623b1b58b647e71 to your computer and use it in GitHub Desktop.
Save mmattice/6e5dcc422ccea596f623b1b58b647e71 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
from binascii import hexlify, unhexlify
frombank = unhexlify('723a860e84da00cc090014c10390b39d7d79861384da00c80e00000000000001ef1d534991a069861384da00c90e00000000000057d981ff69f29ba7')
working = unhexlify('723c303a860e84da00cc090014c10390b39d7d79861384da00c80e00000000000001ef1d534991a069861384da00c90e00000000000057d981ff69f29ba7')
from pyasn1.type import tag, tagmap, univ, namedtype
from pyasn1 import debug
#debug.setLogger(debug.Debug('all'))
class IssuerScriptCommand(univ.OctetString):
tagSet = univ.OctetString.tagSet.tagImplicitly(tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 6))
class IssuerScriptTemplate2(univ.Sequence):
tagSet = univ.Sequence.tagSet.tagImplicitly(tag.Tag(tag.tagClassApplication, tag.tagFormatConstructed, 18))
componentType = namedtype.NamedTypes(
namedtype.NamedType('issuerscriptcommands', univ.SequenceOf(componentType=IssuerScriptCommand()))
)
from pyasn1.codec.ber import decoder as ber_dec
tlvs = working
output, tlvs = ber_dec.decode(tlvs, IssuerScriptTemplate2())
print output
tlvs = frombank
output, tlvs = ber_dec.decode(tlvs, IssuerScriptTemplate2())
print output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment