1 package SnowMailClient.gnupg.LineProcessors; 2 3 import SnowMailClient.gnupg.model.*; 4 import java.util.*; 5 import java.io.*; 6 7 public final class KeyIDReader implements LineProcessor 8 { 9 Vector<GnuPGKeyID> keyIDs = new Vector<GnuPGKeyID>(); 10 GnuPGKeyID last = null; 11 12 13 25 public void processLine(String line) { 27 if(line.length()<3) return; 30 String recordType = line.substring(0,3).toLowerCase(); 31 if(recordType.equals("gpg")) { 33 } 34 else if(recordType.equals("---")) { 36 } 37 else if(recordType.equals("tru")) { 39 } 40 else if(recordType.equals("sec")) { 42 last= new GnuPGKeyID(true); 43 this.keyIDs.add(last); 44 45 try 46 { 47 last.parseSEC_colon_format(line); 48 } catch(Exception e) {throw new RuntimeException (e); } 49 50 } 51 else if(recordType.equals("pub")) { 53 last = new GnuPGKeyID(true); 54 this.keyIDs.add(last); 55 56 try 57 { 58 last.parsePUB_colon_format(line); 59 } catch(Exception e) {throw new RuntimeException (e); } 60 61 } 62 else if(recordType.equals("fpr")) { 64 try 65 { 66 last.parseFPR_colon_format(line); 67 } catch(Exception e) {throw new RuntimeException (e); } 68 69 } 70 else if(recordType.equals("uid")) { 72 try 73 { 74 last.parseUID_colon_format(line); 75 } catch(Exception e) {throw new RuntimeException (e); } 76 } 77 else if(recordType.equals("sub")) { 79 GnuPGKeyID sk = new GnuPGKeyID(false); 80 try 81 { 82 sk.parseSUB_colon_format(line); 83 last.addSubKey(sk); 84 } catch(Exception e) {throw new RuntimeException (e); } 85 } 86 else if(recordType.equals("ssb")) { 88 GnuPGKeyID sk = new GnuPGKeyID(false); 89 try 90 { 91 sk.parseSSB_colon_format(line); 92 last.addSubKey(sk); 93 } catch(Exception e) {throw new RuntimeException (e); } 94 } 95 else if(recordType.equals("uat")) 96 { 97 } 100 else 101 { 102 System.out.println("Unknown key list record: "+recordType); 103 System.out.println(" "+line); 104 } 105 } 106 107 108 109 public Vector<GnuPGKeyID> getKeyIDs() {return keyIDs;} 110 111 112 113 } 115 | Popular Tags |