home *** CD-ROM | disk | FTP | other *** search
- package opera;
-
- import java.security.CodeSource;
- import java.security.Principal;
- import java.security.cert.Certificate;
- import java.security.cert.CertificateEncodingException;
- import java.security.cert.X509Certificate;
-
- class CertificateHandler {
- protected static boolean checkCertificates(CodeSource var0) {
- try {
- Certificate[] var1 = var0.getCertificates();
- if (var1.length == 0) {
- return false;
- } else {
- int var2 = 0;
-
- for(int var3 = 0; var3 < var1.length; var2 = var3) {
- int var4;
- for(var4 = var2; var4 + 1 < var1.length && var1[var4] instanceof X509Certificate && var1[var4 + 1] instanceof X509Certificate && isIssuerOf((X509Certificate)var1[var4], (X509Certificate)var1[var4 + 1]); ++var4) {
- }
-
- var3 = var4 + 1;
- byte[][] var5 = makeChain(var1, var2, var3);
- if (var5 != null) {
- SyncObject var6 = new SyncObject((1)null);
- synchronized(var6) {
- acceptCertificateChain(var5, var6);
-
- try {
- var6.wait();
- } catch (InterruptedException var10) {
- }
- }
-
- System.out.println("Accept: " + var6.accept);
- return var6.accept;
- }
- }
-
- return false;
- }
- } catch (CertificateEncodingException var12) {
- return false;
- }
- }
-
- private static boolean isIssuerOf(X509Certificate var0, X509Certificate var1) {
- Principal var2 = var0.getIssuerDN();
- Principal var3 = var1.getSubjectDN();
- return var2.equals(var3);
- }
-
- private static byte[][] makeChain(Certificate[] var0, int var1, int var2) throws CertificateEncodingException {
- if (var1 == var2) {
- return null;
- } else {
- byte[][] var3 = new byte[var2 - var1][];
-
- for(int var4 = var1; var4 < var2; ++var4) {
- var3[var4 - var1] = var0[var4].getEncoded();
- }
-
- return var3;
- }
- }
-
- private static native void acceptCertificateChain(byte[][] var0, SyncObject var1);
- }
-