[3612811] | 1 | package net.deterlab.abac; |
---|
| 2 | |
---|
| 3 | import java.io.*; |
---|
| 4 | import java.math.*; |
---|
| 5 | |
---|
| 6 | import java.util.*; |
---|
| 7 | import java.security.*; |
---|
| 8 | import java.security.cert.*; |
---|
| 9 | |
---|
| 10 | import javax.security.auth.x500.*; |
---|
| 11 | |
---|
| 12 | import org.bouncycastle.asn1.*; |
---|
| 13 | import org.bouncycastle.asn1.x509.*; |
---|
| 14 | import org.bouncycastle.x509.*; |
---|
| 15 | import org.bouncycastle.x509.util.*; |
---|
| 16 | import 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 | */ |
---|
| 25 | public 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 | |
---|
| 39 | /** |
---|
[a7f73b5] | 40 | * Create a certificate from this credential issued by the given identity; |
---|
| 41 | * this will always fail for an InternalCredential. |
---|
[3612811] | 42 | * @param i the Identity that will issue the certificate |
---|
[a7f73b5] | 43 | * @throws ABACException whenever called. |
---|
[3612811] | 44 | */ |
---|
| 45 | public void make_cert(Identity i) throws ABACException { |
---|
| 46 | throw new ABACException("Cannot create certificate for " + |
---|
| 47 | "an InternalCredential"); |
---|
| 48 | } |
---|
| 49 | |
---|
| 50 | /** |
---|
[a7f73b5] | 51 | * This will always fail for an InternalCredential. |
---|
[3612811] | 52 | * @param s the OutputStream on which to write |
---|
[a7f73b5] | 53 | * @throws IOException whenever called. |
---|
[3612811] | 54 | */ |
---|
| 55 | public void write(OutputStream s) throws IOException { |
---|
| 56 | throw new IOException("Cannot write certificate for " + |
---|
| 57 | "an InternalCredential"); |
---|
| 58 | } |
---|
| 59 | |
---|
| 60 | /** |
---|
[a7f73b5] | 61 | * This will always fail for an InternalCredential. |
---|
[3612811] | 62 | * @param fn a String containing the output filename |
---|
[a7f73b5] | 63 | * @throws IOException whenever called. |
---|
[3612811] | 64 | */ |
---|
| 65 | public void write(String fn) |
---|
| 66 | throws IOException, FileNotFoundException { |
---|
| 67 | write((OutputStream) null); |
---|
| 68 | } |
---|
| 69 | |
---|
| 70 | /** |
---|
[a7f73b5] | 71 | * Return true if this Credential has a certificate associated; it never |
---|
| 72 | * will. |
---|
| 73 | * @return false |
---|
[3612811] | 74 | */ |
---|
| 75 | public boolean hasCertificate() { return false; } |
---|
| 76 | |
---|
| 77 | } |
---|