KickJava   Java API By Example, From Geeks To Geeks.

Java > Java SE, EE, ME > java > security > cert > CertPath

java.security.cert
Class CertPath

java.lang.Object
  extended by java.security.cert.CertPath
All Implemented Interfaces:
Serializable
See Also:
Source Code, TrustAnchor, CertPathRep, getEncoded(), CertificateFactory, CertPathBuilder

protected CertPath(String type)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[1569]Verifying signed jars
By Anonymous on 2005/10/08 18:19:26  Rate
//Verifying signed jars 
  
  
 /** 
   * Workaround for broken Java 1.5 JarEntry.getCertificates behavior. 
   * Uses reflection to call new 1.5 methods but compiles and runs on 1.4 
   * @param entry 
   * @return 
   */
 
 private Certificate [  ]  getCertificates ( JarEntry entry )  
  {  
     try 
      {  
        Certificate certificates [  ]  = entry.getCertificates (  ) ; 
        if  ( certificates != null )  
           return certificates; 
 // CodeSigner [  ]  codeSigners = entry.getCodeSigners (  ) ; 
        Method getCodeSigners = entry.getClass (  ) .getMethod (  
                 "getCodeSigners", new Class [ 0 ]  ) ; 
        Object [  ]  codeSigners =  ( Object [  ]  ) getCodeSigners.invoke ( entry, 
                 new Object [ 0 ]  ) ; 
        if  ( codeSigners != null && codeSigners.length  >  0 )  
         {  
 // List list =  ( CodeSigner ) codeSigners [ 0 ]  ) .getSignerCertPath (  ) . 
                 getCertificates (  ) ; 
           Class codeSigner = Class.forName ( "java.security.CodeSigner" ) ; 
          Method getSignerCertPath = codeSigner.getMethod (  
                 "getSignerCertPath", new Class [ 0 ]  ) ; 
           CertPath certPath =  ( CertPath ) getSignerCertPath.invoke (  
                 Array.get ( codeSigners, 0 ) , new Object [ 0 ]  ) ; 
           List list = certPath.getCertificates (  ) ; 
          return  ( Certificate [  ]  ) list.toArray ( new 
                 Certificate [ list.size (  )  ]  ) ; 
         }  
      }  
     catch  ( NoSuchMethodException e )  
      {  
        // fail quietly if called by Java 1.4 runtime 
      }  
     catch  ( Exception e )  
      {  
        logger.error ( "Error collecting jar entry certificate", e ) ; 
      }  
     return null;


public boolean equals(Object other)
See Also:
Hashtable, Object.hashCode()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public abstract List<? extends Certificate> getCertificates()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public abstract byte[] getEncoded()
                           throws CertificateEncodingException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public abstract byte[] getEncoded(String encoding)
                           throws CertificateEncodingException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public abstract Iterator<String> getEncodings()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public String getType()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public int hashCode()
See Also:
Hashtable, Object.equals(java.lang.Object)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public String toString()
See Also:
Object
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


protected Object writeReplace()
                       throws ObjectStreamException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  

Popular Tags