DCLabel.Trustworthy
Description
This module implements Disjunction Category labels.
A label consists on conjunctions of disjunctions of
principals. Labels can be simply created by using the
function singleton (it creates a label with only one
principal). Functions '(.\/.)' and '(./\.)' create disjunction
and conjunction of principals, respectively. To illustrate
the use of this functions, we have the following examples.
>>>singleton "Alice"[ Alice ]
>>>"Alice" .\/. "Bob"[ Alice \/ Bob ]
>>>"Alice" .\/. ("Bob" ./\. "Carla")[ Alice \/ Bob ] /\ [ Alice \/ Carla ]
A DCLabel is simple two labels, one for confidentiality (secrecy)
and another one for integrity (integrity). DCLabels are created by
function newDC, where the first argument is for secrecy and the second
one for integrity.
>>>newDC (singleton "Alice") ("Bob" .\/. "Alice")S=[ Alice ] I=[ Bob \/ Alice ]
Given two DCLabel it is possible to precisely compute the join
and the meet by calling functions join and meet, respectively.
>>>join ( newDC (singleton "Alice") (singleton "Carla") ) ( newDC (singleton "Bob") (emptyLabel) )S=[ Alice ] /\ [ Bob ] I=True
>>>meet ( newDC (singleton "Alice") (singleton "Bob") ) ( newDC (singleton "Carla") (singleton "Carla") )S=[ Alice \/ Carla ] I=[ Bob ] /\ [ Carla ]
It is possible to compare if a DCLabel is more restrictive than another one by
calling the function canflowto. For instance,
>>>canflowto ( newDC (singleton "Bob") (emptyLabel) ) (newDC ("Alice" ./\. "Bob") (singleton "Carla"))False
>>>canflowto ( newDC (singleton "Bob") (singleton "Carla") ) (newDC ("Alice" ./\. "Bob") (emptyLabel))True
- class Ord a => Lattice a where
- data Label a
- data Principal
- principal :: String -> Principal
- isPrincipal :: Principal -> Label Principal -> Bool
- labelToList :: Label Principal -> [[Principal]]
- class DisjunctionOf a b c | a b -> c where
- (.\/.) :: a -> b -> c
- class ConjunctionOf a b c | a b -> c where
- (./\.) :: a -> b -> c
- (<>) :: Label a
- singleton :: Singleton a b => a -> Label b
- data DCLabel a
- integrityDC :: DCLabel Principal -> Label Principal
- secrecyDC :: DCLabel Principal -> Label Principal
- newDC :: Label a -> Label a -> DCLabel a
- data Priv a
- canflowto_p :: Lattice (DCLabel a) => Priv a -> DCLabel a -> DCLabel a -> Bool
- own :: Ord a => Priv a -> DCLabel a -> Bool
- privToLabel :: Priv a -> DCLabel a
- createPriv :: DCLabel a -> Priv a
Documentation
Data type to represent labels, i.e. conjunctions of disjunctions.
Instances
| ConjunctionOf String String (Label Principal) | Instances usng strings and not principals |
| ConjunctionOf Principal Principal (Label Principal) | |
| DisjunctionOf String String (Label Principal) | |
| DisjunctionOf Principal Principal (Label Principal) | |
| ConjunctionOf String (Label Principal) (Label Principal) | |
| ConjunctionOf Principal (Label Principal) (Label Principal) | |
| DisjunctionOf String (Label Principal) (Label Principal) | |
| DisjunctionOf Principal (Label Principal) (Label Principal) | |
| (Ord a, Eq a) => Eq (Label a) | |
| Ord a => Ord (Label a) | |
| Show a => Show (Label a) | |
| Arbitrary a => Arbitrary (Label a) | |
| ConjunctionOf (Label Principal) String (Label Principal) | |
| ConjunctionOf (Label Principal) Principal (Label Principal) | |
| DisjunctionOf (Label Principal) String (Label Principal) | |
| DisjunctionOf (Label Principal) Principal (Label Principal) | |
| ConjunctionOf (Label Principal) (Label Principal) (Label Principal) | |
| DisjunctionOf (Label Principal) (Label Principal) (Label Principal) |
It represents principals in the labels.
Instances
| Eq Principal | |
| Ord Principal | |
| Read Principal | |
| Show Principal | |
| Arbitrary Principal | |
| Singleton String Principal | |
| Singleton Principal Principal | |
| ConjunctionOf String String (Label Principal) | Instances usng strings and not principals |
| ConjunctionOf Principal Principal (Label Principal) | |
| DisjunctionOf String String (Label Principal) | |
| DisjunctionOf Principal Principal (Label Principal) | |
| ConjunctionOf String (Label Principal) (Label Principal) | |
| ConjunctionOf Principal (Label Principal) (Label Principal) | |
| DisjunctionOf String (Label Principal) (Label Principal) | |
| DisjunctionOf Principal (Label Principal) (Label Principal) | |
| ConjunctionOf (Label Principal) String (Label Principal) | |
| ConjunctionOf (Label Principal) Principal (Label Principal) | |
| DisjunctionOf (Label Principal) String (Label Principal) | |
| DisjunctionOf (Label Principal) Principal (Label Principal) | |
| ConjunctionOf (Label Principal) (Label Principal) (Label Principal) | |
| DisjunctionOf (Label Principal) (Label Principal) (Label Principal) |
isPrincipal :: Principal -> Label Principal -> BoolSource
It checks that a principal appears in a label.
labelToList :: Label Principal -> [[Principal]]Source
It converts a label into a list.
class DisjunctionOf a b c | a b -> c whereSource
Class used to create disjunctions
Instances
class ConjunctionOf a b c | a b -> c whereSource
Class used to create conjunctions
Instances
| ConjunctionOf String String (Label Principal) | Instances usng strings and not principals |
| ConjunctionOf Principal Principal (Label Principal) | |
| ConjunctionOf String (Label Principal) (Label Principal) | |
| ConjunctionOf Principal (Label Principal) (Label Principal) | |
| ConjunctionOf (Label Principal) String (Label Principal) | |
| ConjunctionOf (Label Principal) Principal (Label Principal) | |
| ConjunctionOf (Label Principal) (Label Principal) (Label Principal) |
singleton :: Singleton a b => a -> Label bSource
It creates a singleton label, i.e. a label with only one principal.
It represents disjunction category labels
integrityDC :: DCLabel Principal -> Label PrincipalSource
It extracts the label corresponding to the integrity component of a DCLabel
secrecyDC :: DCLabel Principal -> Label PrincipalSource
It extracts the label corresponding to the secrecy component of a DCLabel
own :: Ord a => Priv a -> DCLabel a -> BoolSource
It creates a DCLabel based on two labels.
It checks if a privilege is owned
privToLabel :: Priv a -> DCLabel aSource
It returns the privilege in the form of a label.
createPriv :: DCLabel a -> Priv aSource
It creates privileges. This functions must be used only by trustworthy code.