Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix IPv6 AltName parsers
  • Loading branch information
djphoenix committed Sep 11, 2016
1 parent ade7f62 commit ac31428
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion index.js
Expand Up @@ -39,7 +39,13 @@ function getCommonNames (buffer, encoding) {
case 'dNSName':
return e.value
case 'iPAddress':
return [e.value[0], e.value[1], e.value[2], e.value[3]].join('.')
if (e.value.length === 4) {
return [e.value[0], e.value[1], e.value[2], e.value[3]].join('.')
} else if (e.value.length === 16) {
return e.value.toString('hex').replace(/(.{4})/g, '$1:').replace(/:$/, '')
}
console.log('Unknown IP value: %s', e.value.toString('hex'))
return null
default:
console.log('Unknown type: %s', e.type)
return null
Expand Down

0 comments on commit ac31428

Please sign in to comment.