upgrade to CAM v2.0
[stack/cam.git] / lib / list.py
diff --git a/lib/list.py b/lib/list.py
deleted file mode 100644 (file)
index 5b32508..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-
-import os, re
-import commands
-from time import time, strftime, localtime
-from utils import *
-from templates import *
-from paths import *
-from cfg import *
-
-
-
-def list(args):
-    verbose = 0
-    if len(args) > 0 and args[0] == '-v':
-       verbose = 1
-    
-    print '''
-
-List of known certificates for '%s' CA:
-
-''' % ca['name']
-
-    i = 0
-    sections = cfg.sections()
-    sections.sort()
-    for sec in sections:
-       if sec == 'ca' or sec == 'global':
-           continue
-       i += 1
-       crt_file = getpath('rsa_crt', sec)
-       dsa_crt_file = getpath('dsa_crt', sec)
-       if os.path.exists(crt_file):
-           crt_date = getcertdate(crt_file)
-           days = int((time() - crt_date) / 86400)
-           if days > 0:
-               days_s = '%d days ago' % days
-           else:
-               days_s = '%d days left' % (-days)
-           if expired(crt_date):
-               m = 'EXPIRED %s' % days_s.upper()
-               star = '*'
-           else:
-               if verbose:
-                   m = '\n%21s Expiration: %s (%s)' % \
-                       (' ', 
-                        strftime('%d %b %Y', localtime(crt_date)),
-                        days_s)
-               else:
-                   m = 'exp. %s' % strftime('%d/%m/%Y', 
-                                            localtime(crt_date))
-               star = ' '
-       else:
-           m = 'NOT FOUND'
-           star = '*'
-       print '%3d. %s%-15s %s [%s] - %s' % (i, star, sec, cfg.get(sec, 'cn'), cfg.get(sec, 'alt_names').replace('\n', ' '), m)
-       if star != '*' and verbose:
-           # do fingerprints
-           for hname, hash in [ ('MD5', 'md5'), ('SHA1', 'sha1') ]:
-               for cypher, file in [ ( 'RSA', crt_file), ( 'DSA', dsa_crt_file ) ]:
-                   fp = fingerprint(hash, file)
-                   print '%21s %s %s fingerprint: %s' % ('', cypher, hname, fp)
-                   
-       if verbose:
-           print
-
-    print '''
-(* = certificate does not exist, create with 'cam gen <name>')
-'''
-