summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/ncrypto/ncrypto.h55
1 files changed, 52 insertions, 3 deletions
diff --git a/include/ncrypto/ncrypto.h b/include/ncrypto/ncrypto.h
index d9508bf..ff20d8c 100644
--- a/include/ncrypto/ncrypto.h
+++ b/include/ncrypto/ncrypto.h
@@ -71,12 +71,14 @@ CK_RV ncr_symm_key_destroy (struct ncr_symm_key *key);
struct ncr_public_key;
struct ncr_private_key;
-CK_RV ncr_public_key_create (struct ncr_public_key **key, CK_KEY_TYPE type,
- const void *der, size_t der_size);
+/* The X.509v3 subjectPublicKeyInfo structure is used for public keys. */
+CK_RV ncr_public_key_create (struct ncr_public_key **key, const void *der,
+ size_t der_size);
CK_RV ncr_public_key_export (struct ncr_public_key *key, void *dest,
size_t *dest_size_ptr);
CK_RV ncr_public_key_destroy (struct ncr_public_key *key);
-/* "Sensitive" corresponds to CKA_SENSITIVE. */
+/* The PKCS#8 privateKeyInfo structure is used for private keys. "Sensitive"
+ corresponds to CKA_SENSITIVE. */
CK_RV ncr_private_key_create (struct ncr_private_key **key, CK_KEY_TYPE type,
_Bool sensitive, const void *der, size_t der_size,
const void *public_value,
@@ -136,6 +138,53 @@ CK_RV ncr_key_pair_generate_rsa (struct ncr_public_key **public_key,
CK_ULONG modulus_bits,
const struct ncr_mpi *public_exponent);
+ /* DSA keys */
+
+enum
+ {
+ NCR_DSA_PUBLIC_MPI_PRIME,
+ NCR_DSA_PUBLIC_MPI_SUBPRIME,
+ NCR_DSA_PUBLIC_MPI_BASE,
+ NCR_DSA_PUBLIC_MPI_VALUE,
+ NCR_DSA_PUBLIC_NUM_MPIS
+ };
+
+enum
+ {
+ NCR_DSA_PRIVATE_MPI_PRIME,
+ NCR_DSA_PRIVATE_MPI_SUBPRIME,
+ NCR_DSA_PRIVATE_MPI_BASE,
+ NCR_DSA_PRIVATE_MPI_VALUE,
+ NCR_DSA_PRIVATE_NUM_MPIS
+ };
+
+enum
+ {
+ NCR_DSA_GEN_MPI_PRIME,
+ NCR_DSA_GEN_MPI_SUBPRIME,
+ NCR_DSA_GEN_MPI_BASE,
+ NCR_DSA_GEN_NUM_MPIS
+ };
+
+CK_RV ncr_public_key_create_dsa (struct ncr_public_key **key,
+ const struct ncr_mpi
+ mpis[static NCR_DSA_PUBLIC_NUM_MPIS]);
+CK_RV ncr_public_key_export_dsa (struct ncr_public_key *key,
+ struct ncr_mpi
+ mpis [static NCR_DSA_PUBLIC_NUM_MPIS]);
+CK_RV ncr_private_key_create_dsa (struct ncr_private_key **key, _Bool sensitive,
+ const struct ncr_mpi
+ mpis[static NCR_DSA_PRIVATE_NUM_MPIS],
+ const struct ncr_mpi *public_value);
+CK_RV ncr_private_key_export_dsa (struct ncr_private_key *key,
+ struct ncr_mpi
+ mpis[static NCR_DSA_PRIVATE_NUM_MPIS]);
+CK_RV ncr_key_pair_generate_dsa (struct ncr_public_key **public_key,
+ struct ncr_private_key **private_key,
+ CK_MECHANISM_TYPE mech, _Bool sensitive,
+ const struct ncr_mpi
+ mpis[static NCR_DSA_GEN_NUM_MPIS]);
+
/* Asymmetric operations */
CK_RV ncr_public_key_encrypt (CK_MECHANISM_TYPE mech,