blob: dc5e52ec3a9dc10f851dd748cef806fc4c17e01d [file] [log] [blame]
Jean-Paul Calderone897bc252008-02-18 20:50:23 -05001/*
2 * pkey.h
3 *
Jean-Paul Calderone8671c852011-03-02 19:26:20 -05004 * Copyright (C) AB Strakt
5 * Copyright (C) Jean-Paul Calderone
6 * See LICENSE for details.
Jean-Paul Calderone897bc252008-02-18 20:50:23 -05007 *
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 Calderone897bc252008-02-18 20:50:23 -050011 */
12#ifndef PyOpenSSL_crypto_PKEY_H_
13#define PyOpenSSL_crypto_PKEY_H_
14
15extern int init_crypto_pkey (PyObject *);
16
17extern PyTypeObject crypto_PKey_Type;
18
19#define crypto_PKey_Check(v) ((v)->ob_type == &crypto_PKey_Type)
20
21typedef struct {
22 PyObject_HEAD
Jean-Paul Calderoneac0d95f2008-03-10 00:00:42 -040023
24 /*
25 * A pointer to the underlying OpenSSL structure.
26 */
Jean-Paul Calderone897bc252008-02-18 20:50:23 -050027 EVP_PKEY *pkey;
Jean-Paul Calderoneac0d95f2008-03-10 00:00:42 -040028
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 Calderone897bc252008-02-18 20:50:23 -050046 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