(no commit message)
[sfa.git] / gui / JavaApplication1 / certutil.py
diff --git a/gui/JavaApplication1/certutil.py b/gui/JavaApplication1/certutil.py
new file mode 100755 (executable)
index 0000000..73a534f
--- /dev/null
@@ -0,0 +1,25 @@
+#!/usr/bin/python
+from M2Crypto import X509
+import sys
+
+id_file = ""
+try:
+    if len(sys.argv)>1:
+        id_file = sys.argv[len(sys.argv)-1]
+    else:
+        print 'File '+id_file+' does not exist.\n'
+        sys.exit(0)
+    pubkey = X509.load_cert(id_file).get_pubkey().as_pem(cipher=None)
+    print pubkey
+    
+    print "Character map:\n"
+    prev = ''
+    cur = ''
+    for ch in pubkey:
+        prev = cur
+        cur = ch
+        if cur == '\n':
+            1==1
+        print ch,
+except:
+    print "Error in input file.\n"