Methods Summary |
---|
private void | addCodeSigner(java.util.ArrayList asigners, java.util.List list)
CertPath certPath = null;
if (!isFactoryChecked) {
try {
factory = CertificateFactory.getInstance("X.509"); //$NON-NLS-1$
} catch (CertificateException ex) {
// do nothing
} finally {
isFactoryChecked = true;
}
}
if (null == factory) {
return;
}
try {
certPath = factory.generateCertPath(list);
} catch (CertificateException ex) {
// do nothing
}
if (null != certPath) {
asigners.add(new CodeSigner(certPath, null));
}
|
public java.util.jar.Attributes | getAttributes()Returns the {@code Attributes} object associated with this entry or
{@code null} if none exists.
if (attributes != null || parentJar == null) {
return attributes;
}
Manifest manifest = parentJar.getManifest();
if (manifest == null) {
return null;
}
return attributes = manifest.getAttributes(getName());
|
public java.security.cert.Certificate[] | getCertificates()Returns an array of {@code Certificate} Objects associated with this
entry or {@code null} if none exists. Make sure that the everything is
read from the input stream before calling this method, or else the method
returns {@code null}.
if (null == parentJar) {
return null;
}
JarVerifier jarVerifier = parentJar.verifier;
if (null == jarVerifier) {
return null;
}
return jarVerifier.getCertificates(getName());
|
public java.security.CodeSigner[] | getCodeSigners()Returns the code signers for the digital signatures associated with the
JAR file. If there is no such code signer, it returns {@code null}. Make
sure that the everything is read from the input stream before calling
this method, or else the method returns {@code null}.
if (null == signers) {
signers = getCodeSigners(getCertificates());
}
if (null == signers) {
return null;
}
CodeSigner[] tmp = new CodeSigner[signers.length];
System.arraycopy(signers, 0, tmp, 0, tmp.length);
return tmp;
|
private java.security.CodeSigner[] | getCodeSigners(java.security.cert.Certificate[] certs)
if(null == certs) {
return null;
}
X500Principal prevIssuer = null;
ArrayList<Certificate> list = new ArrayList<Certificate>(certs.length);
ArrayList<CodeSigner> asigners = new ArrayList<CodeSigner>();
for (Certificate element : certs) {
if (!(element instanceof X509Certificate)) {
// Only X509Certificate-s are taken into account - see API spec.
continue;
}
X509Certificate x509 = (X509Certificate) element;
if (null != prevIssuer) {
X500Principal subj = x509.getSubjectX500Principal();
if (!prevIssuer.equals(subj)) {
// Ok, this ends the previous chain,
// so transform this one into CertPath ...
addCodeSigner(asigners, list);
// ... and start a new one
list.clear();
}// else { it's still the same chain }
}
prevIssuer = x509.getIssuerX500Principal();
list.add(x509);
}
if (!list.isEmpty()) {
addCodeSigner(asigners, list);
}
if (asigners.isEmpty()) {
// 'signers' is 'null' already
return null;
}
CodeSigner[] tmp = new CodeSigner[asigners.size()];
asigners.toArray(tmp);
return tmp;
|
void | setAttributes(java.util.jar.Attributes attrib)
attributes = attrib;
|