1 7 8 package javax.security.auth.x500; 9 10 import java.security.PrivateKey ; 11 import java.security.cert.X509Certificate ; 12 import javax.security.auth.Destroyable ; 13 14 23 public final class X500PrivateCredential implements Destroyable { 24 private X509Certificate cert; 25 private PrivateKey key; 26 private String alias; 27 28 38 39 public X500PrivateCredential(X509Certificate cert, PrivateKey key) { 40 if (cert == null || key == null ) 41 throw new IllegalArgumentException (); 42 this.cert = cert; 43 this.key = key; 44 this.alias=null; 45 } 46 47 58 public X500PrivateCredential(X509Certificate cert, PrivateKey key, 59 String alias) { 60 if (cert == null || key == null|| alias == null ) 61 throw new IllegalArgumentException (); 62 this.cert = cert; 63 this.key = key; 64 this.alias=alias; 65 } 66 67 72 73 public X509Certificate getCertificate() { 74 return cert; 75 } 76 77 82 public PrivateKey getPrivateKey() { 83 return key; 84 } 85 86 91 92 public String getAlias() { 93 return alias; 94 } 95 96 100 101 public void destroy() { 102 cert = null; 103 key = null; 104 alias =null; 105 } 106 107 114 public boolean isDestroyed() { 115 return cert == null && key == null && alias==null; 116 } 117 } 118 | Popular Tags |