summaryrefslogtreecommitdiffstats
path: root/tools/getb64key.py
diff options
context:
space:
mode:
authorRicardo Cerqueira <cyanogenmod@cerqueira.org>2013-10-01 20:42:45 +0100
committerAdnan Begovic <adnan@cyngn.com>2015-10-06 16:31:39 -0700
commitd8eb47ddd8a1231e057a64b5f571bca2cbfd3f71 (patch)
tree6ef97ee3d500cedce927899de1e7d2117c1db436 /tools/getb64key.py
parented1fad382c56e75a0464abc5451f5d3d84f1d03e (diff)
downloadbuild-d8eb47ddd8a1231e057a64b5f571bca2cbfd3f71.zip
build-d8eb47ddd8a1231e057a64b5f571bca2cbfd3f71.tar.gz
build-d8eb47ddd8a1231e057a64b5f571bca2cbfd3f71.tar.bz2
tools: getb64key - print the base64 version of a PEM public key file
Change-Id: Ia94ff560c88dfe85c3fa55db5c8219aa0d3419ee
Diffstat (limited to 'tools/getb64key.py')
-rwxr-xr-xtools/getb64key.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/tools/getb64key.py b/tools/getb64key.py
new file mode 100755
index 0000000..0bb63e1
--- /dev/null
+++ b/tools/getb64key.py
@@ -0,0 +1,17 @@
+#!/usr/bin/python
+
+import base64
+import sys
+import os
+
+pkFile = open(sys.argv[1], 'rb').readlines()
+base64Key = ""
+inCert = False
+for line in pkFile:
+ if line.startswith("-"):
+ inCert = not inCert
+ continue
+
+ base64Key += line.strip()
+
+print base64.b16encode(base64.b64decode(base64Key)).lower()