source: java/net/deterlab/abac/InternalCredential.java @ 4560b65

abac0-leakabac0-meimei-idmei-rt0-nmei_rt0tvf-new-xml
Last change on this file since 4560b65 was 4560b65, checked in by Ted Faber <faber@…>, 11 years ago

Bump version number

  • Property mode set to 100644
File size: 4.5 KB
Line 
1package net.deterlab.abac;
2
3import java.io.*;
4import java.math.*;
5
6import java.util.*;
7import java.security.*;
8import java.security.cert.*;
9
10import javax.security.auth.x500.*;
11
12import org.bouncycastle.asn1.*;
13import org.bouncycastle.asn1.x509.*;
14import org.bouncycastle.x509.*;
15import org.bouncycastle.x509.util.*;
16import org.bouncycastle.openssl.*;
17
18/**
19 * An Internal Credential, used to represent extra arcs in the proof graph.  It
20 * should never be converted to a cert or output.
21 * @author <a href="http://abac.deterlab.net">ISI ABAC team</a>
22 * @version 1.4
23 */
24public class InternalCredential extends Credential {
25
26    /**
27     * Create an empty InternalCredential.
28     */
29    public InternalCredential() { super(); }
30    /**
31     * Create a credential from a head and tail role.  This credential has no
32     * underlying certificate, and cannot be exported or used in real proofs.
33     * @param head the Role at the head of the credential
34     * @param tail the Role at the tail of the credential
35     */
36    public InternalCredential(Role head, Role tail) {super(head, tail); }
37
38    /**
39     * Create a credential from an attribute cert in a file.  This will always
40     * fail for in InternalCredential.
41     * @param filename a String containing the filename to read
42     * @param ids a Collection of Identities to use in validating the cert
43     * @throws CertInvalidException if the stream is unparsable
44     * @throws MissingIssuerException if none of the Identities can validate the
45     *                              certificate
46     * @throws BadSignatureException if the signature check fails
47     */
48    public InternalCredential(String filename, Collection<Identity> ids) 
49        throws ABACException { this(); }
50
51    /**
52     * Create a credential from an attribute cert in a file.   This will always
53     * * fail for in InternalCredential.
54     * @param file the File to read
55     * @param ids a Collection of Identities to use in validating the cert
56     * @throws CertInvalidException if the stream is unparsable
57     * @throws MissingIssuerException if none of the Identities can validate the
58     *                              certificate
59     * @throws BadSignatureException if the signature check fails
60     */
61    public InternalCredential(File file, Collection<Identity> ids) 
62            throws ABACException {
63         this();
64    }
65
66    /**
67     * Create a credential from an InputStream.  This will always
68     * fail for in InternalCredential.
69     * @param ids a Collection of Identities to use in validating the cert
70     * @throws CertInvalidException if the stream is unparsable
71     * @throws MissingIssuerException if none of the Identities can validate the
72     *                              certificate
73     * @throws BadSignatureException if the signature check fails
74     */
75    public InternalCredential(InputStream s, Collection<Identity> ids) 
76            throws ABACException {
77         this();
78    }
79
80
81    /**
82     * Create a certificate from this credential issued by the given identity.
83     * This will always fail for an InternalCredential.
84     * @param i the Identity that will issue the certificate
85     * @throws ABACException for Credential-specific errors
86     * @throws MissingIssuerException the identity is invalid
87     * @throws BadSignatureException if the signature creation fails
88     */
89    public void make_cert(Identity i) throws ABACException {
90        throw new ABACException("Cannot create certificate for " +
91                "an InternalCredential");
92    }
93
94    /**
95     * Output the DER formatted attribute certificate associated with this
96     * Credential to the OutputStream.  This will always fail for an
97     * InternalCredential.
98     * @param s the OutputStream on which to write
99     * @throws IOException if there is an error writing.
100     */
101    public void write(OutputStream s) throws IOException {
102        throw new IOException("Cannot write certificate for " +
103                "an InternalCredential");
104    }
105
106    /**
107     * Output the DER formatted attribute certificate associated with this
108     * Credential to the filename given.  This will always fail for an
109     * InternalCredential.
110     * @param fn a String containing the output filename
111     * @throws IOException if there is an error writing.
112     */
113    public void write(String fn) 
114        throws IOException, FileNotFoundException {
115        write((OutputStream) null);
116    }
117
118    /**
119     * Return true if this Credential has a certificate associated.  A jabac
120     * extension.  Always false for an InternalCredential.
121     * @return true if this Credential has a certificate associated.
122     */
123    public boolean hasCertificate() { return false; }
124
125}
Note: See TracBrowser for help on using the repository browser.