source: java/net/deterlab/abac/InternalCredential.java @ c694dff

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

Allow users to set validity periods.

  • Property mode set to 100644
File size: 2.9 KB
RevLine 
[3612811]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
[a7f73b5]20 * should never be converted to a cert or output.  They are useful outside as
21 * placeholder credentials outside the main jabac library.
[3612811]22 * @author <a href="http://abac.deterlab.net">ISI ABAC team</a>
[4560b65]23 * @version 1.4
[3612811]24 */
25public class InternalCredential extends Credential {
26
27    /**
28     * Create an empty InternalCredential.
29     */
30    public InternalCredential() { super(); }
31    /**
32     * Create a credential from a head and tail role.  This credential has no
33     * underlying certificate, and cannot be exported or used in real proofs.
34     * @param head the Role at the head of the credential
35     * @param tail the Role at the tail of the credential
36     */
37    public InternalCredential(Role head, Role tail) {super(head, tail); }
38
[675770e]39    /**
40     * Create a certificate from this credential issued by the given identity
41     * valid for the given period; this will always fail for an
42     * InternalCredential.
43     * @param i the Identity that will issue the certificate
44     * @param validity a long holding the number of seconds that the credential
45     * is valid for.
46     * @throws ABACException whenever called.
47     */
48    public void make_cert(Identity i, long validity) throws ABACException {
49        throw new ABACException("Cannot create certificate for " +
50                "an InternalCredential");
51    }
52
[3612811]53    /**
[a7f73b5]54     * Create a certificate from this credential issued by the given identity;
55     * this will always fail for an InternalCredential.
[3612811]56     * @param i the Identity that will issue the certificate
[a7f73b5]57     * @throws ABACException whenever called.
[3612811]58     */
59    public void make_cert(Identity i) throws ABACException {
60        throw new ABACException("Cannot create certificate for " +
61                "an InternalCredential");
62    }
63
64    /**
[a7f73b5]65     * This will always fail for an InternalCredential.
[3612811]66     * @param s the OutputStream on which to write
[a7f73b5]67     * @throws IOException whenever called.
[3612811]68     */
69    public void write(OutputStream s) throws IOException {
70        throw new IOException("Cannot write certificate for " +
71                "an InternalCredential");
72    }
73
74    /**
[a7f73b5]75     * This will always fail for an  InternalCredential.
[3612811]76     * @param fn a String containing the output filename
[a7f73b5]77     * @throws IOException whenever called.
[3612811]78     */
79    public void write(String fn) 
80        throws IOException, FileNotFoundException {
81        write((OutputStream) null);
82    }
83
84    /**
[a7f73b5]85     * Return true if this Credential has a certificate associated; it never
86     * will.
87     * @return false
[3612811]88     */
89    public boolean hasCertificate() { return false; }
90
91}
Note: See TracBrowser for help on using the repository browser.