Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 1 | /* |
| 2 | * pkey.h |
| 3 | * |
Jean-Paul Calderone | 8671c85 | 2011-03-02 19:26:20 -0500 | [diff] [blame^] | 4 | * Copyright (C) AB Strakt |
| 5 | * Copyright (C) Jean-Paul Calderone |
| 6 | * See LICENSE for details. |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 7 | * |
| 8 | * Export pkey functions and data structure. |
| 9 | * See the file RATIONALE for a short explanation of why this module was written. |
| 10 | * |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 11 | */ |
| 12 | #ifndef PyOpenSSL_crypto_PKEY_H_ |
| 13 | #define PyOpenSSL_crypto_PKEY_H_ |
| 14 | |
| 15 | extern int init_crypto_pkey (PyObject *); |
| 16 | |
| 17 | extern PyTypeObject crypto_PKey_Type; |
| 18 | |
| 19 | #define crypto_PKey_Check(v) ((v)->ob_type == &crypto_PKey_Type) |
| 20 | |
| 21 | typedef struct { |
| 22 | PyObject_HEAD |
Jean-Paul Calderone | ac0d95f | 2008-03-10 00:00:42 -0400 | [diff] [blame] | 23 | |
| 24 | /* |
| 25 | * A pointer to the underlying OpenSSL structure. |
| 26 | */ |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 27 | EVP_PKEY *pkey; |
Jean-Paul Calderone | ac0d95f | 2008-03-10 00:00:42 -0400 | [diff] [blame] | 28 | |
| 29 | /* |
| 30 | * A flag indicating the underlying pkey object has no private parts (so it |
| 31 | * can't sign, for example). This is a bit of a temporary hack. |
| 32 | * Public-only should be represented as a different type. -exarkun |
| 33 | */ |
| 34 | int only_public; |
| 35 | |
| 36 | /* |
| 37 | * A flag indicating whether the underlying pkey object has no meaningful |
| 38 | * data in it whatsoever. This is a temporary hack. It should be |
| 39 | * impossible to create PKeys in an unusable state. -exarkun |
| 40 | */ |
| 41 | int initialized; |
| 42 | |
| 43 | /* |
| 44 | * A flag indicating whether pkey will be freed when this object is freed. |
| 45 | */ |
Jean-Paul Calderone | 897bc25 | 2008-02-18 20:50:23 -0500 | [diff] [blame] | 46 | int dealloc; |
| 47 | } crypto_PKeyObj; |
| 48 | |
| 49 | #define crypto_TYPE_RSA EVP_PKEY_RSA |
| 50 | #define crypto_TYPE_DSA EVP_PKEY_DSA |
| 51 | |
| 52 | #endif |