error(rb.getString("Cannot restore certchain from file specified"));
}catch(FileNotFoundExceptionex){
error(rb.getString("File specified by -certchain does not exist"));
}
}else{
try{
cs=store.getCertificateChain(alias);
}catch(KeyStoreExceptionkse){
// this never happens, because keystore has been loaded
}
if(cs==null){
}
if(cs==null||cs.length==0){
if(altCertChain!=null){
error(rb.getString
("Certificate chain not found in the file specified."));
}else{
MessageFormatform=newMessageFormat(rb.getString
("Certificate chain not found for: alias. alias must reference a valid KeyStore key entry containing a private key and corresponding public key certificate chain."));
("Certificate chain not found for: alias. alias must"+
" reference a valid KeyStore key entry containing a"+
" private key and corresponding public key certificate chain."));
Object[]source={alias,alias};
error(form.format(source));
}
}
certChain=newX509Certificate[cs.length];
for(inti=0;i<cs.length;i++){
...
...
@@ -1501,56 +1762,15 @@ public class JarSigner {
certChain[i]=(X509Certificate)cs[i];
}
// order the cert chain if necessary (put user cert first,
// root-cert last in the chain)
X509CertificateuserCert
=(X509Certificate)store.getCertificate(alias);
// We don't meant to print anything, the next call
// checks validity and keyUsage etc
printCert("",certChain[0],true,0);
// check validity of signer certificate
try{
userCert.checkValidity();
if(userCert.getNotAfter().getTime()<
System.currentTimeMillis()+SIX_MONTHS){
hasExpiringCert=true;
}
}catch(CertificateExpiredExceptioncee){
hasExpiredCert=true;
}catch(CertificateNotYetValidExceptioncnyve){
notYetValidCert=true;
}
checkCertUsage(userCert,null);
if(!userCert.equals(certChain[0])){
// need to order ...
X509Certificate[]certChainTmp
=newX509Certificate[certChain.length];
certChainTmp[0]=userCert;
Principalissuer=userCert.getIssuerDN();
for(inti=1;i<certChain.length;i++){
intj;
// look for the cert whose subject corresponds to the
{"Please specify alias name","Please specify alias name"},
{"Only one alias can be specified","Only one alias can be specified"},
{"This jar contains signed entries which is not signed by the specified alias(es).",
"This jar contains signed entries which is not signed by the specified alias(es)."},
{"This jar contains signed entries that's not signed by alias in this keystore.",
"This jar contains signed entries that's not signed by alias in this keystore."},
{"s","s"},
{"m","m"},
{"k","k"},
{"i","i"},
{"(and %d more)","(and %d more)"},
{" s = signature was verified ",
" s = signature was verified "},
{" m = entry is listed in manifest",
...
...
@@ -110,7 +126,11 @@ public class JarSignerResources extends java.util.ListResourceBundle {
" k = at least one certificate was found in keystore"},
{" i = at least one certificate was found in identity scope",
" i = at least one certificate was found in identity scope"},
{" X = not signed by specified alias(es)",
" X = not signed by specified alias(es)"},
{"no manifest.","no manifest."},
{"(Signature related entries)","(Signature related entries)"},
{"(Unsigned entries)","(Unsigned entries)"},
{"jar is unsigned. (signatures missing or not parsable)",
"jar is unsigned. (signatures missing or not parsable)"},
{"jar verified.","jar verified."},
...
...
@@ -134,6 +154,12 @@ public class JarSignerResources extends java.util.ListResourceBundle {
"unable to instantiate keystore class: "},
{"Certificate chain not found for: alias. alias must reference a valid KeyStore key entry containing a private key and corresponding public key certificate chain.",
"Certificate chain not found for: {0}. {1} must reference a valid KeyStore key entry containing a private key and corresponding public key certificate chain."},
{"File specified by -certchain does not exist",
"File specified by -certchain does not exist"},
{"Cannot restore certchain from file specified",
"Cannot restore certchain from file specified"},
{"Certificate chain not found in the file specified.",
"Certificate chain not found in the file specified."},