Package java.security

Examples of java.security.Identity


    }

    public Identity getIdentity(String name) {
      Enumeration en = identities();
      while (en.hasMoreElements()) {
        Identity current = (Identity) en.nextElement();
        if (current.getName().equals(name))
          return current;
      }
      return null;
    }
View Full Code Here


    }

    public Identity getIdentity(PublicKey pk) {
      Enumeration en = identities();
      while (en.hasMoreElements()) {
        Identity current = (Identity) en.nextElement();
        if (current.getPublicKey() == pk)
          return current;
      }
      return null;
    }
View Full Code Here

    this.zipEntry = zipEntry;
    this.jvs = jvs;
    }

    public Identity[] getIdentities() {
    Identity identities[] = null;

    if(jvs != null) {
      Class classes[] = new Class[1];
      classes[0] = String.class;
     
View Full Code Here

    return permissionCollection;
  }

  boolean isTrusted() {
    Identity identities[] = codeSource.identities;

    boolean trusted = false;

    if(identities != null) {
      for(int i = 0; i < identities.length && !trusted; i++)
View Full Code Here

    return permissionCollection;
  }

  boolean isTrusted() {
    Identity identities[] = codeSource.identities;

    boolean trusted = false;

    if(identities != null) {
      for(int i = 0; i < identities.length && !trusted; i++)
View Full Code Here

    this.zipEntry = zipEntry;
    this.jvs = jvs;
    }

    public Identity[] getIdentities() {
    Identity identities[] = null;

    if(jvs != null) {
      Class classes[] = new Class[1];
      classes[0] = String.class;
     
View Full Code Here

        boolean modified = false;

        IdentityDatabase idb = IdentityDatabase.fromStream(in);
        for (Enumeration<Identity> enum_ = idb.identities();
                                        enum_.hasMoreElements();) {
            Identity id = enum_.nextElement();
            newCert = null;
            // only store trusted identities in keystore
            if ((id instanceof SystemSigner && ((SystemSigner)id).isTrusted())
                || (id instanceof SystemIdentity
                    && ((SystemIdentity)id).isTrusted())) {
                // ignore if keystore entry with same alias name already exists
                if (keyStore.containsAlias(id.getName())) {
                    MessageFormat form = new MessageFormat
                        (rb.getString("Keystore entry for <id.getName()> already exists"));
                    Object[] source = {id.getName()};
                    System.err.println(form.format(source));
                    continue;
                }
                java.security.Certificate[] certs = id.certificates();
                if (certs!=null && certs.length>0) {
                    // we can only store one user cert per identity.
                    // convert old-style to new-style cert via the encoding
                    DerOutputStream dos = new DerOutputStream();
                    certs[0].encode(dos);
                    encoded = dos.toByteArray();
                    bais = new ByteArrayInputStream(encoded);
                    newCert = (X509Certificate)cf.generateCertificate(bais);
                    bais.close();

                    // if certificate is self-signed, make sure it verifies
                    if (isSelfSigned(newCert)) {
                        PublicKey pubKey = newCert.getPublicKey();
                        try {
                            newCert.verify(pubKey);
                        } catch (Exception e) {
                            // ignore this cert
                            continue;
                        }
                    }

                    if (id instanceof SystemSigner) {
                        MessageFormat form = new MessageFormat(rb.getString
                            ("Creating keystore entry for <id.getName()> ..."));
                        Object[] source = {id.getName()};
                        System.err.println(form.format(source));
                        if (chain==null) {
                            chain = new java.security.cert.Certificate[1];
                        }
                        chain[0] = newCert;
                        privKey = ((SystemSigner)id).getPrivateKey();
                        keyStore.setKeyEntry(id.getName(), privKey, storePass,
                                             chain);
                    } else {
                        keyStore.setCertificateEntry(id.getName(), newCert);
                    }
                    kssave = true;
                }
            }
        }
View Full Code Here

    return permissionCollection;
  }

  boolean isTrusted() {
    Identity identities[] = codeSource.identities;

    boolean trusted = false;

    if(identities != null) {
      for(int i = 0; i < identities.length && !trusted; i++)
View Full Code Here

    this.zipEntry = zipEntry;
    this.jvs = jvs;
    }

    public Identity[] getIdentities() {
    Identity identities[] = null;

    if(jvs != null) {
      Class classes[] = new Class[1];
      classes[0] = String.class;
     
View Full Code Here

TOP

Related Classes of java.security.Identity

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.