1 7 8 package java.security.cert; 9 10 import java.security.NoSuchAlgorithmException ; 11 import java.security.NoSuchProviderException ; 12 import java.security.InvalidKeyException ; 13 import java.security.SignatureException ; 14 import java.security.Principal ; 15 import java.security.PublicKey ; 16 import javax.security.auth.x500.X500Principal ; 17 18 import java.math.BigInteger ; 19 import java.util.Date ; 20 import java.util.Set ; 21 import java.util.Arrays ; 22 23 import sun.security.x509.X509CRLImpl; 24 25 94 95 public abstract class X509CRL extends CRL implements X509Extension { 96 97 private transient X500Principal issuerPrincipal; 98 99 102 protected X509CRL() { 103 super("X.509"); 104 } 105 106 118 public boolean equals(Object other) { 119 if (this == other) { 120 return true; 121 } 122 if (!(other instanceof X509CRL )) { 123 return false; 124 } 125 try { 126 byte[] thisCRL = X509CRLImpl.getEncodedInternal(this); 127 byte[] otherCRL = X509CRLImpl.getEncodedInternal((X509CRL )other); 128 129 return Arrays.equals(thisCRL, otherCRL); 130 } catch (CRLException e) { 131 return false; 132 } 133 } 134 135 141 public int hashCode() { 142 int retval = 0; 143 try { 144 byte[] crlData = X509CRLImpl.getEncodedInternal(this); 145 for (int i = 1; i < crlData.length; i++) { 146 retval += crlData[i] * i; 147 } 148 return retval; 149 } catch (CRLException e) { 150 return retval; 151 } 152 } 153 154 160 public abstract byte[] getEncoded() 161 throws CRLException ; 162 163 176 public abstract void verify(PublicKey key) 177 throws CRLException , NoSuchAlgorithmException , 178 InvalidKeyException , NoSuchProviderException , 179 SignatureException ; 180 181 197 public abstract void verify(PublicKey key, String sigProvider) 198 throws CRLException , NoSuchAlgorithmException , 199 InvalidKeyException , NoSuchProviderException , 200 SignatureException ; 201 202 215 public abstract int getVersion(); 216 217 256 public abstract Principal getIssuerDN(); 257 258 268 public X500Principal getIssuerX500Principal() { 269 if (issuerPrincipal == null) { 270 issuerPrincipal = X509CRLImpl.getIssuerX500Principal(this); 271 } 272 return issuerPrincipal; 273 } 274 275 287 public abstract Date getThisUpdate(); 288 289 295 public abstract Date getNextUpdate(); 296 297 306 public abstract X509CRLEntry 307 getRevokedCertificate(BigInteger serialNumber); 308 309 326 public X509CRLEntry getRevokedCertificate(X509Certificate certificate) { 327 X500Principal certIssuer = certificate.getIssuerX500Principal(); 328 X500Principal crlIssuer = getIssuerX500Principal(); 329 if (certIssuer.equals(crlIssuer) == false) { 330 return null; 331 } 332 return getRevokedCertificate(certificate.getSerialNumber()); 333 } 334 335 342 public abstract Set <? extends X509CRLEntry > getRevokedCertificates(); 343 344 352 public abstract byte[] getTBSCertList() throws CRLException ; 353 354 364 public abstract byte[] getSignature(); 365 366 385 public abstract String getSigAlgName(); 386 387 399 public abstract String getSigAlgOID(); 400 401 417 public abstract byte[] getSigAlgParams(); 418 } 419 | Popular Tags |