| 116 | return len(self.getData()) |
| 117 | |
| 118 | def fromString(self, data = None): |
| 119 | # Manual parse of the GSSAPI Header Format |
| 120 | # It should be something like |
| 121 | # AID = 0x60 TAG, BER Length |
| 122 | # OID = 0x06 TAG |
| 123 | # GSSAPI OID |
| 124 | # UUID data (BER Encoded) |
| 125 | # Payload |
| 126 | next_byte = unpack('B',data[:1])[0] |
| 127 | if next_byte != ASN1_AID: |
| 128 | raise Exception('Unknown AID=%x' % next_byte) |
| 129 | data = data[1:] |
| 130 | decode_data, total_bytes = asn1decode(data) |
| 131 | # Now we should have a OID tag |
| 132 | next_byte = unpack('B',decode_data[:1])[0] |
| 133 | if next_byte != ASN1_OID: |
| 134 | raise Exception('OID tag not found %x' % next_byte) |
| 135 | decode_data = decode_data[1:] |
| 136 | # Now the OID contents, should be SPNEGO UUID |
| 137 | uuid, total_bytes = asn1decode(decode_data) |
| 138 | self['OID'] = uuid |
| 139 | # the rest should be the data |
| 140 | self['Payload'] = decode_data[total_bytes:] |
| 141 | #pass |
| 142 | |
| 143 | def dump(self): |
| 144 | for i in list(self.fields.keys()): |