Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Felix Eckhofer
tools
Commits
9483ea30
Commit
9483ea30
authored
Mar 09, 2014
by
Felix Eckhofer
🤹🏼
Browse files
add fingerprint-to-pin.sh
parent
6c09e8b4
Changes
1
Show whitespace changes
Inline
Side-by-side
scripts/fingerprint-to-pin.sh
0 → 100755
View file @
9483ea30
#!/bin/sh
# convert sha1 oder sha256 certificate fingerprint in hex
# to format used by chrome://net-internals for pinning
# -- felix@tribut.de
digest
=
"
$@
"
[
-z
"
$digest
"
]
&&
read
digest
stripped
=
"
`
echo
-n
\"
$digest
\"
|
tr
-d
': \n'
`
"
length
=
"
`
echo
-n
$stripped
|
wc
-c
`
"
case
"
$length
"
in
40
)
type
=
"sha1"
;;
64
)
type
=
"sha256"
;;
*
)
echo
"Length of digest doesn't match with any supported digest (given:
$length
)."
>
&2
echo
"Please call me with hex digest as parameter or piped via stdin."
>
&2
exit
1
;;
esac
echo
"
$type
/
`
echo
\"
$digest
\"
| xxd
-r
-p
|
base64
`
"
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment