keytab-parser

1.0.0 • Public • Published

keytab-parser

A simple parser for Kerberos keytab files based on MIT Kerberos documentation.

purpose

To extract Kerberos cryptographic keys on server side to decrypt SPNEGO Kerberos tickets coming from clients.

usage

Parsing is done with a single function readKeytab(kt: Buffer, pos?: number = 0)

  • kt - is a Buffer object with contents of a keytab file
  • pos - starting point offset in octets (optional and most likely useless)

example

const {readKeytab, ENCODING_TYPES: encTypes} = require('keytab-parser');
const kt = readFileSync(keytabFilename);
const keytab = readKeytab(kt);
 
// print out the contents
for (const entry of keytab.entries) {
    const components = entry.components.reduce((prev, curr) => prev.concat(curr), [] );
    console.log('realm', String.fromCharCode(...entry.realm), String.fromCharCode(...components), 'keytype', encTypes[entry.key.type], 'key', entry.key.value );
}

Readme

Keywords

Package Sidebar

Install

npm i keytab-parser

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

6.63 kB

Total Files

5

Last publish

Collaborators

  • bitwkit