src/share/classes/java/security/CodeSource.java

Print this page




 190             // Convert the code signers to certs
 191             ArrayList<java.security.cert.Certificate> certChains =
 192                         new ArrayList<>();
 193             for (int i = 0; i < signers.length; i++) {
 194                 certChains.addAll(
 195                     signers[i].getSignerCertPath().getCertificates());
 196             }
 197             certs = certChains.toArray(
 198                         new java.security.cert.Certificate[certChains.size()]);
 199             return certs.clone();
 200 
 201         } else {
 202             return null;
 203         }
 204     }
 205 
 206     /**
 207      * Returns the code signers associated with this CodeSource.
 208      * <p>
 209      * If this CodeSource object was created using the
 210      * {@link #CodeSource(URL url, Certificate[] certs)}
 211      * constructor then its certificate chains are extracted and used to
 212      * create an array of CodeSigner objects. Note that only X.509 certificates
 213      * are examined - all other certificate types are ignored.
 214      *
 215      * @return A copy of the code signer array, or null if there is none.
 216      *
 217      * @since 1.5
 218      */
 219     public final CodeSigner[] getCodeSigners() {
 220         if (signers != null) {
 221             return signers.clone();
 222 
 223         } else if (certs != null) {
 224             // Convert the certs to code signers
 225             signers = convertCertArrayToSignerArray(certs);
 226             return signers.clone();
 227 
 228         } else {
 229             return null;
 230         }




 190             // Convert the code signers to certs
 191             ArrayList<java.security.cert.Certificate> certChains =
 192                         new ArrayList<>();
 193             for (int i = 0; i < signers.length; i++) {
 194                 certChains.addAll(
 195                     signers[i].getSignerCertPath().getCertificates());
 196             }
 197             certs = certChains.toArray(
 198                         new java.security.cert.Certificate[certChains.size()]);
 199             return certs.clone();
 200 
 201         } else {
 202             return null;
 203         }
 204     }
 205 
 206     /**
 207      * Returns the code signers associated with this CodeSource.
 208      * <p>
 209      * If this CodeSource object was created using the
 210      * {@link #CodeSource(URL url, java.security.cert.Certificate[] certs)}
 211      * constructor then its certificate chains are extracted and used to
 212      * create an array of CodeSigner objects. Note that only X.509 certificates
 213      * are examined - all other certificate types are ignored.
 214      *
 215      * @return A copy of the code signer array, or null if there is none.
 216      *
 217      * @since 1.5
 218      */
 219     public final CodeSigner[] getCodeSigners() {
 220         if (signers != null) {
 221             return signers.clone();
 222 
 223         } else if (certs != null) {
 224             // Convert the certs to code signers
 225             signers = convertCertArrayToSignerArray(certs);
 226             return signers.clone();
 227 
 228         } else {
 229             return null;
 230         }