tools: getb64key - print the base64 version of a PEM public key file

Change-Id: Ia94ff560c88dfe85c3fa55db5c8219aa0d3419ee
This commit is contained in:
Ricardo Cerqueira
2013-10-01 20:42:45 +01:00
committed by Michael Bestas
parent 8d0369c962
commit 0a656b6446

18
build/tools/getb64key.py Executable file
View File

@@ -0,0 +1,18 @@
#!/usr/bin/env python
from __future__ import print_function
import base64
import sys
pkFile = open(sys.argv[1], 'rb').readlines()
base64Key = ""
inCert = False
for line in pkFile:
if line.startswith(b"-"):
inCert = not inCert
continue
base64Key += line.strip()
print(base64.b16encode(base64.b64decode(base64Key)).lower())