diff options
| author | Miloslav Trmač <mitr@redhat.com> | 2010-11-30 22:05:18 +0100 |
|---|---|---|
| committer | Miloslav Trmač <mitr@redhat.com> | 2010-11-30 22:05:18 +0100 |
| commit | 24c1c8a9e044cc7fe1c5c9343c0cdaaf57da9aa6 (patch) | |
| tree | e57d3d908692475e7bc327d1bdedfffc5d657e2d /include | |
| parent | 642c97ec86ff47d83f2492e3969b05ef1cb86f03 (diff) | |
| parent | a2dd3a2b9045b5a787e0981bef2f378ab148ac1f (diff) | |
Merge branch 'local'
Diffstat (limited to 'include')
| -rw-r--r-- | include/ncrypto/ncrypto.h | 55 |
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, |
