*/
#define GNUNET_CRYPTO_AES_KEY_LENGTH (256/8)
-
/**
* @brief Length of RSA encrypted data (2048 bit)
*
*/
#define GNUNET_CRYPTO_RSA_DATA_ENCODING_LENGTH 256
-
/**
* Length of an RSA KEY (n,e,len), 2048 bit (=256 octests) key n, 2 byte e
*/
#define GNUNET_CRYPTO_RSA_KEY_LENGTH 258
-
/**
* Length of a hash value
*/
-#define GNUNET_CRYPTO_HASH_LENGTH 512/8
-
+#define GNUNET_CRYPTO_HASH_LENGTH (512/8)
/**
- * FIXME: what is an acceptable value here?
- * Note: round to multiple of 8 minus 2.
+ * Maximum length of an ECC signature.
+ * Note: round up to multiple of 8 minus 2 for alignment.
*/
-#define GNUNET_CRYPTO_ECC_DATA_ENCODING_LENGTH 510
+#define GNUNET_CRYPTO_ECC_SIGNATURE_DATA_ENCODING_LENGTH 190
/**
- * FIXME: what is an acceptable value here?
* Maximum length of the public key (q-point, Q = dP) when encoded.
*/
-#define GNUNET_CRYPTO_ECC_MAX_PUBLIC_KEY_LENGTH 254
+#define GNUNET_CRYPTO_ECC_MAX_PUBLIC_KEY_LENGTH 140
/**
struct GNUNET_CRYPTO_EccSignature
{
/**
- * Overall size of the encrypted data.
+ * Overall size of the signature data.
*/
uint16_t size;
/**
* S-expression, padded with zeros.
*/
- char sexpr[GNUNET_CRYPTO_ECC_DATA_ENCODING_LENGTH];
+ char sexpr[GNUNET_CRYPTO_ECC_SIGNATURE_DATA_ENCODING_LENGTH];
};
};
-/**
- * ECC Encrypted data.
- */
-struct GNUNET_CRYPTO_EccEncryptedData
-{
- /**
- * Overall size of the encrypted data.
- */
- uint16_t size;
-
- /**
- * S-expression, padded with zeros.
- */
- char encoding[GNUNET_CRYPTO_ECC_DATA_ENCODING_LENGTH];
-};
-
-
/**
* @brief type for session keys
*/
GNUNET_CRYPTO_ecc_setup_hostkey (const char *cfg_name);
-/**
- * Encrypt a block with the public key of another host that uses the
- * same cipher.
- *
- * @param block the block to encrypt
- * @param size the size of block
- * @param publicKey the encoded public key used to encrypt
- * @param target where to store the encrypted block
- * @returns GNUNET_SYSERR on error, GNUNET_OK if ok
- */
-int
-GNUNET_CRYPTO_ecc_encrypt (const void *block, size_t size,
- const struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded
- *publicKey,
- struct GNUNET_CRYPTO_EccEncryptedData *target);
-
-
-/**
- * Decrypt a given block with the hostkey.
- *
- * @param key the key with which to decrypt this block
- * @param block the data to decrypt, encoded as returned by encrypt
- * @param result pointer to a location where the result can be stored
- * @param max the maximum number of bits to store for the result, if
- * the decrypted block is bigger, an error is returned
- * @return the size of the decrypted block, -1 on error
- */
-ssize_t
-GNUNET_CRYPTO_ecc_decrypt (const struct GNUNET_CRYPTO_EccPrivateKey *key,
- const struct GNUNET_CRYPTO_EccEncryptedData *block,
- void *result, size_t max);
-
-
/**
* Sign a given block.
*