Changeset 388a3d7


Ignore:
Timestamp:
Mar 26, 2011 2:35:45 PM (8 years ago)
Author:
Ted Faber <faber@…>
Branches:
abac0-leak, abac0-mei, compt_changes, gec13, master, mei-id, mei-rt0-n, mei_rt0, mei_rt2, mei_rt2_fix_1, meiyap-rt1, meiyap1, rt2, tvf-new-xml
Children:
83cdf0f
Parents:
edf9e1d
Message:

Add identities() function

File:
1 edited

Legend:

Unmodified
Added
Removed
  • java/net/deterlab/abac/Context.java

    r6432e35 r388a3d7  
    4242    protected boolean dirty;
    4343    /** Set of identities known to this Context. */
    44     protected Set<Identity> identities;
     44    protected Set<Identity> m_identities;
    4545
    4646    /** Translation from issuer CN to issuer pubkey identifier */
     
    102102        pq = new Query(g);
    103103        dirty = false;
    104         identities = new TreeSet<Identity>();
     104        m_identities = new TreeSet<Identity>();
    105105        nicknames = new TreeMap<String, String>();
    106106        keys = new TreeMap<String, String>();
     
    113113    public Context(Context c) {
    114114        this();
    115         for (Identity i: c.identities)
     115        for (Identity i: c.m_identities)
    116116            load_id_chunk(i);
    117117        for (Credential cr: c.credentials())
     
    191191                add_credential((Credential) c);
    192192            else if (c instanceof String)
    193                 add_credential(new Credential((String) c, identities));
     193                add_credential(new Credential((String) c, m_identities));
    194194            else if (c instanceof File)
    195                 add_credential(new Credential((File) c, identities));
     195                add_credential(new Credential((File) c, m_identities));
    196196            else if ( c instanceof X509V2AttributeCertificate)
    197197                add_credential(new Credential((X509V2AttributeCertificate)c,
    198                             identities));
     198                            m_identities));
    199199            else
    200200                return ABAC_CERT_INVALID;
     201        }
     202        catch (InvalidKeyException sig) {
     203            return ABAC_CERT_MISSING_ISSUER ;
    201204        }
    202205        catch (SignatureException sig) {
     
    241244
    242245    /**
     246     * Return all the Identities known in this context.  A jabac extension.
     247     * @return all the Identities known in this context.
     248     */
     249    public Collection<Identity> identities() {
     250        return m_identities;
     251    }
     252
     253    /**
    243254     * Returns true if the given Identity is known in this Context.  A jabac
    244255     * extension.
     
    246257     * @return a boolean, true if the Identity is known.
    247258     */
    248     public boolean knowsIdentity(Identity i) { return identities.contains(i); }
     259    public boolean knowsIdentity(Identity i) { return m_identities.contains(i); }
    249260    /**
    250261     * Returns true if an Identity with the given string representation is
     
    255266    public boolean knowsKeyID(String k) {
    256267        boolean known = false;
    257         for (Identity i: identities)
     268        for (Identity i: m_identities)
    258269            if (k.equals(i.getKeyID())) return true;
    259270        return false;
     
    439450     */
    440451    protected void addIdentity(Identity id) {
    441         identities.add(id);
     452        m_identities.add(id);
    442453        if (id.getName() != null && id.getKeyID() != null) {
    443454            if ( !keys.containsKey(id.getKeyID()) ) {
     
    564575        for ( ZipEntry f : derEntries ) {
    565576            try {
    566                 add_credential(new Credential(z.getInputStream(f), identities));
     577                add_credential(new Credential(z.getInputStream(f),
     578                            m_identities));
    567579            }
    568580            catch (Exception e ) {
     
    722734        for ( File f : derFiles ) {
    723735            try {
    724                 add_credential(new Credential(f, identities));
     736                add_credential(new Credential(f, m_identities));
    725737            }
    726738            catch (Exception e ) {
     
    772784            throws IOException {
    773785        ZipOutputStream z = new ZipOutputStream(new FileOutputStream(f));
    774         Set<Identity> ids = allIDs ?  identities : new TreeSet<Identity>();
     786        Set<Identity> ids = allIDs ?  m_identities : new TreeSet<Identity>();
    775787
    776788        int n = 0;
Note: See TracChangeset for help on using the changeset viewer.