| 106 | == The Interface == |
| 107 | |
| 108 | The server expects an XMLRPC array of XMLRPC structs containing the credentials to represent. In the input, each struct has two fields: |
| 109 | |
| 110 | '''id''':: |
| 111 | a string used to map from input to output credentials |
| 112 | '''credential''':: |
| 113 | a Binary object holding the credential bits |
| 114 | |
| 115 | The ids are free form strings used to map the input to the output. The credential bits are also returned, but matching ids can be easier. {{{cred_client.py}} uses 3 digit serial numbers (the first line of the output), but an application can use any unique identifier. In fact, the server never confirms their uniqueness, but matching input to output can be tricky without it. |
| 116 | |
| 117 | The server validates and translates the credentials into text and returns them in a more complex array of structs. Notice that the credentials must be validated. To decode an attribute certificate, the identity credential of the issuer must be included in the request. |
| 118 | |
| 119 | The output is an array of structs with the following members: |
| 120 | |
| 121 | '''id''':: |
| 122 | a string used to map from input to output credentials (identical to input) |
| 123 | '''credential''':: |
| 124 | a Binary object holding the credential bits (identical to input) |
| 125 | '''type''':: |
| 126 | a string indicating what the credential encodes. Will be one of be "identity", "attribute", or "unknown". |
| 127 | '''str''':: |
| 128 | a string, the representation of the attribute or identity in terms of keyids |
| 129 | '''auxstr''':: |
| 130 | a string, the representation of the attribute or identity in terms of hunam-readable names (CNs). If CNs are missing or unresolvable, the keyids will be used. |
| 131 | '''errcode''':: |
| 132 | an integer, the [source:doc/API libabac return code] of the attempted conversion. If this is non-zero, the '''str''' and '''auxstr''' contents are undefined. ({{{cred_server.py}}} sets them to the empty string, but do not rely on that.) |
| 133 | |
| 134 | The output array is ''not'' guaranteed to be in the same order as the input array (and generally will not be). Use the '''id''' member to match input and output. |
| 135 | |
| 136 | Just for concreteness, here is the python encoding for a simple request and response: |
| 137 | |
| 138 | Request |
| 139 | {{{ |
| 140 | [ |
| 141 | {'credential': <xmlrpclib.Binary instance at 0x28b3dacc>, 'id': '000'}, |
| 142 | {'credential': <xmlrpclib.Binary instance at 0x28b3db6c>, 'id': '001'}, |
| 143 | {'credential': <xmlrpclib.Binary instance at 0x28b3db4c>, 'id': '002'} |
| 144 | ] |
| 145 | }}} |
| 146 | |
| 147 | Three dicts/structs are encoded with a serial number as id and the binary of the credential. |
| 148 | |
| 149 | Response |
| 150 | {{{ |
| 151 | [ |
| 152 | {'credential': <xmlrpclib.Binary instance at 0x28b3dacc>, 'errcode': 0, 'auxstr': 'Acme', 'str': '9b47d3669b99a4ce1d3a0055be002ea6a580041a', 'type': 'identity', 'id': '000'}, |
| 153 | {'credential': <xmlrpclib.Binary instance at 0x28b3db6c>, 'errcode': 0, 'auxstr': 'Acme.partner <- f923e9f69d33b52d8bbdfd19f2ec89dde7beedd7', 'str': '9b47d3669b99a4ce1d3a0055be002ea6a580041a.partner <- f923e9f69d33b52d8bbdfd19f2ec89dde7beedd7', 'type': 'attribute', 'id': '001'}, |
| 154 | {'credential': <xmlrpclib.Binary instance at 0x28b3db4c>, 'errcode': -1, 'auxstr': '', 'str': '', 'type': 'unknown', 'id': '002'} |
| 155 | ] |
| 156 | }}} |
| 157 | |
| 158 | The first dict/struct is an identity, the second an attribute, and the third an invalid certificate. |