xref: /openbsd-src/lib/libkeynote/keynote.5 (revision d905fc10a3527c993c262ab7a5c86ba8232b3bdc)
1*d905fc10Sjsg.\" $OpenBSD: keynote.5,v 1.26 2022/02/18 10:24:32 jsg Exp $
204873885Sangelos.\"
304873885Sangelos.\" The author of this code is Angelos D. Keromytis (angelos@dsl.cis.upenn.edu)
404873885Sangelos.\"
504873885Sangelos.\" This code was written by Angelos D. Keromytis in Philadelphia, PA, USA,
604873885Sangelos.\" in April-May 1998
704873885Sangelos.\"
804873885Sangelos.\" Copyright (C) 1998, 1999 by Angelos D. Keromytis.
904873885Sangelos.\"
105e4ac158Sderaadt.\" Permission to use, copy, and modify this software with or without fee
1104873885Sangelos.\" is hereby granted, provided that this entire notice is included in
1204873885Sangelos.\" all copies of any software which is or includes a copy or
1304873885Sangelos.\" modification of this software.
1404873885Sangelos.\" You may use this code under the GNU public license if you so wish. Please
1504873885Sangelos.\" contribute changes back to the author.
1604873885Sangelos.\"
1704873885Sangelos.\" THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR
1804873885Sangelos.\" IMPLIED WARRANTY. IN PARTICULAR, THE AUTHORS MAKES NO
1904873885Sangelos.\" REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE
2004873885Sangelos.\" MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR
2104873885Sangelos.\" PURPOSE.
2204873885Sangelos.\"
23*d905fc10Sjsg.Dd $Mdocdate: February 18 2022 $
2477f4dfefSaaron.Dt KEYNOTE 5
2504873885Sangelos.\" .TH KeyNote 5 local
2604873885Sangelos.Os
2704873885Sangelos.Sh NAME
283b077433Sangelos.Nm keynote
2904873885Sangelos.Nd assertion format
3004873885Sangelos.Sh SYNOPSIS
3104873885Sangelos.Bd -literal
3204873885SangelosKeyNote-Version: 2
3304873885SangelosLocal-Constants: <assignments>
3404873885SangelosAuthorizer: <public key or tag>
3504873885SangelosLicensees: <public key or tag expression>
3604873885SangelosComment: <comment text>
3704873885SangelosConditions: <logic predicates>
3804873885SangelosSignature: <public key signature>
3904873885Sangelos.Ed
4004873885Sangelos.Sh DESCRIPTION
4104873885SangelosFor more details on
420b5f7278Smpech.Nm keynote ,
4304873885Sangelossee RFC 2704.
4404873885Sangelos.Pp
450b5f7278SmpechKeyNote assertions are divided into sections, called
460b5f7278Smpech.Sq fields ,
47ee997aeaSmpechthat serve various semantic functions.
48ee997aeaSmpechEach field starts with an
490b5f7278Smpechidentifying label at the beginning of a line, followed by the
50c2fc6b7aSjmc.Qq \&:
51ee997aeaSmpechcharacter and the field's contents.
52ee997aeaSmpechThere can be at most one field per line.
5304873885Sangelos.Pp
5404873885SangelosA field may be continued over more than one line by indenting
5504873885Sangelossubsequent lines with at least one ASCII SPACE or TAB character.
5604873885SangelosWhitespace (a SPACE, TAB, or NEWLINE character) separates tokens but
57ee997aeaSmpechis otherwise ignored outside of quoted strings.
58ee997aeaSmpechComments with a leading octothorp character ('#') may begin in any column.
5904873885Sangelos.Pp
6044143af3SderaadtOne mandatory field is required in all assertions: Authorizer.
6104873885Sangelos.Pp
6204873885SangelosSix optional fields may also appear: Comment, Conditions,
6304873885SangelosKeyNote-Version, Licensees, Local-Constants, Signature.
6404873885Sangelos.Pp
65ee997aeaSmpechAll field names are case-insensitive.
66ee997aeaSmpechThe
670b5f7278Smpech.Qq KeyNote-Version
6899dd6b60Sjmcfield, if present, appears first.
6999dd6b60SjmcThe
700b5f7278Smpech.Qq Signature
710b5f7278Smpechfield, if present, appears last.
720b5f7278SmpechOtherwise, fields may appear in any order.
730b5f7278SmpechEach field may appear at most once in any assertion.
7404873885Sangelos.Pp
7599dd6b60SjmcBlank lines are not permitted in assertions.
7699dd6b60SjmcMultiple assertions
7704873885Sangelosstored in a file (e.g., in application policy configurations),
7804873885Sangelostherefore, can be separated from one another unambiguously by the use
7904873885Sangelosof blank lines between them.
8004873885Sangelos.Sh COMMENTS
810b5f7278SmpechThe octothorp character
82b60214d1Sschwarze.Pf ( Sq # ,
830b5f7278SmpechASCII 35 decimal) can be used to
840b5f7278Smpechintroduce comments.
850b5f7278SmpechOutside of quoted strings, all characters from the
860b5f7278Smpech.Qq #
870b5f7278Smpechcharacter through the end of the current line are ignored.
8804873885SangelosHowever, commented text is included in the computation of assertion
8904873885Sangelossignatures.
9004873885Sangelos.Sh STRINGS
910b5f7278SmpechA
920b5f7278Smpech.Sq string
930b5f7278Smpechis a lexical object containing a sequence of characters.
9404873885SangelosStrings may contain any non-NUL characters, including newlines and
950b5f7278Smpechnonprintable characters.
960b5f7278SmpechStrings may be given as literals, computed from complex expressions,
970b5f7278Smpechor dereferenced from attribute names.
9804873885Sangelos.Sh STRING LITERALS
9999dd6b60SjmcA string literal directly represents the value of a string.
10099dd6b60SjmcString literals must be quoted by preceding and following them with the
10104873885Sangelosdouble-quote character (ASCII 34 decimal).
10204873885Sangelos.Pp
1030b5f7278SmpechA printable character may be
1040b5f7278Smpech.Sq escaped
1050b5f7278Smpechinside a quoted string literal by preceding it with the backslash
1062109c1eeSjmccharacter (ASCII 92 decimal) e.g.,
1070b5f7278Smpech.Qo like \&
1080b5f7278Smpech.No \e Ns Qo this Ns \e
1090b5f7278Smpech.Qc .
1100b5f7278Smpech.\".Pf { Qo mike Ns Qc 12
1112109c1eeSjmc.Qc .
1120b5f7278SmpechThis permits the inclusion of the double-quote and backslash characters
1130b5f7278Smpechinside string literals.
11404873885Sangelos.Pp
11504873885SangelosA similar escape mechanism is also used to represent non-printable
1160b5f7278Smpechcharacters.
117c2fc6b7aSjmc.Qq \en
1180b5f7278Smpechrepresents the newline character (ASCII character 10
1190b5f7278Smpechdecimal),
120c2fc6b7aSjmc.Qq \er
1210b5f7278Smpechrepresents the carriage-return character (ASCII
1220b5f7278Smpechcharacter 13 decimal),
123c2fc6b7aSjmc.Qq \et
1240b5f7278Smpechrepresents the tab character (ASCII character 9 decimal), and
125c2fc6b7aSjmc.Qq \ef
1260b5f7278Smpechrepresents the form-feed character (ASCII character 12 decimal).
1270b5f7278SmpechA backslash character followed by a newline suppresses all subsequent
1280b5f7278Smpechwhitespace (including the newline) up to the next non-whitespace character
1290b5f7278Smpech(this allows the continuation of long string constants across lines).
1300b5f7278SmpechUn-escaped newline and return characters are illegal inside string literals.
13104873885Sangelos.Pp
1320b5f7278SmpechThe constructs
133c2fc6b7aSjmc.Qq \e0o ,
134c2fc6b7aSjmc.Qq \e0oo ,
1350b5f7278Smpechand
136c2fc6b7aSjmc.Qq \eooo
1370b5f7278Smpech(where o represents any octal digit) may be used to represent any non-NUL
1380b5f7278SmpechASCII characters with their corresponding octal values (thus,
139c2fc6b7aSjmc.Qq \e012
1400b5f7278Smpechis the same as
141c2fc6b7aSjmc.Qq \en ,
142c2fc6b7aSjmc.Qq \e101
1430b5f7278Smpechis
1440b5f7278Smpech.Qq A ,
1450b5f7278Smpechand
146c2fc6b7aSjmc.Qq \e377
1470b5f7278Smpechis the ASCII character 255 decimal).
1480b5f7278SmpechHowever, the NUL character cannot be encoded in this manner;
149c2fc6b7aSjmc.Qq \e0 ,
150c2fc6b7aSjmc.Qq \e00 ,
1510b5f7278Smpechand
152c2fc6b7aSjmc.Qq \e000
1530b5f7278Smpechare converted to the strings
1540b5f7278Smpech.Qq 0 ,
1550b5f7278Smpech.Qq 00 ,
1560b5f7278Smpechand
1570b5f7278Smpech.Qq 000
1580b5f7278Smpechrespectively.
1590b5f7278SmpechSimilarly, all other escaped characters have the
1600b5f7278Smpechleading backslash removed (e.g.,
161c2fc6b7aSjmc.Qq \ea
1620b5f7278Smpechbecomes
1630b5f7278Smpech.Qq a ,
1640b5f7278Smpechand
1650b5f7278Smpech.Qq \e\e
1660b5f7278Smpechbecomes
1670b5f7278Smpech.Qq \e ) .
1680b5f7278SmpechThe following four strings are equivalent:
16904873885Sangelos.Bd -literal
170e1665715Sjmc        "this string contains a newline\en followed by one space."
171e1665715Sjmc        "this string contains a newline\en \e
17204873885Sangelos        followed by one space."
173e1665715Sjmc        "this str\e
174e1665715Sjmc           ing contains a \e
175e1665715Sjmc             newline\en followed by one space."
176e1665715Sjmc        "this string contains a newline\e012\e040followed by one space."
17704873885Sangelos.Ed
17804873885Sangelos.Sh STRING EXPRESSIONS
1790b5f7278SmpechIn general, anywhere a quoted string literal is allowed, a
1800b5f7278Smpech.Sq string expression
1810b5f7278Smpechcan be used.
1820b5f7278SmpechA string expression constructs a string from string constants,
1830b5f7278Smpechdereferenced attributes (described below), and a string concatenation
1840b5f7278Smpechoperator.
1850b5f7278SmpechString expressions may be parenthesized.
18604873885Sangelos.Bd -literal
18704873885Sangelos       <StrEx>:: <StrEx> "." <StrEx>    /* String concatenation */
18804873885Sangelos               | <StringLiteral>        /* Quoted string */
18904873885Sangelos               | "(" <StrEx> ")"
19004873885Sangelos               | <DerefAttribute>
19104873885Sangelos               | "$" <StrEx> ;
19204873885Sangelos.Ed
1930b5f7278Smpech.Pp
1940b5f7278SmpechThe
1950b5f7278Smpech.Qq $
1960b5f7278Smpechoperator has higher precedence than the
1974d4c7da9Sjmc.Qq .\&
1980b5f7278Smpechoperator.
19904873885Sangelos.Sh DEREFERENCED ATTRIBUTES
20004873885SangelosAction attributes provide the primary mechanism for applications to
201ee997aeaSmpechpass information to assertions.
202ee997aeaSmpechAttribute names are strings from a
20304873885Sangeloslimited character set (see below), and attribute values are
204ee997aeaSmpechrepresented internally as strings.
205ee997aeaSmpechAn attribute is dereferenced simply by using its name.
206ee997aeaSmpechIn general, KeyNote allows the use of an attribute anywhere a string literal
207ee997aeaSmpechis permitted.
20804873885Sangelos.Pp
209ee997aeaSmpechAttributes are dereferenced as strings by default.
210ee997aeaSmpechWhen required,
21104873885Sangelosdereferenced attributes can be converted to integers or floating point
2120b5f7278Smpechnumbers with the type conversion operators
213c2fc6b7aSjmc.Qq @
2140b5f7278Smpechand
21544143af3Sderaadt.Qq & .
2160b5f7278SmpechThus, an attribute named
2170b5f7278Smpech.Qq foo
2180b5f7278Smpechhaving the value
2190b5f7278Smpech.Qq 1.2
2200b5f7278Smpechmay be interpreted as the string
2210b5f7278Smpech.Qq 1.2
2220b5f7278Smpech(foo), the integer value 1 (@foo), or the floating point
22304873885Sangelosvalue 1.2 (&foo).
22404873885Sangelos.Pp
22504873885SangelosAttributes converted to integer and floating point numbers are
2260b5f7278Smpechrepresented according to the ANSI C
2270b5f7278Smpech.Sq long
2280b5f7278Smpechand
2290b5f7278Smpech.Sq float
2300b5f7278Smpechtypes, respectively.
2310b5f7278SmpechIn particular, integers range from -2147483648 to 2147483647, whilst floats
2320b5f7278Smpechrange from 1.17549435E-38F to 3.40282347E+38F.
23304873885Sangelos.Pp
23404873885SangelosAny uninitialized attribute has the empty-string value when
23504873885Sangelosdereferenced as a string and the value zero when dereferenced as an
23604873885Sangelosinteger or float.
23704873885Sangelos.Pp
23804873885SangelosAttribute names may be given literally or calculated from string
239ee997aeaSmpechexpressions and may be recursively dereferenced.
240ee997aeaSmpechIn the simplest case,
24104873885Sangelosan attribute is dereferenced simply by using its name outside of
2420b5f7278Smpechquotes; e.g., the string value of the attribute named
2430b5f7278Smpech.Qq foo
2440b5f7278Smpechis by reference to
2450b5f7278Smpech.Sq foo
2460b5f7278Smpech(outside of quotes).
2470b5f7278SmpechThe
2480b5f7278Smpech.Qo $ Ns Ao StrEx
2490b5f7278Smpech.Ac
2500b5f7278Smpech.Qc
2510b5f7278Smpechconstruct dereferences the attribute named in the string expression
2520b5f7278Smpech.Aq StrEx .
2530b5f7278SmpechFor example, if the attribute named
2540b5f7278Smpech.Qq foo
2550b5f7278Smpechcontains the string
2560b5f7278Smpech.Qq bar ,
2570b5f7278Smpechthe attribute named
2580b5f7278Smpech.Qq bar
2590b5f7278Smpechcontains the string
2600b5f7278Smpech.Qq xyz ,
2610b5f7278Smpechand the attribute
2620b5f7278Smpech.Qq xyz
2630b5f7278Smpechcontains the string
2640b5f7278Smpech.Qq qua ,
2650b5f7278Smpechthe following string comparisons are all true:
26604873885Sangelos.Bd -literal
26704873885Sangelos    foo == "bar"
26804873885Sangelos    $("foo") == "bar"
26904873885Sangelos    $foo == "xyz"
27004873885Sangelos    $(foo) == "xyz"
27104873885Sangelos    $$foo == "qua"
27204873885Sangelos.Ed
27304873885Sangelos.Pp
2740b5f7278SmpechIf
2750b5f7278Smpech.Aq StrEx
2760b5f7278Smpechevaluates to an invalid or uninitialized attribute name, its value is
2770b5f7278Smpechconsidered to be the empty string (or zero if used as a numeric).
2780b5f7278Smpech.Pp
2790b5f7278SmpechThe
2800b5f7278Smpech.Aq DerefAttribute
2810b5f7278Smpechtoken is defined as:
28204873885Sangelos.Bd -literal
28304873885Sangelos      <DerefAttribute>:: <AttributeID> ;
28404873885Sangelos       <AttributeID>:: {Any string starting with a-z, A-Z, or the
28504873885Sangelos                        underscore character, followed by any number of
28604873885Sangelos                        a-z, A-Z, 0-9, or underscore characters} ;
28704873885Sangelos.Ed
28804873885Sangelos.Sh PRINCIPAL IDENTIFIERS
2890b5f7278SmpechPrincipals are represented as ASCII strings called
2900b5f7278Smpech.Sq Principal Identifiers .
2910b5f7278SmpechPrincipal Identifiers may be arbitrary labels whose structure is not
2920b5f7278Smpechinterpreted by the KeyNote system or they may encode cryptographic keys
2930b5f7278Smpechthat are used by KeyNote for credential signature verification.
29404873885Sangelos.Bd -literal
29504873885Sangelos       <PrincipalIdentifier>:: <OpaqueID>
29604873885Sangelos                             | <KeyID> ;
29704873885Sangelos.Ed
29804873885Sangelos.Sh OPAQUE PRINCIPAL IDENTIFIERS
29904873885SangelosPrincipal Identifiers that are used by KeyNote only as labels are
3000b5f7278Smpechsaid to be
3010b5f7278Smpech.Sq opaque .
3020b5f7278SmpechOpaque identifiers are encoded in assertions as strings (as defined above):
303c2fc6b7aSjmc.Pp
304c2fc6b7aSjmc.Dl <OpaqueID>:: <StrEx>\ \&;
3050b5f7278Smpech.Pp
3060b5f7278SmpechOpaque identifier strings should not contain the
307c2fc6b7aSjmc.Qq \&:
3080b5f7278Smpechcharacter.
30904873885Sangelos.Sh CRYPTOGRAPHIC PRINCIPAL IDENTIFIERS
31004873885SangelosPrincipal Identifiers that are used by KeyNote as keys, e.g., to
3110b5f7278Smpechverify credential signatures, are said to be
3120b5f7278Smpech.Sq cryptographic .
31304873885SangelosCryptographic identifiers are also lexically encoded as strings:
314c2fc6b7aSjmc.Pp
315c2fc6b7aSjmc.Dl <KeyID>:: <StrEx>\ \&;
3160b5f7278Smpech.Pp
31704873885SangelosUnlike Opaque Identifiers, however, Cryptographic Identifier strings
318ee997aeaSmpechhave a special form.
319ee997aeaSmpechTo be interpreted by KeyNote (for signature
32004873885Sangelosverification), an identifier string should be of the form:
321c2fc6b7aSjmc.Pp
322c2fc6b7aSjmc.Dl <IDString>:: <ALGORITHM>":"<ENCODEDBITS>\ \&;
32304873885Sangelos.Pp
3240b5f7278Smpech.Qq ALGORITHM
3250b5f7278Smpechis an ASCII substring that describes the algorithms to be
326ee997aeaSmpechused in interpreting the key's bits.
327ee997aeaSmpechThe ALGORITHM identifies the major cryptographic algorithm (e.g., RSA
3280b5f7278Smpech.Bq RSA78 ,
3290b5f7278SmpechDSA
3300b5f7278Smpech.Bq DSA94 ,
3310b5f7278Smpechetc.),
3320b5f7278Smpechstructured format (e.g., PKCS1
3330b5f7278Smpech.Bq PKCS1 ) ,
334ee997aeaSmpechand key bit encoding (e.g., HEX or BASE64).
335ee997aeaSmpechBy convention, the ALGORITHM
3360b5f7278Smpechsubstring starts with an alphabetic character and can contain letters,
3372109c1eeSjmcdigits, underscores, or dashes i.e., it should match the regular expression
3382109c1eeSjmc.Qq Bo a-zA-Z Bc Ns Bo a-zA-Z0-9_- Bc Ns * .
3390b5f7278SmpechThe IANA (or some other appropriate authority) will provide a registry of
3400b5f7278Smpechreserved algorithm identifiers.
3410b5f7278Smpech.Pp
3420b5f7278Smpech.Qq ENCODEDBITS
3430b5f7278Smpechis a substring of characters representing the key's bits, the encoding and
3440b5f7278Smpechformat of which depends on the ALGORITHM.
3450b5f7278SmpechBy convention, hexadecimal encoded keys use lower-case ASCII characters.
34604873885Sangelos.Pp
34704873885SangelosCryptographic Principal Identifiers are converted to a normalized
34804873885Sangeloscanonical form for the purposes of any internal comparisons between
34904873885Sangelosthem; see RFC 2704 for more details.
35004873885Sangelos.Sh KEYNOTE-VERSION FIELD
35104873885SangelosThe KeyNote-Version field identifies the version of the KeyNote
352ee997aeaSmpechassertion language under which the assertion was written.
353ee997aeaSmpechThe KeyNote-Version field is of the form:
35404873885Sangelos.Bd -literal
35504873885Sangelos       <VersionField>:: "KeyNote-Version:" <VersionString> ;
35604873885Sangelos       <VersionString>:: <StringLiteral>
35704873885Sangelos                       | <IntegerLiteral> ;
35804873885Sangelos.Ed
3590b5f7278Smpech.Pp
3600b5f7278Smpech.Aq VersionString
3610b5f7278Smpechis an ASCII-encoded string.
3620b5f7278SmpechAssertions in production versions of KeyNote use decimal digits in the version
3630b5f7278Smpechrepresenting the version number of the KeyNote language under which they are
3640b5f7278Smpechto be interpreted.
3650b5f7278SmpechAssertions written to conform with this document should be identified with the
3660b5f7278Smpechversion string
3670b5f7278Smpech.Qq 2
36899dd6b60Sjmc(or the integer 2).
36999dd6b60SjmcThe KeyNote-Version field, if included, should appear first.
37004873885Sangelos.Sh LOCAL-CONSTANTS FIELD
37104873885SangelosThis field adds or overrides action attributes in the current
3720b5f7278Smpechassertion only.
3730b5f7278SmpechThis mechanism allows the use of short names for (frequently lengthy)
3740b5f7278Smpechcryptographic principal identifiers, especially to make the Licensees field
3750b5f7278Smpechmore readable.
3760b5f7278SmpechThe Local-Constants field is of the form:
37704873885Sangelos.Bd -literal
37804873885Sangelos       <LocalConstantsField>:: "Local-Constants:" <Assignments> ;
37904873885Sangelos       <Assignments>:: /* can be empty */
38004873885Sangelos                     | <AttributeID> "=" <StringLiteral> <Assignments> ;
38104873885Sangelos.Ed
38204873885Sangelos.Pp
3830b5f7278Smpech.Aq AttributeID
3840b5f7278Smpechis an attribute name from the action attribute namespace.
3850b5f7278SmpechThe name is available for use as an attribute in any subsequent field.
3860b5f7278SmpechIf the Local-Constants field defines more than one identifier, it can occupy
3870b5f7278Smpechmore than one line and be indented.
3880b5f7278Smpech.Aq StringLiteral
3890b5f7278Smpechis a string literal as described previously.
3900b5f7278SmpechAttributes defined in the Local-Constants field override any attributes with
3910b5f7278Smpechthe same name passed in with the action attribute set.
3920b5f7278Smpech.Pp
3930b5f7278SmpechAn attribute may be initialized at most once in the Local-Constants field.
3940b5f7278SmpechIf an attribute is initialized more than once in an assertion, the entire
3950b5f7278Smpechassertion is considered invalid and is not considered by the KeyNote
3960b5f7278Smpechcompliance checker in evaluating queries.
39704873885Sangelos.Sh AUTHORIZER FIELD
3980b5f7278SmpechThe Authorizer identifies the Principal issuing the assertion.
3990b5f7278SmpechThis field is of the form:
40004873885Sangelos.Bd -literal
40104873885Sangelos       <AuthField>:: "Authorizer:" <AuthID> ;
40204873885Sangelos       <AuthID>:: <PrincipalIdentifier>
40304873885Sangelos                | <DerefAttribute> ;
40404873885Sangelos.Ed
4050b5f7278Smpech.Pp
40604873885SangelosThe Principal Identifier may be given directly or by reference to the
40704873885Sangelosattribute namespace.
40804873885Sangelos.Sh LICENSEES FIELD
40904873885SangelosThe Licensees field identifies the principals authorized by the
4100b5f7278Smpechassertion.
4110b5f7278SmpechMore than one principal can be authorized, and authorization can be
4120b5f7278Smpechdistributed across several principals through the use of
4130b5f7278Smpech.Sq and
4140b5f7278Smpechand threshold constructs.
4150b5f7278SmpechThis field is of the form:
41604873885Sangelos.Bd -literal
41704873885Sangelos       <LicenseesField>:: "Licensees:" <LicenseesExpr> ;
41804873885Sangelos
41904873885Sangelos       <LicenseesExpr>::      /* can be empty */
42004873885Sangelos                         | <PrincExpr> ;
42104873885Sangelos
42204873885Sangelos       <PrincExpr>:: "(" <PrincExpr> ")"
42304873885Sangelos                     | <PrincExpr> "&&" <PrincExpr>
42404873885Sangelos                     | <PrincExpr> "||" <PrincExpr>
42504873885Sangelos                     | <K>"-of(" <PrincList> ")"        /* Threshold */
42604873885Sangelos                     | <PrincipalIdentifier>
42704873885Sangelos                     | <DerefAttribute> ;
42804873885Sangelos
42904873885Sangelos       <PrincList>:: <PrincipalIdentifier>
43004873885Sangelos                   | <DerefAttribute>
43104873885Sangelos                   | <PrincList> "," <PrincList> ;
43204873885Sangelos
43304873885Sangelos       <K>:: {Decimal number starting with a digit from 1 to 9} ;
43404873885Sangelos.Ed
4350b5f7278Smpech.Pp
4360b5f7278SmpechThe
4370b5f7278Smpech.Qq &&
4380b5f7278Smpechoperator has higher precedence than the
4390b5f7278Smpech.Qq ||
4400b5f7278Smpechoperator.
4410b5f7278Smpech.Aq K
4420b5f7278Smpechis an ASCII-encoded positive decimal integer.
4430b5f7278SmpechIf a
4440b5f7278Smpech.Aq PrincList
4450b5f7278Smpechcontains fewer than
4460b5f7278Smpech.Aq K
4470b5f7278Smpechprincipals, the entire assertion is omitted from processing.
44804873885Sangelos.Sh CONDITIONS FIELD
4490b5f7278SmpechThis field gives the
4500b5f7278Smpech.Sq conditions
4510b5f7278Smpechunder which the Authorizer trusts the Licensees to perform an action.
4520b5f7278Smpech.Sq Conditions
4530b5f7278Smpechare predicates that operate on the action attribute set.
4540b5f7278SmpechThe Conditions field is of the form:
45504873885Sangelos.Bd -literal
45604873885Sangelos    <ConditionsField>:: "Conditions:" <ConditionsProgram> ;
45704873885Sangelos
45804873885Sangelos    <ConditionsProgram>:: /* Can be empty */
45904873885Sangelos                          | <Clause> ";" <ConditionsProgram> ;
46004873885Sangelos
46104873885Sangelos    <Clause>:: <Test> "->" "{" <ConditionsProgram> "}"
46204873885Sangelos             | <Test> "->" <Value>
46304873885Sangelos             | <Test> ;
46404873885Sangelos
46504873885Sangelos    <Value>:: <StrEx> ;
46604873885Sangelos
46704873885Sangelos    <Test>:: <RelExpr> ;
46804873885Sangelos
46904873885Sangelos    <RelExpr>:: "(" <RelExpr> ")"        /* Parentheses */
47004873885Sangelos              | <RelExpr> "&&" <RelExpr> /* Logical AND */
47104873885Sangelos              | <RelExpr> "||" <RelExpr> /* Logical OR */
47204873885Sangelos              | "!" <RelExpr>         /* Logical NOT */
47304873885Sangelos              | <IntRelExpr>
47404873885Sangelos              | <FloatRelExpr>
47504873885Sangelos              | <StringRelExpr>
47604873885Sangelos              | "true"        /* case insensitive */
47704873885Sangelos              | "false" ;     /* case insensitive */
47804873885Sangelos
47904873885Sangelos    <IntRelExpr>:: <IntEx> "==" <IntEx>
48004873885Sangelos                 | <IntEx> "!=" <IntEx>
48104873885Sangelos                 | <IntEx> "<" <IntEx>
48204873885Sangelos                 | <IntEx> ">" <IntEx>
48304873885Sangelos                 | <IntEx> "<=" <IntEx>
48404873885Sangelos                 | <IntEx> ">=" <IntEx> ;
48504873885Sangelos
48604873885Sangelos    <FloatRelExpr>:: <FloatEx> "<" <FloatEx>
48704873885Sangelos                   | <FloatEx> ">" <FloatEx>
48804873885Sangelos                   | <FloatEx> "<=" <FloatEx>
48904873885Sangelos                   | <FloatEx> ">=" <FloatEx> ;
49004873885Sangelos
49104873885Sangelos    <StringRelExpr>:: <StrEx> "==" <StrEx>  /* String equality */
49204873885Sangelos                    | <StrEx> "!=" <StrEx>  /* String inequality */
49304873885Sangelos                    | <StrEx> "<" <StrEx>   /* Alphanum. comparisons */
49404873885Sangelos                    | <StrEx> ">" <StrEx>
49504873885Sangelos                    | <StrEx> "<=" <StrEx>
49604873885Sangelos                    | <StrEx> ">=" <StrEx>
49704873885Sangelos                    | <StrEx> "~=" <RegExpr> ; /* Reg. expr. matching */
49804873885Sangelos
49904873885Sangelos    <IntEx>:: <IntEx> "+" <IntEx>        /* Integer */
50004873885Sangelos            | <IntEx> "-" <IntEx>
50104873885Sangelos            | <IntEx> "*" <IntEx>
50204873885Sangelos            | <IntEx> "/" <IntEx>
50304873885Sangelos            | <IntEx> "%" <IntEx>
50404873885Sangelos            | <IntEx> "^" <IntEx>        /* Exponentiation */
50504873885Sangelos            | "-" <IntEx>
50604873885Sangelos            | "(" <IntEx> ")"
50704873885Sangelos            | <IntegerLiteral>
50804873885Sangelos            | "@" <StrEx> ;
50904873885Sangelos
51004873885Sangelos    <FloatEx>:: <FloatEx> "+" <FloatEx>  /* Floating point */
51104873885Sangelos              | <FloatEx> "-" <FloatEx>
51204873885Sangelos              | <FloatEx> "*" <FloatEx>
51304873885Sangelos              | <FloatEx> "/" <FloatEx>
51404873885Sangelos              | <FloatEx> "^" <FloatEx> /* Exponentiation */
51504873885Sangelos              | "-" <FloatEx>
51604873885Sangelos              | "(" <FloatEx> ")"
51704873885Sangelos              | <FloatLiteral>
51804873885Sangelos              | "&" <StrEx> ;
51904873885Sangelos
52004873885Sangelos    <IntegerLiteral>:: {Decimal number of at least one digit} ;
52104873885Sangelos    <FloatLiteral>:: <IntegerLiteral>"."<IntegerLiteral> ;
52204873885Sangelos
52304873885Sangelos    <StringLiteral> is a quoted string as defined in previously
52404873885Sangelos    <AttributeID> is defined previously.
52504873885Sangelos.Ed
5260b5f7278Smpech.Pp
52704873885SangelosThe operation precedence classes are (from highest to lowest):
52804873885Sangelos.Bd -literal
52904873885Sangelos        { (, ) }
53004873885Sangelos        {unary -, @, &, $}
53104873885Sangelos        {^}
53204873885Sangelos        {*, /, %}
53304873885Sangelos        {+, -, .}
53404873885Sangelos.Ed
5350b5f7278Smpech.Pp
53604873885SangelosOperators in the same precedence class are evaluated left-to-right.
53704873885Sangelos.Pp
53804873885SangelosNote the inability to test for floating point equality, as most
53904873885Sangelosfloating point implementations (hardware or otherwise) do not
54004873885Sangelosguarantee accurate equality testing.
54104873885Sangelos.Pp
54204873885SangelosAlso note that integer and floating point expressions can only be used
54304873885Sangeloswithin clauses of condition fields, but in no other KeyNote field.
54404873885Sangelos.Pp
5450b5f7278SmpechThe keywords
5460b5f7278Smpech.Qq true
5470b5f7278Smpechand
5480b5f7278Smpech.Qq false
5490b5f7278Smpechare not reserved; they can be used as attribute or principal identifier
5500b5f7278Smpechnames (although this practice makes assertions difficult to understand
5510b5f7278Smpechand is discouraged).
55204873885Sangelos.Pp
5530b5f7278Smpech.Aq RegExpr
5540b5f7278Smpechis a standard regular expression, conforming to the
5550b5f7278Smpech.St -p1003.2
5560b5f7278Smpechregular expression syntax and semantics (see
55704873885Sangelos.Xr regex 3 ) .
55804873885Sangelos.Pp
55904873885SangelosAny string expression (or attribute) containing the ASCII
56004873885Sangelosrepresentation of a numeric value can be converted to an integer or
5610b5f7278Smpechfloat with the use of the
562c2fc6b7aSjmc.Qq @
5630b5f7278Smpechand
56444143af3Sderaadt.Qq &
5650b5f7278Smpechoperators, respectively.
5660b5f7278SmpechAny fractional component of an attribute value dereferenced as an integer
5670b5f7278Smpechis rounded down.
5680b5f7278SmpechIf an attribute dereferenced as a number cannot be properly converted
5690b5f7278Smpech(e.g., it contains invalid characters or is empty) its value is considered
5700b5f7278Smpechto be zero.
57104873885Sangelos.Sh COMMENT FIELD
57204873885SangelosThe Comment field allows assertions to be annotated with information
573ee997aeaSmpechdescribing their purpose.
574ee997aeaSmpechIt is of the form:
575c2fc6b7aSjmc.Pp
576c2fc6b7aSjmc.Dl <CommentField>:: \&"Comment:\&" <text>\ \&;
5770b5f7278Smpech.Pp
57804873885SangelosNo interpretation of the contents of this field is performed by
5790b5f7278SmpechKeyNote.
5800b5f7278SmpechNote that this is one of two mechanisms for including
58104873885Sangeloscomments in KeyNote assertions; comments can also be inserted anywhere
5820b5f7278Smpechin an assertion's body by preceding them with the
58344143af3Sderaadt.Qq #
5840b5f7278Smpechcharacter (except inside string literals).
58504873885Sangelos.Sh SIGNATURE FIELD
58604873885SangelosThe Signature field identifies a signed assertion and gives the
58704873885Sangelosencoded digital signature of the principal identified in the
5880b5f7278SmpechAuthorizer field.
5890b5f7278SmpechThe Signature field is of the form:
59004873885Sangelos.Bd -literal
59104873885Sangelos       <SignatureField>:: "Signature:" <Signature> ;
59204873885Sangelos       <Signature>:: <StrEx> ;
59304873885Sangelos.Ed
5940b5f7278Smpech.Pp
59504873885SangelosThe <Signature> string should be of the form:
596c2fc6b7aSjmc.Pp
597c2fc6b7aSjmc.Dl <IDString>:: <ALGORITHM>":"<ENCODEDBITS>\ \&;
5980b5f7278Smpech.Pp
5990b5f7278SmpechThe formats of the
6000b5f7278Smpech.Qq ALGORITHM
6010b5f7278Smpechand
6020b5f7278Smpech.Qq ENCODEDBITS
6030b5f7278Smpechsubstrings are as described for Cryptographic Principal Identifiers.
6040b5f7278SmpechThe algorithm name should be the same as that of the principal appearing
6050b5f7278Smpechin the Authorizer field.
6060b5f7278SmpechThe IANA (or some other suitable authority) will provide a registry of
6070b5f7278Smpechreserved names.
6080b5f7278SmpechIt is not necessary that the encodings of the signature and the authorizer
6090b5f7278Smpechkey be the same.
61004873885Sangelos.Pp
61104873885SangelosIf the signature field is included, the principal named in the
61204873885SangelosAuthorizer field must be a Cryptographic Principal Identifier, the
61304873885Sangelosalgorithm must be known to the KeyNote implementation, and the
61404873885Sangelossignature must be correct for the assertion body and authorizer key.
61504873885Sangelos.Pp
61604873885SangelosThe signature is computed over the assertion text, beginning with the
61704873885Sangelosfirst field (including the field identifier string), up to (but not
6180b5f7278Smpechincluding) the Signature field identifier.
6190b5f7278SmpechThe newline preceding the signature field identifier is the last character
6200b5f7278Smpechincluded in signature calculation.
6210b5f7278SmpechThe signature is always the last field in a KeyNote assertion.
6220b5f7278SmpechText following this field is not considered part of the assertion.
62304873885Sangelos.Sh EXAMPLES
62404873885SangelosNote that the keys and signatures in these examples are fictional, and
62504873885Sangelosgenerally much shorter than would be required for real security, in
62604873885Sangelosthe interest of readability.
62704873885Sangelos.Bd -literal
62804873885Sangelos           Authorizer: "POLICY"
62904873885Sangelos           Licensees: "RSA:abc123"
63004873885Sangelos
63104873885Sangelos           KeyNote-Version: 2
63204873885Sangelos           Local-Constants: Alice="DSA:4401ff92"  # Alice's key
63304873885Sangelos                            Bob="RSA:d1234f"      # Bob's key
63404873885Sangelos           Authorizer: "RSA:abc123"
63504873885Sangelos           Licensees: Alice || Bob
63604873885Sangelos           Conditions: (app_domain == "RFC822-EMAIL") &&
63704873885Sangelos                       (address ~=   # only applies to one domain
638e1665715Sjmc                         "^.*@keynote\e.research\e.att\e.com$") ->
63904873885Sangelos			"true";
64004873885Sangelos           Signature: "RSA-SHA1:213354f9"
64104873885Sangelos
64204873885Sangelos           KeyNote-Version: 2
64304873885Sangelos           Authorizer: "DSA:4401ff92"  # the Alice CA
64404873885Sangelos           Licensees: "DSA:12340987"   # mab's key
64504873885Sangelos           Conditions: ((app_domain == "RFC822-EMAIL") -> {
64604873885Sangelos	                        (name == "M. Blaze" || name == "") &&
64704873885Sangelos		                (address ==
64804873885Sangelos                                    "mab@keynote.research.att.com"));
64904873885Sangelos				(name == "anonymous") -> "logandaccept";
65004873885Sangelos			}
65104873885Sangelos
65204873885Sangelos           Signature: "DSA-SHA1:ab23487"
65304873885Sangelos
65404873885Sangelos           KeyNote-Version: "2"
65504873885Sangelos           Authorizer: "DSA:4401ff92"   # the Alice CA
65604873885Sangelos           Licensees: "DSA:abc991" ||   # jf's DSA key
65704873885Sangelos                      "RSA:cde773" ||   # jf's RSA key
65804873885Sangelos                      "BFIK:fd091a"     # jf's BFIK key
65904873885Sangelos           Conditions: ((app_domain == "RFC822-EMAIL") &&
66004873885Sangelos                        (name == "J. Feigenbaum" || name == "") &&
66104873885Sangelos                        (address == "jf@keynote.research.att.com"));
66204873885Sangelos           Signature: "DSA-SHA1:8912aa"
66304873885Sangelos.Ed
66404873885Sangelos.Sh SEE ALSO
66504873885Sangelos.Xr keynote 1 ,
66604873885Sangelos.Xr keynote 3 ,
66704873885Sangelos.Xr keynote 4
6680b5f7278Smpech.Rs
6690b5f7278Smpech.%A M. Blaze
6700b5f7278Smpech.%A J. Feigenbaum
6710b5f7278Smpech.%A J. Lacy
6720b5f7278Smpech.%D 1996
673cc15c4a4Sjmc.%J IEEE Symposium on Security and Privacy
674cc15c4a4Sjmc.%T Decentralized Trust Management
6750b5f7278Smpech.Re
6760b5f7278Smpech.Rs
6770b5f7278Smpech.%A M. Blaze
6780b5f7278Smpech.%A J. Feigenbaum
6790b5f7278Smpech.%A M. Strauss
6800b5f7278Smpech.%D 1998
681cc15c4a4Sjmc.%J Financial Crypto Conference
682cc15c4a4Sjmc.%T Compliance-Checking in the PolicyMaker Trust Management System
683cc15c4a4Sjmc.Re
684cc15c4a4Sjmc.Sh STANDARDS
685cc15c4a4Sjmc.Rs
686cc15c4a4Sjmc.%A M. Blaze
687cc15c4a4Sjmc.%A J. Feigenbaum
688cc15c4a4Sjmc.%A J. Ioannidis
689cc15c4a4Sjmc.%A A. Keromytis
690cc15c4a4Sjmc.%D September 1999
691cc15c4a4Sjmc.%R RFC 2704
692cc15c4a4Sjmc.%T The KeyNote Trust-Management System Version 2
6930b5f7278Smpech.Re
694ea2542f8Smpech.Sh AUTHORS
6957d353dc4Sschwarze.An Angelos D. Keromytis Aq Mt angelos@cs.columbia.edu
69604873885Sangelos.Sh WEB PAGE
697*d905fc10Sjsg.Lk https://www1.cs.columbia.edu/~angelos/keynote.html
698