+
[oweals/gnunet.git] / src / credential / credential.h
index 597c34a3d75cf0bc5b4f0277d6b09a7ddee6f91b..66a4636fc73b1547d1225c1f64c8f3f906b5d2ea 100644 (file)
@@ -20,7 +20,7 @@
 /**
  * @file credential/credential.h
  * @brief IPC messages between CREDENTIAL API and CREDENTIAL service
- * @author Adnan Husain 
+ * @author Martin Schanzenbach
  */
 #ifndef CREDENTIAL_H
 #define CREDENTIAL_H
 GNUNET_NETWORK_STRUCT_BEGIN
 
 /**
- * Message from client to Credential service to lookup credentials.
+ * Message from client to Credential service to collect credentials.
  */
-struct LookupMessage
+struct CollectMessage
 {
   /**
-   * Header of type #GNUNET_MESSAGE_TYPE_CREDENTIAL_LOOKUP
+   * Header of type #GNUNET_MESSAGE_TYPE_CREDENTIAL_VERIFY
+   */
+  struct GNUNET_MessageHeader header;
+
+  /**
+   * Subject public key
+   */
+  struct GNUNET_CRYPTO_EcdsaPrivateKey subject_key;
+
+  /**
+   * Trust anchor
+   */
+  struct GNUNET_CRYPTO_EcdsaPublicKey issuer_key;
+
+  /**
+   * Length of the issuer attribute
+   */
+  uint16_t issuer_attribute_len;
+
+  /**
+   * Unique identifier for this request (for key collisions).
+   */
+  uint32_t id GNUNET_PACKED;
+
+  /* Followed by the zero-terminated attribute */
+
+};
+
+
+/**
+ * Message from client to Credential service to verify attributes.
+ */
+struct VerifyMessage
+{
+  /**
+   * Header of type #GNUNET_MESSAGE_TYPE_CREDENTIAL_VERIFY
    */
   struct GNUNET_MessageHeader header;
 
@@ -49,12 +84,22 @@ struct LookupMessage
    */
   struct GNUNET_CRYPTO_EcdsaPublicKey issuer_key;
 
+  /**
+   * Number of credentials
+   */
+  uint32_t c_count;
+
+  /**
+   * Length of the issuer attribute
+   */
+  uint16_t issuer_attribute_len;
+
   /**
    * Unique identifier for this request (for key collisions).
    */
   uint32_t id GNUNET_PACKED;
 
-  /* Followed by the zero-terminated credential to look up */
+  /* Followed by the zero-terminated attribute and credentials to look up */
 
 };
 
@@ -62,10 +107,10 @@ struct LookupMessage
 /**
  * Message from CREDENTIAL service to client: new results.
  */
-struct LookupResultMessage
+struct DelegationChainResultMessage
 {
   /**
-    * Header of type #GNUNET_MESSAGE_TYPE_CREDENTIAL_LOOKUP_RESULT
+    * Header of type #GNUNET_MESSAGE_TYPE_CREDENTIAL_VERIFY_RESULT
    */
   struct GNUNET_MessageHeader header;
 
@@ -73,15 +118,100 @@ struct LookupResultMessage
    * Unique identifier for this request (for key collisions).
    */
   uint32_t id GNUNET_PACKED;
+  
+  /**
+   * Indicates if credential has been found at all
+   */
+  uint32_t cred_found GNUNET_PACKED;
 
+  /**
+   * The number of delegations in the response
+   */
+  uint32_t d_count GNUNET_PACKED;
 
   /**
    * The number of credentials in the response
    */
-  uint32_t cd_count GNUNET_PACKED;
+  uint32_t c_count GNUNET_PACKED;
+
+  /* followed by ad_count GNUNET_CREDENTIAL_RecordData structs*/
+
+};
+
+struct DelegationRecordData
+{
+  /**
+   * Subject key
+   */
+  struct GNUNET_CRYPTO_EcdsaPublicKey subject_key;
+  
+  /**
+   * Subject attributes
+   */
+  uint32_t subject_attribute_len GNUNET_PACKED;
+};
+
+
+struct ChainEntry
+{
+  /**
+   * Issuer key
+   */
+  struct GNUNET_CRYPTO_EcdsaPublicKey issuer_key;
+  
+  /**
+   * Subject key
+   */
+  struct GNUNET_CRYPTO_EcdsaPublicKey subject_key;
+  
+  /**
+   * Issuer attributes
+   */
+  uint32_t issuer_attribute_len GNUNET_PACKED;
+  
+  /**
+   * Subject attributes
+   */
+  uint32_t subject_attribute_len GNUNET_PACKED;
+};
 
-  /* followed by cd_count GNUNET_CREDENTIAL_RecordData structs*/
 
+struct CredentialEntry
+{
+
+  /**
+   * The signature for this credential by the issuer
+   */
+  struct GNUNET_CRYPTO_EcdsaSignature signature;
+
+  /**
+   * Signature meta
+   */
+  struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
+
+  /**
+   * Public key of the issuer
+   */
+  struct GNUNET_CRYPTO_EcdsaPublicKey issuer_key;
+
+  /**
+   * Public key of the subject this credential was issued to
+   */
+  struct GNUNET_CRYPTO_EcdsaPublicKey subject_key;
+
+  /**
+   * Expiration time of this credential
+   */
+  uint64_t expiration GNUNET_PACKED;
+   
+  /**
+   * Issuer attribute length
+   */
+  uint32_t issuer_attribute_len;
+
+  /**
+   * Followed by the attribute string
+   */
 };