1 package net.suberic.pooka.crypto; 2 3 import net.suberic.pooka.*; 4 import net.suberic.crypto.*; 5 6 import javax.mail.internet.*; 7 import javax.mail.*; 8 import javax.activation.DataHandler ; 9 10 import java.security.Key ; 11 12 import java.io.*; 13 14 17 public class KeyAttachment extends Attachment { 18 19 boolean parsed = false; 20 21 24 public KeyAttachment(MimePart mp) throws MessagingException { 25 super(mp); 26 } 27 28 31 public Key [] extractKeys(EncryptionUtils utils) throws MessagingException, java.io.IOException , java.security.GeneralSecurityException { 32 net.suberic.crypto.UpdatableMBP mbp = new net.suberic.crypto.UpdatableMBP(); 33 34 mbp.setContent(getDataHandler().getContent(), getMimeType().toString()); 35 mbp.updateMyHeaders(); 36 37 if (utils == null) { 38 utils = net.suberic.crypto.EncryptionManager.getEncryptionUtils(mbp); 39 } 40 41 if (utils != null) 42 return utils.extractKeys(mbp); 43 else 44 return null; 45 } 46 47 } 48 | Popular Tags |