blob: 02276290bb1e0cd531582ccbc1ea26014de49b49 [file] [log] [blame]
Jean-Paul Calderone897bc252008-02-18 20:50:23 -05001/*
2 * pkey.h
3 *
4 * Copyright (C) AB Strakt 2001, All rights reserved
5 *
6 * Export pkey functions and data structure.
7 * See the file RATIONALE for a short explanation of why this module was written.
8 *
9 * @(#) $Id: pkey.h,v 1.5 2002/09/04 22:24:59 iko Exp $
10 */
11#ifndef PyOpenSSL_crypto_PKEY_H_
12#define PyOpenSSL_crypto_PKEY_H_
13
14extern int init_crypto_pkey (PyObject *);
15
16extern PyTypeObject crypto_PKey_Type;
17
18#define crypto_PKey_Check(v) ((v)->ob_type == &crypto_PKey_Type)
19
20typedef struct {
21 PyObject_HEAD
Jean-Paul Calderoneac0d95f2008-03-10 00:00:42 -040022
23 /*
24 * A pointer to the underlying OpenSSL structure.
25 */
Jean-Paul Calderone897bc252008-02-18 20:50:23 -050026 EVP_PKEY *pkey;
Jean-Paul Calderoneac0d95f2008-03-10 00:00:42 -040027
28 /*
29 * A flag indicating the underlying pkey object has no private parts (so it
30 * can't sign, for example). This is a bit of a temporary hack.
31 * Public-only should be represented as a different type. -exarkun
32 */
33 int only_public;
34
35 /*
36 * A flag indicating whether the underlying pkey object has no meaningful
37 * data in it whatsoever. This is a temporary hack. It should be
38 * impossible to create PKeys in an unusable state. -exarkun
39 */
40 int initialized;
41
42 /*
43 * A flag indicating whether pkey will be freed when this object is freed.
44 */
Jean-Paul Calderone897bc252008-02-18 20:50:23 -050045 int dealloc;
46} crypto_PKeyObj;
47
48#define crypto_TYPE_RSA EVP_PKEY_RSA
49#define crypto_TYPE_DSA EVP_PKEY_DSA
50
51#endif