blob: 42fec331fb6ae7216302d9c358166caa8eca9b45 [file] [log] [blame]
Tang Cheng31b95252014-10-23 09:22:35 +08001/* DISABLE check_long_lines */
2
3/* Copyright (c) 1996, 2007, Oracle. All rights reserved. */
4/* Copyright (c) 1996, 2007, Oracle. All rights reserved. */
5
6/*
7 *
8 */
9
10/*
11 * NAME
12 * nzt.h
13 *
14 * DESCRIPTION
15 * Toolkit public declarations.
16 *
17 * PUBLIC FUNCTIONS
18 * nztwOpenWallet - Open a wallet based on a WRL and pwd.
19 * nztwCloseWallet - Close a wallet.
20 * + nztwCreateWallet - Create a new wallet.
21 * + nztwDestroyWallet - Destroy an existing wallet.
22 * nztwRetrievePersonaCopy - Retieve a copy of a particular persona.
23 * + nzteStorePersona - Store a persona in the wallet.
24 * nzteOpenPersona - Open a persona.
25 * nzteClosePersona - Close a persona.
26 * + nzteRemovePersona - Remove a persona from a wallet.
27 * + nzteCreatePersona - Create a persona.
28 * nzteDestroyPersona - Destroy a persona.
29 * nztiStoreTrustedIdentity - Store an identity with associated trust.
30 * nzteRetrieveTrustedIdentCopy - Retrieves a trusted identity from persona
31 * + nzteSetProtection - Modify the protection set in a persona.
32 * + nzteGetProtection - Get the protection set in a persona
33 * nztePriKey - Get the Private Key (X509 Only)
34 * nzteMyCert - Get the Certificate (X509 only)
35 * nzteX509CreatePersona - Create a persona given an X509 Certificate.
36 * + nztiRemoveIdentity - Remove an identity from a persona.
37 * nztiCreateIdentity - Create an identity.
38 * nztiDuplicateIdentity - Create a complete copy of an identity.
39 * nztiAbortIdentity - Discard an unstored identity.
40 * nztidGetIdentityDesc - Gets Identity Description from Identity.
41 * nztidFreeIdentityDesc - Frees memory for Identity Desc object.
42 * nztSign - Generate an attached signature.
43 * + nztxSignExpansion - Determine size of signature.
44 * nztVerify - Verify an attached signature.
45 * nztValidate - Validate an identity.
46 * nztsd_SignDetached - Generate a detached signature.
47 * + nztxsd_SignDetachedExpansion - Determine size of detached signature.
48 * nztved_VerifyDetached - Verify a detached signature.
49 * + nztEncrypt - Symmetric key encryption.
50 * + nztxEncryptExpansion - Determine the tdu length for encryption.
51 * + nztDecrypt - Symmetric key decryption.
52 * + nztEnvelope - Sign then encrypt data for recipient(s).
53 * + nztDeEnvelope - Reverse nztEnvelope.
54 * + nztKeyedHash - Generate keyed hash.
55 * + nztxKeyedHashExpansion - Determine size of TDU for keyed hash.
56 * nztHash - Generate hash.
57 * + nztxHashExpansion - Determine the size of the TDU for a hash.
58 * nztSeedRandom - See the random number generator.
59 * nztrb_RandomBytes - Generate a series of random bytes.
60 * nztrn_RandomNumber - Generate a random number.
61 * nztbbInitBlock - Initialize a buffer block.
62 * nztbbReuseBlock - Reuse a buffer block.
63 * nztbbSizeBlock - Find the size of the buffer block.
64 * nztbbGrowBlock - Grow initialized buffer block by 'inc' bytes.
65 * nztbbPurgeBlock - Purge the memory used within a buffer block.
66 * nztbbSetBlock - Set block to known state.
67 * nztkec_PKEncrypt - Encrypt data then encrypt key for recipient.
68 * nztkdc_PKDecrypt - Decrypt PKEncrypt'ed data.
69 * nztific_FreeIdentityContent - Free the contents of an identity.
70 * nztifdn - Create an identity from a distinguished name
71 * nztcts_CipherSpecToStr - Converts the Cipher Spec Code To String
72 * nztiae_IsAuthEnabled - Checks to see if Authentication is Enabled
73 * in the current Cipher Spec.
74 * nztiae_IsEncrEnabled - Checks to see if Encryption is Enabled
75 * in the current Cipher Spec.
76 * nztiae_IsHashEnabled - Checks to see if Hashing is Enabled
77 * in the current Cipher Spec.
78 * nztwGetCertInfo - Get peer certificate info
79 *
80 * NOTE: the '+' indicates that these functions are UNSUPPORTED at this time.
81 *
82 * NOTES
83 *
84 * MODIFIED
85 * shiahuan 11/28/07 -
86 * skalyana 08/15/07 -
87 * pkale 09/28/06 - Bug 5565668: Removed __STDC__
88 * tnallath 09/22/05 -
89 * rchahal 07/27/04 - add keyusage
90 * srtata 11/10/03 - fix nztSetAppDefaultLocation header
91 * rchahal 10/15/03 - bug 2513821
92 * rchahal 11/11/02 - pkcs11 support
93 * akoyfman 07/05/02 - adding secret store to persona
94 * supriya 10/11/01 - Fix for bug # 2015732
95 * ajacobs 04/04/01 - make NZT_REGISTRY_WRL always available
96 * ajacobs 03/06/01 - olint fix
97 * ajacobs 03/02/01 - Add GetCertInfo
98 * supriya 02/23/01 - Move nzttKPUsage from nzt0.h
99 * rchahal 01/26/01 - olint fixes
100 * supriya 12/07/00 - Change fn name
101 * supriya 12/01/00 - Certificate API's needed for iAS
102 * supriya 06/19/00 - Adding definitions for MCS and ENTR
103 * lkethana 05/31/00 - multiple cert support
104 * skanjila 06/25/99 - Remove nztcts_CipherSpecToStr() to NZOS.
105 * skanjila 06/23/99 - Change API of nztcts_CipherSpecToStr.
106 * lkethana 06/18/99 - rem nztIPrivateAlloc, etc
107 * lkethana 06/10/99 - changing size_t to ub4
108 * lkethana 06/02/99 - add api for getting auth/encry/hash capability of c
109 * arswamin 12/28/98 - add NZT_MAX_MD5.
110 * arswamin 12/21/98 - change signature of compareDN
111 * qdinh 12/21/98 - change size_t to ub4.
112 * inetwork 11/22/98 - Removing NZDEPRECATED definition
113 * amthakur 09/14/98 - deprecating and updating the c-structures.
114 * arswamin 09/24/98 - adding NZTTWRL_NULL for SSO support.
115 * amthakur 07/30/98 - changing the prototype of nztGetCertChain.
116 * qdinh 05/01/98 - add NZTTIDENTTYPE_INVALID_TYPE
117 * qdinh 04/17/98 - add NZTTWRL_ORACLE.
118 * ascott 10/08/97 - implement nztiStoreTrustedIdentity
119 * ascott 10/07/97 - add nztiGetIdentityDesc
120 * ascott 09/28/97 - clarify prototype comments and error codes
121 * ascott 09/05/97 - update identity: create, destroy, duplicate
122 * ascott 08/21/97 - add GetCert and GetPriKey
123 * ascott 08/07/97 - add other WRL settings
124 * asriniva 03/25/97 - Add ANSI prototypes
125 * rwessman 03/19/97 - Added prototypes for nztific_FreeIdentityContent()
126 * asriniva 03/11/97 - Fix olint errors
127 * sdange 02/28/97 - Removed inclusion of nz0decl.h
128 * sdange 02/18/97 - Moved nzt specific declarations from nz0decl.h
129 * asriniva 01/21/97 - Remove prototypes.
130 * asriniva 10/31/96 - Include oratypes.h
131 * asriniva 10/15/96 - Declare buffer block helper functions
132 * asriniva 10/08/96 - First pass at wallet open/close
133 * asriniva 10/04/96 - Add random number seed function
134 * asriniva 10/03/96 - Reorder parameters in nztbbSetBlock
135 * asriniva 10/03/96 - Keep editing.
136 * asriniva 10/03/96 - Continued edits.
137 * asriniva 10/02/96 - Continue editing.
138 * asriniva 09/26/96 -
139 */
140
141/* ENABLE check_long_lines */
142
143#ifndef NZT_ORACLE
144#define NZT_ORACLE
145
146#ifndef ORATYPES
147# include <oratypes.h>
148#endif /* ORATYPES */
149
150#ifndef NZERROR_ORACLE
151# include <nzerror.h> /* NZ error type */
152#endif /* NZERROR_ORACLE */
153
154
155#define NZT_MAX_SHA1 20
156#define NZT_MAX_MD5 16
157
158/***************************************/
159/* PUBLIC CONSTANTS, MACROS, AND TYPES */
160/***************************************/
161
162/*
163 * Wallet Resource Locator Type Strings
164 *
165 * WRL TYPE PARAMETERS BEHAVIOR
166 * ======== ========== =====================================
167 * default: <none> Uses directory defined by the parameter
168 * SNZD_DEFAULT_FILE_DIRECTORY which in
169 * unix is "$HOME/oracle/oss"
170 *
171 * file: file path Find the Oracle wallet in this directory.
172 * example: file:<dir-path>
173 *
174 * sqlnet: <none> In this case, the directory path will be
175 * retrieved from the sqlnet.ora file under
176 * the oss.source.my_wallet parameter.
177 *
178 * mcs: <none> Microsoft WRL.
179 *
180 * entr: dir path Entrust WRL. eg: ENTR:<dir-path>
181 *
182 */
183/* Note that there is no NZT_NULL_WRL. Instead look in snzd.h for DEFAULT_WRP
184 * which is used in our new defaulting mechanism. The NZT_DEFAULT_WRL
185 * should be deprecated.
186 */
187#define NZT_DEFAULT_WRL ((text *)"default:")
188#define NZT_SQLNET_WRL ((text *)"sqlnet:")
189#define NZT_FILE_WRL ((text *)"file:")
190#define NZT_ENTR_WRL ((text *)"entr:")
191#define NZT_MCS_WRL ((text *)"mcs:")
192#define NZT_ORACLE_WRL ((text *)"oracle:")
193#define NZT_REGISTRY_WRL ((text *)"reg:")
194
195enum nzttwrl
196{
197 NZTTWRL_DEFAULT = 1, /* Default, use SNZD_DEFAULT_FILE_DIRECTORY */
198 NZTTWRL_SQLNET, /* Use oss.source.my_wallet in sqlnet.ora file */
199 NZTTWRL_FILE, /* Find the oracle wallet in this directory */
200 NZTTWRL_ENTR, /* Find the entrust profile in this directory */
201 NZTTWRL_MCS, /* WRL for Microsoft */
202 NZTTWRL_ORACLE, /* Get the wallet from OSS db */
203 NZTTWRL_NULL, /* New SSO defaulting mechanism */
204 NZTTWRL_REGISTRY /* Find the wallet in Windows Registry */
205};
206typedef enum nzttwrl nzttwrl;
207
208#ifndef NZ0DECL_ORACLE
209 /*
210 * With the elimination of nz0decl.h from public, we need this
211 * redundant typedef.
212 */
213 typedef struct nzctx nzctx;
214 typedef struct nzstrc nzstrc;
215 typedef struct nzosContext nzosContext;
216#endif /* NZ0DECL_ORACLE */
217
218/* Moved from nz0decl.h */
219
220typedef struct nzttIdentity nzttIdentity;
221typedef struct nzttIdentityPrivate nzttIdentityPrivate;
222typedef struct nzttPersona nzttPersona;
223typedef struct nzttPersonaPrivate nzttPersonaPrivate;
224typedef struct nzttWallet nzttWallet;
225typedef struct nzttWalletPrivate nzttWalletPrivate;
226typedef struct nzttWalletObj nzttWalletObj; /* For wallet object */
227typedef struct nzssEntry nzssEntry; /* For secretstore */
228typedef struct nzpkcs11_Info nzpkcs11_Info;
229
230/*
231 * Crypto Engine State
232 *
233 * Once the crypto engine (CE) has been initialized for a particular
234 * cipher, it is either at the initial state, or it is continuing to
235 * use the cipher. NZTCES_END is used to change the state back to
236 * initialized and flush any remaining output. NZTTCES_RESET can be
237 * used to change the state back to initialized and throw away any
238 * remaining output.
239 */
240enum nzttces
241{
242 NZTTCES_CONTINUE = 1, /* Continue processing input */
243 NZTTCES_END, /* End processing input */
244 NZTTCES_RESET /* Reset processing and skip generating output */
245};
246typedef enum nzttces nzttces;
247
248/*
249 * Crypto Engine Functions
250 *
251 * List of crypto engine categories; used to index into protection
252 * vector.
253 */
254enum nzttcef
255{
256 NZTTCEF_DETACHEDSIGNATURE = 1, /* Signature, detached from content */
257 NZTTCEF_SIGNATURE, /* Signature combined with content */
258 NZTTCEF_ENVELOPING, /* Signature and encryption with content */
259 NZTTCEF_PKENCRYPTION, /* Encryption for one or more recipients */
260 NZTTCEF_ENCRYPTION, /* Symmetric encryption */
261 NZTTCEF_KEYEDHASH, /* Keyed hash/checkusm */
262 NZTTCEF_HASH, /* Hash/checsum */
263 NZTTCEF_RANDOM, /* Random byte generation */
264
265 NZTTCEF_LAST /* Used for array size */
266};
267typedef enum nzttcef nzttcef;
268
269/*
270 * State of the persona.
271 */
272enum nzttState
273{
274 NZTTSTATE_EMPTY = 0, /* is not in any state(senseless???) */
275 NZTTSTATE_REQUESTED, /* cert-request */
276 NZTTSTATE_READY, /* certificate */
277 NZTTSTATE_INVALID, /* certificate */
278 NZTTSTATE_RENEWAL /* renewal-requested */
279};
280typedef enum nzttState nzttState;
281
282/*
283 * Cert-version types
284 *
285 * This is used to quickly look-up the cert-type
286 */
287enum nzttVersion
288{
289 NZTTVERSION_X509v1 = 1, /* X.509v1 */
290 NZTTVERSION_X509v3, /* X.509v3 */
291#ifdef NZDEPRECATED
292 NZTTVERSION_SYMMETRIC, /* Symmetric */
293#endif
294 NZTTVERSION_INVALID_TYPE /* For Initialization */
295};
296typedef enum nzttVersion nzttVersion;
297
298/*
299 * Cipher Types
300 *
301 * List of all cryptographic algorithms, some of which may not be
302 * available.
303 */
304enum nzttCipherType
305{
306 NZTTCIPHERTYPE_RSA = 1, /* RSA public key */
307 NZTTCIPHERTYPE_DES, /* DES */
308 NZTTCIPHERTYPE_RC4, /* RC4 */
309 NZTTCIPHERTYPE_MD5DES, /* DES encrypted MD5 with salt (PBE) */
310 NZTTCIPHERTYPE_MD5RC2, /* RC2 encrypted MD5 with salt (PBE) */
311 NZTTCIPHERTYPE_MD5, /* MD5 */
312 NZTTCIPHERTYPE_SHA /* SHA */
313};
314typedef enum nzttCipherType nzttCipherType;
315
316/*
317 * TDU Formats
318 *
319 * List of possible toolkit data unit (TDU) formats. Depending on the
320 * function and cipher used some may be not be available.
321 */
322enum nztttdufmt
323{
324 NZTTTDUFMT_PKCS7 = 1, /* PKCS7 format */
325 NZTTTDUFMT_RSAPAD, /* RSA padded format */
326 NZTTTDUFMT_ORACLEv1, /* Oracle v1 format */
327 NZTTTDUFMT_LAST /* Used for array size */
328};
329typedef enum nztttdufmt nztttdufmt;
330
331/*
332 * Validate State
333 *
334 * Possible validation states an identity can be in.
335 */
336enum nzttValState
337{
338 NZTTVALSTATE_NONE = 1, /* Needs to be validated */
339 NZTTVALSTATE_GOOD, /* Validated */
340 NZTTVALSTATE_REVOKED /* Failed to validate */
341};
342typedef enum nzttValState nzttValState;
343
344/*
345 * Policy Fields <----NEW (09/14/98)
346 *
347 * Policies enforced
348 */
349enum nzttPolicy
350{
351 NZTTPOLICY_NONE = 0,
352 NZTTPOLICY_RETRY_1, /* number of retries for decryption = 1 */
353 NZTTPOLICY_RETRY_2, /* number of retries for decryption = 2 */
354 NZTTPOLICY_RETRY_3 /* number of retries for decryption = 3 */
355};
356typedef enum nzttPolicy nzttPolicy;
357
358/*
359 * Persona Usage <----NEW (09/14/98)
360 *
361 * what a persona will be used for?
362 */
363
364#ifdef NZDEPRECATED_MULTIPLECERTS
365enum nzttUsage
366{
367 NZTTUSAGE_NONE = 0,
368 NZTTUSAGE_SSL /* persona for SSL usage */
369};
370typedef enum nzttUsage nzttUsage;
371#endif
372
373/*
374 * Personas and identities have unique id's that are represented with
375 * 128 bits.
376 */
377typedef ub1 nzttID[16];
378
379/*
380 * Identity Types
381 *
382 * List of all Identity types..
383 */
384enum nzttIdentType
385{
386 NZTTIDENTITYTYPE_INVALID_TYPE = 0,
387 NZTTIDENTITYTYPE_CERTIFICTAE,
388 NZTTIDENTITYTYPE_CERT_REQ,
389 NZTTIDENTITYTYPE_RENEW_CERT_REQ,
390 NZTTIDENTITYTYPE_CLEAR_ETP,
391 NZTTIDENTITYTYPE_CLEAR_UTP,
392 NZTTIDENTITYTYPE_CLEAR_PTP
393};
394typedef enum nzttIdentType nzttIdentType;
395
396typedef ub4 nzttKPUsage;
397/* IF new types are added nztiMUS should be changed */
398#define NZTTKPUSAGE_NONE 0
399#define NZTTKPUSAGE_SSL 1 /* SSL Server */
400#define NZTTKPUSAGE_SMIME_ENCR 2
401#define NZTTKPUSAGE_SMIME_SIGN 4
402#define NZTTKPUSAGE_CODE_SIGN 8
403#define NZTTKPUSAGE_CERT_SIGN 16
404#define NZTTKPUSAGE_SSL_CLIENT 32 /* SSL Client */
405#define NZTTKPUSAGE_INVALID_USE 0xffff
406
407
408/*
409 * Timestamp as 32 bit quantity in UTC.
410 */
411typedef ub1 nzttTStamp[4];
412
413/*
414 * Buffer Block
415 *
416 * A function that needs to fill (and possibly grow) an output buffer
417 * uses an output parameter block to describe each buffer.
418 *
419 * The flags_nzttBufferBlock member tells the function whether the
420 * buffer can be grown or not. If flags_nzttBufferBlock is 0, then
421 * the buffer will be realloc'ed automatically.
422 *
423 * The buflen_nzttBufferBLock member is set to the length of the
424 * buffer before the function is called and will be the length of the
425 * buffer when the function is finished. If buflen_nzttBufferBlock is
426 * 0, then the initial pointer stored in pobj_nzttBufferBlock is
427 * ignored.
428 *
429 * The objlen_nzttBufferBlock member is set to the length of the
430 * object stored in the buffer when the function is finished. If the
431 * initial buffer had a non-0 length, then it is possible that the
432 * object length is shorter than the buffer length.
433 *
434 * The pobj_nzttBufferBlock member is a pointer to the output object.
435 */
436struct nzttBufferBlock
437{
438# define NZT_NO_AUTO_REALLOC 0x1
439
440 uword flags_nzttBufferBlock; /* Flags */
441 ub4 buflen_nzttBufferBlock; /* Total length of buffer */
442 ub4 usedlen_nzttBufferBlock; /* Length of used buffer part */
443 ub1 *buffer_nzttBufferBlock; /* Pointer to buffer */
444};
445typedef struct nzttBufferBlock nzttBufferBlock;
446
447/*
448 * Wallet.
449 */
450struct nzttWallet
451{
452 ub1 *ldapName_nzttWallet; /* user's LDAP Name */
453 ub4 ldapNamelen_nzttWallet; /* len of user's LDAP Name */
454 nzttPolicy securePolicy_nzttWallet; /* secured-policy of the wallet */
455 nzttPolicy openPolicy_nzttWallet; /* open-policy of the wallet */
456 nzttPersona *persona_nzttWallet; /* List of personas in wallet */
457 nzttWalletPrivate *private_nzttWallet; /* Private wallet information */
458#ifdef NZDEPRECATED
459 ub4 npersona_nzttWallet; /* Number of personas */
460#endif
461};
462
463/*
464 * The wallet contains, one or more personas. A persona always
465 * contains its private key and its identity. It may also contain
466 * other 3rd party identites. All identities qualified with trust
467 * where the qualifier can indicate anything from untrusted to trusted
468 * for specific operations.
469 */
470
471/*
472 * Persona
473 *
474 * Structure containing information about a persona.
475 */
476struct nzttPersona
477{
478 ub1 *genericName_nzttPersona; /* user-friendly persona name */
479 ub4 genericNamelen_nzttPersona; /* persona-name length */
480 nzttPersonaPrivate *private_nzttPersona; /* Opaque part of persona */
481 nzttIdentity *mycertreqs_nzttPersona; /* My cert-requests */
482 nzttIdentity *mycerts_nzttPersona; /* My certificates */
483 nzttIdentity *mytps_nzttPersona; /* List of trusted identities */
484 nzssEntry *mystore_nzttPersona; /* List of secrets */
485 nzpkcs11_Info *mypkcs11Info_nzttPersona; /* PKCS11 token info */
486 struct nzttPersona *next_nzttPersona; /* Next persona */
487#ifdef NZDEPRECATED_MULTIPLECERTS
488 /* As Persona has multiple certs for different
489 usages, Persona Usage does not mean anything. Similarly
490 each key pair has its own state and Persona state itself
491 does not mean anything. - lk 5/31/00
492 */
493 nzttUsage usage_nzttPersona; /* persona usage; SSL/SET/.. */
494 nzttState state_nzttPersona; /* persona state-requested/ready */
495 ub4 ntps_nzttPersona; /* Num of trusted identities */
496#endif
497};
498
499/*
500 * Identity
501 *
502 * Structure containing information about an identity.
503 *
504 * NOTE
505 * -- the next_trustpoint field only applies to trusted identities and
506 * has no meaning (i.e. is NULL) for self identities.
507 */
508struct nzttIdentity
509{
510 text *dn_nzttIdentity; /* Alias */
511 ub4 dnlen_nzttIdentity; /* Length of alias */
512 text *comment_nzttIdentity; /* Comment */
513 ub4 commentlen_nzttIdentity; /* Length of comment */
514 nzttIdentityPrivate *private_nzttIdentity; /* Opaque part of identity */
515 nzttIdentity *next_nzttIdentity; /* next identity in list */
516};
517
518struct nzttB64Cert
519{
520 ub1 *b64Cert_nzttB64Cert;
521 ub4 b64Certlen_nzttB64Cert;
522 struct nzttB64Cert *next_nzttB64Cert;
523};
524typedef struct nzttB64Cert nzttB64Cert;
525
526
527struct nzttPKCS7ProtInfo
528{
529 nzttCipherType mictype_nzttPKCS7ProtInfo; /* Hash cipher */
530 nzttCipherType symmtype_nzttPKCS7ProtInfo; /* Symmetric cipher */
531 ub4 keylen_nzttPKCS7ProtInfo; /* Length of key to use */
532};
533typedef struct nzttPKCS7ProtInfo nzttPKCS7ProtInfo;
534
535/*
536 * Protection Information.
537 *
538 * Information specific to a type of protection.
539 */
540union nzttProtInfo
541{
542 nzttPKCS7ProtInfo pkcs7_nzttProtInfo;
543};
544typedef union nzttProtInfo nzttProtInfo;
545
546/*
547 * A description of a persona so that the toolkit can create one. A
548 * persona can be symmetric or asymmetric and both contain an
549 * identity. The identity for an asymmetric persona will be the
550 * certificate and the identity for the symmetric persona will be
551 * descriptive information about the persona. In either case, an
552 * identity will have been created before the persona is created.
553 *
554 * A persona can be stored separately from the wallet that references
555 * it. By default, a persona is stored with the wallet (it inherits
556 * with WRL used to open the wallet). If a WRL is specified, then it
557 * is used to store the actuall persona and the wallet will have a
558 * reference to it.
559 */
560struct nzttPersonaDesc
561{
562 ub4 privlen_nzttPersonaDesc; /* Length of private info (key)*/
563 ub1 *priv_nzttPersonaDesc; /* Private information */
564 ub4 prllen_nzttPersonaDesc; /* Length of PRL */
565 text *prl_nzttPersonaDesc; /* PRL for storage */
566 ub4 aliaslen_nzttPersonaDesc; /* Length of alias */
567 text *alias_nzttPersonaDesc; /* Alias */
568 ub4 longlen_nzttPersonaDesc; /* Length of longer description*/
569 text *long_nzttPersonaDesc; /* Longer persona description */
570};
571typedef struct nzttPersonaDesc nzttPersonaDesc;
572
573/*
574 * A description of an identity so that the toolkit can create one.
575 * Since an identity can be symmetric or asymmetric, the asymmetric
576 * identity information will not be used when a symmetric identity is
577 * created. This means the publen_nzttIdentityDesc and
578 * pub_nzttIdentityDesc members will not be used when creating a
579 * symmetric identity.
580 */
581struct nzttIdentityDesc
582{
583 ub4 publen_nzttIdentityDesc; /* Length of identity */
584 ub1 *pub_nzttIdentityDesc; /* Type specific identity */
585 ub4 dnlen_nzttIdentityDesc; /* Length of alias */
586 text *dn_nzttIdentityDesc; /* Alias */
587 ub4 longlen_nzttIdentityDesc; /* Length of longer description */
588 text *long_nzttIdentityDesc; /* Longer description */
589 ub4 quallen_nzttIdentityDesc; /* Length of trust qualifier */
590 text *trustqual_nzttIdentityDesc; /* Trust qualifier */
591};
592typedef struct nzttIdentityDesc nzttIdentityDesc;
593
594/********************************/
595/* PUBLIC FUNCTION DECLARATIONS */
596/********************************/
597
598/*---------------------- nztwOpenWallet ----------------------*/
599
600/*
601 * NAME
602 * nztwOpenWallet - Open a wallet based on a wallet Resource Locator (WRL).
603 *
604 * PARAMETERS
605 * osscntxt {IN} OSS context.
606 * wrllen {IN} Length of WRL.
607 * wrl {IN} WRL.
608 * pwdlen {IN} Length of password.
609 * pwd {IN} Password.
610 * wallet {IN/OUT} Initialized wallet structure.
611 *
612 * NOTES
613 * The syntax for a WRL is <Wallet Type>:<Wallet Type Parameters>.
614 *
615 * Wallet Type Wallet Type Parameters.
616 * ----------- ----------------------
617 * File Pathname (e.g. "file:/home/asriniva")
618 * Oracle Connect string (e.g. "oracle:scott/tiger@oss")
619 *
620 * There are also defaults. If the WRL is NZT_DEFAULT_WRL, then
621 * the platform specific WRL default is used. If only the wallet
622 * type is specified, then the WRL type specific default is used
623 * (e.g. "oracle:")
624 *
625 * There is an implication with Oracle that should be stated: An
626 * Oracle based wallet can be implemented in a user's private space
627 * or in world readable space.
628 *
629 * When the wallet is opened, the password is verified by hashing
630 * it and comparing against the password hash stored with the
631 * wallet. The list of personas (and their associated identities)
632 * is built and stored into the wallet structure.
633 *
634 * RETURNS
635 * NZERROR_OK Success.
636 * NZERROR_RIO_OPEN RIO could not open wallet (see network trace file).
637 * NZERROR_TK_PASSWORD Password verification failed.
638 * NZERROR_TK_WRLTYPE WRL type is not known.
639 * NZERROR_TK_WRLPARM WRL parm does not match type.
640 */
641nzerror nztwOpenWallet( nzctx *, ub4, text *, ub4, text *,
642 nzttWallet * );
643
644
645/*---------------------- nztwCloseWallet ----------------------*/
646
647/*
648 * NAME
649 * nztwCloseWallet - Close a wallet
650 *
651 * PARAMETERS
652 * osscntxt {IN} OSS context.
653 * wallet {IN/OUT} Wallet.
654 *
655 * NOTES
656 * Closing a wallet also closes all personas associated with that
657 * wallet. It does not cause a persona to automatically be saved
658 * if it has changed. The implication is that a persona can be
659 * modified by an application but if it is not explicitly saved it
660 * reverts back to what was in the wallet.
661 *
662 * RETURNS
663 * NZERROR_OK Success.
664 * NZERROR_RIO_CLOSE RIO could not close wallet (see network trace file).
665 */
666nzerror nztwCloseWallet( nzctx *, nzttWallet * );
667
668/*--------------------nztwGetCertInfo----------------------------*/
669/****NOTE: This function is a temporary hack.****/
670/****DO NOT CALL. It will soon disappear.****/
671nzerror nztwGetCertInfo( nzctx *nz_context,
672 nzosContext *nzosCtx,
673 nzttWallet *walletRef,
674 void *peerCert );
675
676
677/*------------------------ nztwConstructWallet -----------------------*/
678/*
679 *
680 * nzerror nztwConstructWallet( nzctx *oss_context,
681 * nzttPolicy openPolicy,
682 * nzttPolicy securePolicy,
683 * ub1 *ldapName,
684 * ub4 ldapNamelen,
685 * nzstrc *wrl,
686 * nzttPersona *personas,
687 * nzttWallet **wallet );
688 */
689
690/*---------------------- nztwRetrievePersonaCopy ----------------------*/
691
692/*
693 * NAME
694 * nztwRetrievePersonaCopy - Retrieves a persona based from wallet
695 *
696 * PARAMETERS
697 * osscntxt {IN} OSS context.
698 * wallet {IN} Wallet.
699 * index {IN} Which wallet index to remove (first persona is zero).
700 * persona {OUT} Persona found.
701 *
702 * NOTES
703 * Retrieves a persona from the wallet based on the index number passed
704 * in. This persona is a COPY of the one stored in the wallet, therefore
705 * it is perfectly fine for the wallet to be closed after this call is
706 * made.
707 *
708 * The caller is responsible for disposing of the persona when completed.
709 *
710 * RETURNS
711 * NZERROR_OK Success.
712 */
713nzerror nztwRetrievePersonaCopy( nzctx *, nzttWallet *, ub4,
714 nzttPersona ** );
715
716
717/*---------------------- nztwRetrievePersonaCopyByName ----------------------*/
718
719/*
720 * NAME
721 * nztwRetrievePersonaCopyByName - Retrieves a persona based on its name.
722 *
723 * PARAMETERS
724 * osscntxt {IN} OSS context.
725 * wallet {IN} Wallet.
726 * name {IN} Name of the persona
727 * persona {OUT} Persona found.
728 *
729 * NOTES
730 * Retrieves a persona from the wallet based on the name of the persona.
731 * This persona is a COPY of the one stored in the wallet, therefore
732 * it is perfectly fine for the wallet to be closed after this call is
733 * made.
734 *
735 * The caller is responsible for disposing of the persona when completed.
736 *
737 * RETURNS
738 * NZERROR_OK Success.
739 */
740nzerror nztwRetrievePersonaCopyByName( nzctx *, nzttWallet *, char *,
741 nzttPersona ** );
742
743/*---------------------- nzteOpenPersona ----------------------*/
744
745/*
746 * NAME
747 * nzteOpenPersona - Open a persona.
748 *
749 * PARAMETERS
750 * osscntxt {IN} OSS context.
751 * persona {IN/OUT} Persona.
752 *
753 * NOTES
754 *
755 * RETURNS
756 * NZERROR_OK Success.
757 * NZERROR_TK_PASSWORD Password failed to decrypt persona.
758 * NZERROR_TK_BADPRL Persona resource locator did not work.
759 * NZERROR_RIO_OPEN Could not open persona (see network trace file).
760 */
761nzerror nzteOpenPersona( nzctx *, nzttPersona * );
762
763/*--------------------- nzteClosePersona ---------------------*/
764
765/*
766 * NAME
767 * nzteClosePersona - Close a persona.
768 *
769 * PARAMETERS
770 * osscntxt {IN} OSS context.
771 * persona {IN/OUT} Persona.
772 *
773 * NOTES
774 * Closing a persona does not store the persona, it simply releases
775 * the memory associated with the crypto engine.
776 *
777 * RETURNS
778 * NZERROR_OK Success.
779 */
780nzerror nzteClosePersona( nzctx *, nzttPersona * );
781
782/*--------------------- nzteDestroyPersona ---------------------*/
783
784/*
785 * NAME
786 * nzteDestroyPersona - Destroy a persona.
787 *
788 * PARAMETERS
789 * osscntxt {IN} OSS context.
790 * persona {IN/OUT} Persona.
791 *
792 * NOTES
793 * The persona is destroyd in the open state, but it will
794 * not be associated with a wallet.
795 *
796 * The persona parameter is doubly indirect so that at the
797 * conclusion of the function, the pointer can be set to NULL.
798 *
799 *
800 * RETURNS
801 * NZERROR_OK Success.
802 * NZERROR_TK_TYPE Unsupported itype/ctype combination.
803 * NZERROR_TK_PARMS Error in persona description.
804 */
805nzerror nzteDestroyPersona( nzctx *, nzttPersona ** );
806
807/*---------------------- nzteRetrieveTrustedIdentCopy ----------------------*/
808
809/*
810 * NAME
811 * nzteRetrieveTrustedIdentCopy - Retrieves a trusted identity from persona
812 *
813 * PARAMETERS
814 * osscntxt {IN} OSS context.
815 * persona {IN} Persona.
816 * index {IN} Which wallet index to remove (first element is zero).
817 * identity {OUT} Trusted Identity from this persona.
818 *
819 * NOTES
820 * Retrieves a trusted identity from the persona based on the index
821 * number passed in. This identity is a COPY of the one stored in
822 * the persona, therefore it is perfectly fine to close the persona
823 * after this call is made.
824 *
825 * The caller is responsible for freeing the memory of this object
826 * by calling nztiAbortIdentity it is no longer needed
827 *
828 * RETURNS
829 * NZERROR_OK Success.
830 */
831nzerror nzteRetrieveTrustedIdentCopy( nzctx *, nzttPersona *, ub4,
832 nzttIdentity ** );
833
834/*--------------------- nztePriKey ---------------------*/
835
836/*
837 * NAME
838 * nztePriKey - Get the decrypted Private Key for the Persona
839 *
840 * PARAMETERS
841 * osscntxt {IN} OSS context.
842 * persona {IN} Persona.
843 * vkey {OUT} Private Key [B_KEY_OBJ]
844 * vkey_len {OUT} Private Key Length
845 *
846 * NOTES
847 * This funiction will only work for X.509 based persona which contain
848 * a private key.
849 * A copy of the private key is returned to the caller so that they do not
850 * have to worry about the key changeing "underneath them".
851 * Memory will be allocated for the vkey and therefore, the CALLER
852 * will be responsible for freeing this memory.
853 *
854 * RETURNS
855 * NZERROR_OK Success.
856 * NZERROR_NO_MEMORY ossctx is null.
857 * NZERROR_TK_BADPRL Persona resource locator did not work.
858 */
859nzerror nztePriKey( nzctx *, nzttPersona *, ub1 **, ub4 * );
860
861/*--------------------- nzteMyCert ---------------------*/
862
863/*
864 * NAME
865 * nzteMyCert - Get the X.509 Certificate for a persona
866 *
867 * PARAMETERS
868 * osscntxt {IN} OSS context.
869 * persona {IN} Persona.
870 * cert {OUT} X.509 Certificate [BER encoded]
871 * cert_len {OUT} Certificate length
872 *
873 * NOTES
874 * This funiction will only work for X.509 based persona which contain
875 * a certificate for the self identity.
876 * A copy of the certificate is returned to the caller so that they do not
877 * have to worry about the certificate changeing "underneath them".
878 * Memory will be allocated for the cert and therefore, the CALLER
879 * will be responsible for freeing this memory.
880 *
881 * RETURNS
882 * NZERROR_OK Success.
883 * NZERROR_NO_MEMORY ossctx is null.
884 */
885nzerror nzteMyCert( nzctx *, nzttPersona *, ub1 **, ub4 * );
886
887/*--------------------- nzteX509CreatePersona ---------------------*/
888
889/*
890 * NAME
891 * nzteX509CreatePersona - Given a BER X.509 cert, create a persona
892 *
893 * PARAMETERS
894 * osscntxt {IN} OSS context.
895 * cert {IN} X.509 Certificate [BER encoded]
896 * cert_len {IN} Certificate length
897 * persona {OUT} Persona.
898 *
899 * NOTES
900 * Memory will be allocated for the persona and therefore, the CALLER
901 * will be responsible for freeing this memory.
902 *
903 * RETURNS
904 * NZERROR_OK Success.
905 * NZERROR_NO_MEMORY ossctx is null.
906 */
907nzerror nzteX509CreatePersona( nzctx *, ub1 *, ub4, nzttPersona ** );
908
909/*-------------------- nztiCreateIdentity --------------------*/
910
911/*
912 * NAME
913 * nztiCreateIdentity - Create an identity.
914 *
915 * PARAMETERS
916 * osscntxt {IN} OSS context.
917 * itype {IN} Identity type.
918 * desc {IN} Description of identity.
919 * identity {IN/OUT} Identity.
920 *
921 * NOTES
922 * Memory is only allocated for the identity structure. The elements in
923 * the description struct are not copied. Rather their pointers are copied
924 * into the identity structure. Therefore, the caller should not free
925 * the elements referenced by the desc. These elements will be freed
926 * when the nztiDestroyIdentity is called.
927 *
928 * RETURNS
929 * NZERROR_OK Success.
930 * NZERROR_PARMS Error in description.
931 */
932nzerror nztiCreateIdentity( nzctx *, nzttVersion, nzttIdentityDesc *,
933 nzttIdentity ** );
934
935#ifdef NZ_OLD_TOOLS
936/*-------------------- nztiDuplicateIdentity --------------------*/
937
938/*
939 * NAME
940 * nztiDuplicateIdentity - Duplicate an identity.
941 *
942 * PARAMETERS
943 * osscntxt {IN} OSS context.
944 * identity {IN} Target Identity.
945 * new_identity {IN} New Identity.
946 *
947 * NOTES
948 * Memory for the identity is allocated inside the function, and all
949 * internal identity elements as well.
950 *
951 * RETURNS
952 * NZERROR_OK Success.
953 * NZERROR_TK_NOTFOUND Identity not found.
954 * NZERROR_PARMS Error in description.
955 */
956nzerror nztiDuplicateIdentity( nzctx *, nzttIdentity *,
957 nzttIdentity ** );
958#endif /* NZ_OLD_TOOLS */
959
960/*--------------------- nztiAbortIdentity ---------------------*/
961
962/*
963 * NAME
964 * nztiAbortIdentity - Abort an unassociated identity.
965 *
966 * PARAMETERS
967 * osscntxt {IN} OSS context.
968 * identity {IN/OUT} Identity.
969 *
970 * NOTES
971 * It is an error to try to abort an identity that can be
972 * referenced through a persona.
973 *
974 * The identity pointer is set to NULL at the conclusion.
975 *
976 * RETURNS
977 * NZERROR_OK Success.
978 * NZERROR_CANTABORT Identity is associated with persona.
979 */
980nzerror nztiAbortIdentity( nzctx *, nzttIdentity ** );
981
982#ifdef NZ_OLD_TOOLS
983/*----------------- nztidGetIdentityDesc -----------------*/
984
985/*
986 * NAME
987 * nztidGetIdentityDesc - Gets an Identity Description from the identity
988 *
989 * PARAMETERS
990 * osscntxt {IN} Success.
991 * identity {IN} Identity.
992 * description {IN/OUT} Identity Description.
993 *
994 * NOTES
995 * Memory is allocated for the Identity Description. It
996 * is the callers responsibility to free this memory by calling
997 * nztiFreeIdentityDesc.
998 *
999 * RETURNS
1000 * NZERROR_OK Success.
1001 */
1002nzerror nztidGetIdentityDesc( nzctx *, nzttIdentity *,
1003 nzttIdentityDesc ** );
1004
1005/*----------------- nztidFreeIdentityDesc -----------------*/
1006
1007/*
1008 * NAME
1009 * nztidFreeIdentityDesc - Frees memory for Identity Desc object.
1010 *
1011 * PARAMETERS
1012 * osscntxt {IN} oss context.
1013 * description {IN/OUT} Identity Description.
1014 *
1015 * NOTES
1016 * Memory is freed for all Identity description elements. Pointer is
1017 * then set to null.
1018 *
1019 * RETURNS
1020 * NZERROR_OK Success.
1021 */
1022nzerror nztidFreeIdentityDesc( nzctx *, nzttIdentityDesc ** );
1023#endif /* NZ_OLD_TOOLS */
1024
1025/*---------------- nztific_FreeIdentityContent ----------------*/
1026
1027/*
1028 * NAME
1029 * nztific_FreeIdentityContent - free the contents of an identity.
1030 *
1031 * PARAMETERS
1032 * osscntxt {IN} OSS context.
1033 * identity {IN/OUT} freed identity
1034 *
1035 * NOTES
1036 * Free a created identity.
1037 *
1038 * RETURNS
1039 * NZERROR_OK Success.
1040 */
1041/*
1042 * Free the identity content.
1043 */
1044nzerror nztific_FreeIdentityContent( nzctx *ossctx,
1045 nzttIdentity *identity );
1046
1047
1048/*-------------------------- nztSign --------------------------*/
1049
1050/*
1051 * NAME
1052 * nztSign - Create an attached signature.
1053 *
1054 * PARAMETERS
1055 * osscntxt {IN} OSS context.
1056 * persona {IN} Open persona acting as signer.
1057 * state {IN} State of signature.
1058 * inlen {IN} Length of this input part.
1059 * in {IN} This input part.
1060 * tdubuf {IN/OUT} TDU buffer.
1061 *
1062 * NOTES
1063 *
1064 * RETURNS
1065 * NZERROR_OK Success.
1066 * NZERROR_TK_CANTGROW Needed to grow output buffer but could not.
1067 * NZERROR_TK_NOTOPEN Persona is not open.
1068 * NZERROR_TK_NOTSUPP Function not supported with persona.
1069 */
1070nzerror nztSign( nzctx *, nzttPersona *, nzttces, ub4, ub1 *,
1071 nzttBufferBlock * );
1072
1073/*------------------------- nztVerify -------------------------*/
1074
1075/*
1076 * NAME
1077 * nztVerify - Verify an attached signature.
1078 *
1079 * PARAMETERS
1080 * osscntxt {IN} OSS context.
1081 * persona {IN} Persona.
1082 * state {IN} State of verification.
1083 * intdulen {IN} TDU length.
1084 * intdu {IN} TDU.
1085 * out {IN/OUT} Extracted message.
1086 * verified {OUT} TRUE if signature verified.
1087 * validated{OUT} TRUE if signing identity validated.
1088 * identity {OUT} Identity of signing party.
1089 *
1090 * NOTES
1091 *
1092 * RETURNS
1093 * NZERROR_OK Success.
1094 * NZERROR_TK_CANTGROW Needed to grow outptu buffer but could not.
1095 * NZERROR_TK_NOTOPEN Persona is not open.
1096 * NZERROR_TK_NOTSUPP Function not supported with persona.
1097 */
1098nzerror nztVerify( nzctx *, nzttPersona *, nzttces, ub4, ub1 *,
1099 nzttBufferBlock *, boolean *, boolean *,
1100 nzttIdentity ** );
1101
1102/*------------------------ nztValidate ------------------------*/
1103
1104/*
1105 * NAME
1106 * nztValidate - Validate an identity.
1107 *
1108 * PARAMETERS
1109 * osscntxt {IN} OSS context.
1110 * persona {IN} Persona.
1111 * identity {IN} Identity.
1112 * validated{OUT} TRUE if identity was validated.
1113 *
1114 * NOTES
1115 *
1116 * RETURNS
1117 * NZERROR_OK Success.
1118 * NZERROR_TK_NOTOPEN Persona is not open.
1119 * NZERROR_TK_NOTSUPP Function not supported with persona.
1120 */
1121nzerror nztValidate( nzctx *, nzttPersona *, nzttIdentity *, boolean * );
1122
1123/*-------------------- nztsd_SignDetached --------------------*/
1124
1125/*
1126 * NAME
1127 * nztsd_SignDetached - Generate a detached signature.
1128 *
1129 * PARAMETERS
1130 * osscntxt {IN} OSS context.
1131 * persona {IN} Persona.
1132 * state {IN} State of signature.
1133 * inlen {IN} Length of this input part.
1134 * in {IN} This input part.
1135 * tdubuf {IN/OUT} TDU buffer.
1136 *
1137 * NOTES
1138 *
1139 * RETURNS
1140 * NZERROR_OK Success.
1141 * NZERROR_TK_CANTGROW Needed to grow output buffer but could not.
1142 * NZERROR_TK_NOTOPEN Persona is not open.
1143 * NZERROR_TK_NOTSUPP Function not supported with persona.
1144 */
1145nzerror nztsd_SignDetached( nzctx *, nzttPersona *, nzttces, ub4, ub1 *,
1146 nzttBufferBlock * );
1147
1148/*------------------- nztved_VerifyDetached -------------------*/
1149
1150/*
1151 * NAME
1152 * nztved_VerifyDetached - Verify a detached signature.
1153 *
1154 * PARAMETERS
1155 * osscntxt {IN} OSS context.
1156 * persona {IN} Persona.
1157 * state {IN} State of verification.
1158 * inlen {IN} Length of data.
1159 * in {IN} Data.
1160 * intdulen {IN} Input TDU length.
1161 * tdu {IN} Input TDU.
1162 * verified {OUT} TRUE if signature verified.
1163 * validated{OUT} TRUE if signing identity validated.
1164 * identity {OUT} Identity of signing party.
1165 *
1166 * NOTES
1167 *
1168 * RETURNS
1169 * NZERROR_OK Success.
1170 * NZERROR_TK_NOTOPEN Persona is not open.
1171 * NZERROR_TK_NOTSUPP Function not supported with persona.
1172 */
1173nzerror nztved_VerifyDetached( nzctx *, nzttPersona *, nzttces, ub4,
1174 ub1 *, ub4, ub1 *, boolean *, boolean *,
1175 nzttIdentity ** );
1176
1177/*--------------------- nztkec_PKEncrypt ---------------------*/
1178
1179/*
1180 * NAME
1181 * nztkec_PKEncrypt - Encrypt data symmetrically, encrypt key asymmetrically
1182 *
1183 * PARAMETERS
1184 * osscntxt {IN} OSS context.
1185 * persona {IN} Persona.
1186 * nrecipients {IN} Number of recipients for this encryption.
1187 * recipients {IN} List of recipients.
1188 * state {IN} State of encryption.
1189 * inlen {IN} Length of this input part.
1190 * in {IN} This input part.
1191 * tdubuf {IN/OUT} TDU buffer.
1192 *
1193 * NOTES
1194 * There is a limitation of 1 recipient (nrecipients = 1) at this
1195 * time.
1196 *
1197 * RETURNS
1198 * NZERROR_OK Success.
1199 * NZERROR_TK_CANTGROW Needed to grow output buffer but could not.
1200 * NZERROR_TK_NOTOPEN Persona is not open.
1201 * NZERROR_TK_NOTSUPP Function not supported with persona.
1202 */
1203nzerror nztkec_PKEncrypt( nzctx *, nzttPersona *, ub4, nzttIdentity *,
1204 nzttces, ub4, ub1 *, nzttBufferBlock * );
1205
1206/*---------------- nztxkec_PKEncryptExpansion ----------------*/
1207
1208/*
1209 * NAME
1210 * nztxkec_PKEncryptExpansion - Determine the buffer needed for PKEncrypt
1211 *
1212 * PARAMETERS
1213 * osscntxt {IN} OSS context.
1214 * persona {IN} Persona.
1215 * nrecipients {IN} Number of recipients.
1216 * inlen {IN} Length of input.
1217 * tdulen {out} Length of buffer need.
1218 *
1219 * NOTES
1220 *
1221 * RETURNS
1222 * NZERROR_OK Success.
1223 * NZERROR_TK_NOTOPEN Persona is not open.
1224 * NZERROR_TK_NOTSUPP Function not supported with persona.
1225 */
1226nzerror nztxkec_PKEncryptExpansion( nzctx *, nzttPersona *, ub4, ub4,
1227 ub4 * );
1228
1229/*--------------------- nztkdc_PKDecrypt ---------------------*/
1230
1231/*
1232 * NAME
1233 * nztkdc_PKDecrypt - Decrypt a PKEncrypted message.
1234 *
1235 * PARAMETERS
1236 * osscntxt {IN} OSS context.
1237 * persona {IN} Persona.
1238 * state {IN} State of encryption.
1239 * inlen {IN} Length of this input part.
1240 * in {IN} This input part.
1241 * tdubuf {IN/OUT} TDU buffer.
1242 *
1243 * NOTES
1244 *
1245 * RETURNS
1246 * NZERROR_OK Success.
1247 * NZERROR_TK_CANTGROW Needed to grow output buffer but could not.
1248 * NZERROR_TK_NOTOPEN Persona is not open.
1249 * NZERROR_TK_NOTSUPP Function not supported with persona.
1250 */
1251nzerror nztkdc_PKDecrypt( nzctx *, nzttPersona *, nzttces, ub4, ub1 *,
1252 nzttBufferBlock * );
1253
1254/*-------------------------- nztHash --------------------------*/
1255
1256/*
1257 * NAME
1258 * nztHash - Generate a hash.
1259 *
1260 * PARAMETERS
1261 * osscntxt {IN} OSS context.
1262 * persona {IN} Persona.
1263 * state {IN} State of hash.
1264 * inlen {IN} Length of this input.
1265 * in {IN} This input.
1266 * tdu {IN/OUT} Output tdu.
1267 *
1268 * NOTES
1269 *
1270 * RETURNS
1271 * NZERROR_OK Success.
1272 * NZERROR_TK_CANTGROW Needed to grow TDU buffer but could not.
1273 * NZERROR_TK_NOTOPEN Persona is not open.
1274 * NZERROR_TK_NOTSUPP Function not supported with persona.
1275 */
1276nzerror nztHash( nzctx *, nzttPersona *, nzttces, ub4, ub1 *,
1277 nzttBufferBlock * );
1278
1279/*----------------------- nztSeedRandom -----------------------*/
1280
1281/*
1282 * NAME
1283 * nztSeedRandom - Seed the random function
1284 *
1285 * PARAMETERS
1286 * osscntxt {IN} OSS context.
1287 * persona {IN} Persona.
1288 * seedlen {IN} Length of seed.
1289 * seed {IN} Seed.
1290 *
1291 * NOTES
1292 *
1293 * RETURNS
1294 * NZERROR_OK Success.
1295 * NZERROR_TK_NOTOPEN Persona is not open.
1296 * NZERROR_TK_NOTSUPP Function not supported with persona.
1297 */
1298nzerror nztSeedRandom( nzctx *, nzttPersona *, ub4, ub1 * );
1299
1300/*--------------------- nztrb_RandomBytes ---------------------*/
1301
1302/*
1303 * NAME
1304 * nztrb_RandomBytes - Generate a buffer random bytes.
1305 *
1306 * PARAMETERS
1307 * osscntxt {IN} OSS context.
1308 * persona {IN} Persona.
1309 * nbytes {IN} Number of bytes desired.
1310 * out {IN/OUT} Buffer block for bytes.
1311 *
1312 * NOTES
1313 *
1314 * RETURNS
1315 * NZERROR_OK Success.
1316 * NZERROR_TK_CANTGROW Needed to grow TDU buffer but could not.
1317 * NZERROR_TK_NOTOPEN Persona is not open.
1318 * NZERROR_TK_NOTSUPP Function not supported with persona.
1319 */
1320nzerror nztrb_RandomBytes( nzctx *, nzttPersona *, ub4,
1321 nzttBufferBlock * );
1322
1323/*-------------------- nztrn_RandomNumber --------------------*/
1324
1325/*
1326 * NAME
1327 * nztrn_RandomNumber - Generate a random number
1328 *
1329 * PARAMETERS
1330 * osscntxt {IN} OSS context.
1331 * persona {IN} Persona.
1332 * num {OUT} Number.
1333 *
1334 * NOTES
1335 *
1336 * RETURNS
1337 * NZERROR_OK Success.
1338 * NZERROR_TK_NOTOPEN Persona is not open.
1339 * NZERROR_TK_NOTSUPP Function not supported with persona.
1340 */
1341nzerror nztrn_RandomNumber( nzctx *, nzttPersona *, uword * );
1342
1343/*---------------------- nztbbInitBlock ----------------------*/
1344
1345/*
1346 * NAME
1347 * nztbbInitBlock - Initialize a buffer block.
1348 *
1349 * PARAMETERS
1350 * osscntxt {IN} OSS context.
1351 * block {IN/OUT} Buffer block.
1352 *
1353 * NOTES
1354 * The buffer block is initialized to be empty (all members are set
1355 * to 0/NULL). Such a block will be allocated memory as needed.
1356 *
1357 * RETURNS
1358 * NZERROR_OK Success.
1359 */
1360nzerror nztbbInitBlock( nzctx *, nzttBufferBlock * );
1361
1362/*---------------------- nztbbReuseBlock ----------------------*/
1363
1364/*
1365 * NAME
1366 * nztbbReuseBlock - Reuse an already initialized and possibly used block.
1367 *
1368 * PARAMETERS
1369 * osscntxt {IN} OSS context.
1370 * block {IN/OUT} Buffer block.
1371 *
1372 * NOTES
1373 * This function simply sets the used length member of the buffer
1374 * block to 0. If the block already has memory allocated to it,
1375 * this will cause it to be reused.
1376 *
1377 * RETURNS
1378 * NZERROR_OK Success.
1379 */
1380nzerror nztbbReuseBlock( nzctx *, nzttBufferBlock * );
1381
1382/*---------------------- nztbbSizeBlock ----------------------*/
1383
1384/*
1385 * NAME
1386 * nztbbSizeBlock - Size an initialized block to a particular size.
1387 *
1388 * PARAMETERS
1389 * osscntxt {IN} OSS context.
1390 * len {IN} Minimum number of unused bytes desired.
1391 * block {IN/OUT} Buffer block.
1392 *
1393 * NOTES
1394 *
1395 * RETURNS
1396 * NZERROR_OK Success.
1397 */
1398nzerror nztbbSizeBlock( nzctx *, ub4, nzttBufferBlock * );
1399
1400/*----------------------- nztbbGrowBlock -----------------------*/
1401
1402/*
1403 * NAME
1404 * nzbbGrowBlock - Increase the size of the buffer block.
1405 *
1406 * PARAMETERS
1407 * osscntxt {IN} OSS context.
1408 * inc {IN} Number of bytes to increase.
1409 * block {IN/OUT} Buffer block.
1410 *
1411 * NOTES
1412 *
1413 * RETURNS
1414 * NZERROR_OK Success.
1415 */
1416nzerror nztbbGrowBlock( nzctx *, ub4, nzttBufferBlock * );
1417
1418/*---------------------- nztbbPurgeBlock ----------------------*/
1419
1420/*
1421 * NAME
1422 * nztbbPurgeBlock - Purge a buffer block of its memory.
1423 *
1424 * PARAMETERS
1425 * osscntxt {IN} OSS context.
1426 * block {IN/OUT} Buffer block.
1427 *
1428 * NOTES
1429 * The memory used by the buffer block as the buffer is released.
1430 * The buffer block itself is not affected.
1431 *
1432 * RETURNS
1433 * NZERROR_OK Success.
1434 */
1435nzerror nztbbPurgeBlock( nzctx *, nzttBufferBlock * );
1436
1437/*----------------------- nztbbSetBlock -----------------------*/
1438
1439/*
1440 * NAME
1441 * nztbbSetBlock - Set a buffer block to a known state.
1442 *
1443 * PARAMETERS
1444 * osscntxt {IN} OSS context.
1445 * flags {IN} Flags to set.
1446 * buflen {IN} Length of buffer.
1447 * usedlen {IN} Used length.
1448 * buffer {IN} Buffer.
1449 * block {IN/OUT} Buffer block
1450 *
1451 * NOTES
1452 * If buflen > 0, objlen == 0, and obj == NULL, then buflen bytes
1453 * of memory is allocated and a pointer is stored in the buffer
1454 * block.
1455 *
1456 * The buffer parameter remains unchanged.
1457 *
1458 * RETURNS
1459 * NZERROR_OK Success.
1460 */
1461nzerror nztbbSetBlock( nzctx *, uword, ub4, ub4, ub1 *,
1462 nzttBufferBlock * );
1463
1464
1465/*--------------------- nztiGetSecInfo ---------------------*/
1466
1467/*
1468 * NAME
1469 * nztiGetSecInfo - Get some security information for SSL
1470 *
1471 * PARAMETERS
1472 * Name {IN/OUT} Description
1473 * osscntxt {IN} OSS context.
1474 * persona {IN} persona
1475 * dname {OUT} distinguished name of the certificate
1476 * dnamelen {OUT} length of the distinguished name
1477 * issuername {OUT} issuer name of the certificate
1478 * certhash {OUT} SHA1 hash of the certificate
1479 * certhashlen{OUT} length of the hash
1480 * NOTES
1481 * This function allocate memories for issuername, certhash, and dname.
1482 * To deallocate memory for those params, you should call nztdbuf_DestroyBuf.
1483 * RETURNS
1484 *
1485 */
1486nzerror nztiGetSecInfo( nzctx *, nzttPersona *, text **, ub4 *,
1487 text **, ub4 *, ub1 **, ub4 * );
1488
1489
1490/*---------------------- nztiGetDName ----------------------*/
1491
1492/*
1493 * NAME
1494 * nztiGetDName - Get the distinguished name for the given identity
1495 *
1496 * PARAMETERS
1497 * Name {IN/OUT} Description
1498 * osscntxt {IN} OSS context.
1499 * identity {IN} identity need to get dname from
1500 * dn {OUT} distinguished name
1501 * dnlen {OUT} length of the dname
1502 *
1503 * NOTES
1504 *
1505 * RETURNS
1506 *
1507 */
1508
1509nzerror nztiGetDName( nzctx *, nzttIdentity *,
1510 text **, ub4 * );
1511
1512/*------------------- nztiGetIssuerName -------------------*/
1513
1514/*
1515 * NAME
1516 * nztiGetIssuerName - Get IssuerName for the given identity
1517 *
1518 * PARAMETERS
1519 * Name {IN/OUT} Description
1520 * osscntxt {IN} OSS context.
1521 * identity {IN} identity need to get issuername from
1522 * issuername {OUT} issuer's name
1523 * issuernamelen {OUT} length of the issuer's name
1524 *
1525 * NOTES
1526 *
1527 * RETURNS
1528 *
1529 */
1530nzerror nztiGetIssuerName( nzctx *, nzttIdentity *,
1531 text **, ub4 * );
1532
1533
1534/*-------------------- nztgch_GetCertHash --------------------*/
1535
1536/*
1537 * NAME
1538 * nztgch_GetCertHash - Get SHA1 hash for the certificate of the identity
1539 *
1540 * PARAMETERS
1541 * Name {IN/OUT} Description
1542 * osscntxt {IN} OSS context.
1543 * identity {IN} identity need to get issuername from
1544 * certHash {OUT} certHash buffer
1545 * hashLen {OUT} length of the certHash
1546 *
1547 * NOTES
1548 * Need to call nztdbuf_DestroyBuf to deallocate memory for certHash.
1549 * RETURNS
1550 *
1551 */
1552nzerror nztgch_GetCertHash( nzctx *, nzttIdentity *,
1553 ub1 **, ub4 * );
1554
1555/*-------------------- nztdbuf_DestroyBuf --------------------*/
1556
1557/*
1558 * NAME
1559 * nztdbuf_DestroyBuf - Deallocation funtions for ub1 and text buffer
1560 *
1561 * PARAMETERS
1562 * Name {IN/OUT} Description
1563 * osscntxt {IN} OSS context.
1564 * buf {IN} Allocated buffer to be destroyed.
1565 *
1566 * NOTES
1567 *
1568 * RETURNS
1569 *
1570 */
1571nzerror nztdbuf_DestroyBuf( nzctx *, void ** );
1572
1573
1574/*----------------------- nztGetCertChain -----------------------*/
1575
1576/*
1577 * NAME
1578 * nztGetCertChain -
1579 *
1580 * PARAMETERS
1581 * Name {IN/OUT} Description
1582 * osscntxt {IN} OSS context.
1583 *
1584 * NOTES
1585 *
1586 * RETURNS
1587 *
1588 */
1589nzerror nztGetCertChain( nzctx *, nzttWallet * );
1590
1591/*----------------------- nztCompareDN -----------------------*/
1592
1593/*
1594 * NAME
1595 * nztCompareDN -
1596 *
1597 * PARAMETERS
1598 * Name {IN/OUT} Description
1599 * osscntxt {IN} OSS context.
1600 * dn1 {IN} distinguished name 1
1601 * dn2 {IN} distinguished name 2
1602 *
1603 * NOTES
1604 *
1605 * RETURNS
1606 * NZERROR_OK succeeded
1607 * others failed
1608 *
1609 */
1610nzerror nztCompareDN( nzctx *, ub1 *,ub4 , ub1 *, ub4, boolean * );
1611
1612
1613#ifdef NZ_OLD_TOOLS
1614/*--------------------- nztIdentityAlloc ---------------------*/
1615
1616/*
1617 * NAME
1618 * nztIdentityAlloc - Allocate memory for nzttIdentity context
1619 *
1620 * PARAMETERS
1621 * Name {IN/OUT} Description
1622 * osscntxt {IN} OSS context.
1623 * identity {OUT} nzttIdentity context
1624 *
1625 * NOTES
1626 *
1627 * RETURNS
1628 * NZERROR_OK succeeded
1629 * others failed
1630 *
1631 */
1632nzerror nztIdentityAlloc( nzctx *, nzttIdentity ** );
1633
1634/*--------------------- nztIPrivateAlloc ---------------------*/
1635
1636/*
1637 * NAME
1638 * nztIPrivateAlloc - Allocate memory for nzttIdentityPrivate
1639 *
1640 * PARAMETERS
1641 * Name {IN/OUT} Description
1642 *
1643 * osscntxt {IN} OSS context.
1644 * ipriv {OUT} identityPrivate structure
1645 * NOTES
1646 *
1647 * RETURNS
1648 * NZERROR_OK succeeded
1649 * others failed
1650 *
1651 */
1652
1653nzerror nztIPrivateAlloc( nzctx *, nzttIdentityPrivate **);
1654
1655
1656/*---------------------- nztIDupContent ----------------------*/
1657
1658/*
1659 * NAME
1660 * nztIDupContent -
1661 *
1662 * PARAMETERS
1663 * Name {IN/OUT} Description
1664 * osscntxt {IN} OSS context.
1665 * targetIdentity{OUT} target identity
1666 * sourceIdentity {IN} source identity
1667 * NOTES
1668 *
1669 * RETURNS
1670 * NZERROR_OK succeeded
1671 * others failed
1672 *
1673 */
1674
1675nzerror nztIDupContent( nzctx *, nzttIdentity *, nzttIdentity * );
1676/*---------------------- nztIPDuplicate ----------------------*/
1677
1678/*
1679 * NAME
1680 * nztIPDuplicate -
1681 *
1682 * PARAMETERS
1683 * Name {IN/OUT} Description
1684 * osscntxt {IN} OSS context.
1685 * target_ipriv {OUT} target identityPrivate
1686 * source_ipriv {IN} source identityPrivate
1687 *
1688 * NOTES
1689 *
1690 * RETURNS
1691 * NZERROR_OK succeeded
1692 * others failed
1693 *
1694 */
1695nzerror nztIPDuplicate( nzctx *, nzttIdentityPrivate **,
1696 nzttIdentityPrivate * );
1697
1698/*--------------------- nztiDupIdentList ---------------------*/
1699
1700/*
1701 * NAME
1702 * nztiDupIdentList -
1703 *
1704 * PARAMETERS
1705 * Name {IN/OUT} Description
1706 * osscntxt {IN} OSS context.
1707 * source_identities {IN} source identity list
1708 * numIdent {OUT} number of identity in the list
1709 * ppidentity {OUT} Target of identity
1710 *
1711 * NOTES
1712 *
1713 * RETURNS
1714 * NZERROR_OK succeeded
1715 * others failed
1716 *
1717 */
1718nzerror nztiDupIdentList( nzctx *, nzttIdentity *, ub4 *,
1719 nzttIdentity ** );
1720
1721/*--------------------- nztFreeIdentList ---------------------*/
1722
1723/*
1724 * NAME
1725 * nztFreeIdentList - Free memory for a list of Identities
1726 *
1727 * PARAMETERS
1728 * Name {IN/OUT} Description
1729 * osscntxt {IN} OSS context.
1730 * identity {IN} identity context
1731 *
1732 * NOTES
1733 *
1734 * RETURNS
1735 * NZERROR_OK succeeded
1736 * others failed
1737 *
1738 */
1739nzerror nztFreeIdentList( nzctx *, nzttIdentity ** );
1740#endif /* NZ_OLD_TOOLS */
1741
1742/*--------------------- nztCheckVaLidity ---------------------*/
1743
1744/*
1745 * NAME
1746 * nztCheckVaLidity - Check the validity of certificate
1747 *
1748 * PARAMETERS
1749 * Name {IN/OUT} Description
1750 * osscntxt {IN} OSS context.
1751 * start_time Start time of the certificate
1752 * end_time End time of the certificate
1753 *
1754 * NOTES
1755 *
1756 * RETURNS
1757 * NZERROR_OK succeeded
1758 * others failed
1759 *
1760 */
1761nzerror nztCheckValidity( nzctx *, ub4 , ub4 );
1762
1763/*--------------------- nztwCreateWallet ---------------------*/
1764
1765/*
1766 * NAME
1767 * nztwCreateWallet - Create a new wallet.
1768 *
1769 * PARAMETERS
1770 * osscntxt {IN} OSS context.
1771 * wrllen {IN} Length of wallet resource locator.
1772 * wrl {IN} WRL.
1773 * pwdlen {IN} Length of password (see notes below).
1774 * pwd {IN} Password.
1775 * wallet {IN/OUT} Wallet.
1776 *
1777 * NOTES
1778 * It is an error to try to create a wallet that already exists.
1779 * The previously existing wallet must be destroyed first.
1780 *
1781 * The wallet itself is not encrypted. Rather, all the personas in
1782 * the wallet are encrypted under the same password. A hash of the
1783 * password is stored in the wallet.
1784 *
1785 * Upon success, an empty open wallet is stored in the wallet
1786 * parameter.
1787 *
1788 * RETURNS
1789 * NZERROR_OK Sucess.
1790 * NZERROR_TK_WALLET_EXISTS Wallet already exists.
1791 * NZERROR_RIO_OPEN RIO could not create wallet (see trace file).
1792 */
1793nzerror nztwCreateWallet( nzctx *, ub4, text *, ub4, text *,
1794 nzttWallet * );
1795
1796
1797/*--------------------- nztwDestroyWallet ---------------------*/
1798
1799/*
1800 * NAME
1801 * nztwDestroyWallet - Destroy an existing wallet.
1802 *
1803 * PARAMETERS
1804 * osscntxt {IN} OSS context.
1805 * wrllen {IN} Length of wallet resource locator.
1806 * wrl {IN} WRL.
1807 * pwdlen {IN} Length of password.
1808 * pwd {IN} Password.
1809 * NOTES
1810 *
1811 * RETURNS
1812 * NZERROR_OK Success.
1813 * NZERROR_TK_PASSWORD Password verification failed.
1814 * NZERROR_RIO_OPEN RIO could not open wallet (see trace file).
1815 * NZERROR_RIO_DELETE Delete failed (see trace file).
1816 */
1817nzerror nztwDestroyWallet( nzctx *, ub4, text *, ub4, text * );
1818
1819/*--------------------- nzteStorePersona ---------------------*/
1820
1821/*
1822 * NAME
1823 * nzteStorePersona - Store an open persona in a wallet.
1824 *
1825 * PARAMETERS
1826 * osscntxt {IN} OSS context.
1827 * persona {IN/OUT} Persona.
1828 * wallet {IN/OUT} Wallet.
1829 *
1830 * NOTES
1831 * If the open persona is not associated with any wallet (it was
1832 * created via the nzteClosePersona function), then storing the
1833 * persona creates that association. The wallet will also have an
1834 * updated persona list that reflects this association.
1835 *
1836 * If the open persona was associated with wallet 'A' (it was
1837 * opened via the nztwOpenWallet function), and is stored back into
1838 * wallet 'A', then then the old persona is overwritten by the new
1839 * persona if the password can be verified. Recall that all
1840 * personas have a unique identity id. If that id changes then
1841 * storing the persona will put a new persona in the wallet.
1842 *
1843 * If the open persona was associated with wallet 'A' and is stored
1844 * into wallet 'B', and if wallet 'B' does not contain a persona
1845 * with that unique identity id, then the persona will be copied
1846 * into wallet 'B', wallet 'B''s persona list will be updated, and
1847 * the persona structure will be updated to be associated with
1848 * wallet 'B'. If wallet 'B' already contained the persona, it
1849 * would be overwritten by the new persona.
1850 *
1851 * The persona parameter is doubly indirect so that at the
1852 * conclusion of the function call, the pointer can be directed to
1853 * the persona in the wallet.
1854 *
1855 * RETURNS
1856 * NZERROR_OK Success.
1857 * NZERROR_TK_PASSWORD Password verification failed.
1858 * NZERROR_RIO_STORE Store failed (see network trace file).
1859 */
1860nzerror nzteStorePersona( nzctx *, nzttPersona **, nzttWallet * );
1861
1862/*--------------------- nzteRemovePersona ---------------------*/
1863
1864/*
1865 * NAME
1866 * nzteRemovePersona - Remove a persona from the wallet.
1867 *
1868 * PARAMETERS
1869 * osscntxt {IN} OSS context.
1870 * persona {IN/OUT} Persona.
1871 *
1872 * NOTES
1873 * The password is verified before trying to remove the persona.
1874 *
1875 * If the persona is open, it is closed. The persona is removed
1876 * from the wallet list and the persona pointer is set to NULL.
1877 *
1878 * A double indirect pointer to the persona is required so that the
1879 * persona pointer can be set to NULL upon completion.
1880 *
1881 * RETURNS
1882 * NZERROR_OK Success.
1883 * NZERROR_TK_PASSWORD Password verification failed.
1884 * NZERROR_RIO_DELETE Delete failed.
1885 */
1886nzerror nzteRemovePersona( nzctx *, nzttPersona ** );
1887
1888/*--------------------- nzteCreatePersona ---------------------*/
1889
1890/*
1891 * NAME
1892 * nzteCreatePersona - Create a persona.
1893 *
1894 * PARAMETERS
1895 * osscntxt {IN} OSS context.
1896 * itype {IN} Identity type.
1897 * ctype {IN} Cipher type.
1898 * desc {IN} Persona description.
1899 * persona {OUT} Persona.
1900 *
1901 * NOTES
1902 * The resulting persona is created in the open state, but it will
1903 * not be associated with a wallet.
1904 *
1905 * The memory for the persona is allocated by the function.
1906 *
1907 * RETURNS
1908 * NZERROR_OK Success.
1909 * NZERROR_TK_TYPE Unsupported itype/ctype combination.
1910 * NZERROR_TK_PARMS Error in persona description.
1911 */
1912nzerror nzteCreatePersona( nzctx *, nzttVersion, nzttCipherType,
1913 nzttPersonaDesc *, nzttPersona ** );
1914
1915
1916/*----------------- nztiStoreTrustedIdentity -----------------*/
1917
1918/*
1919 * NAME
1920 * nztiStoreTrustedIdentity - Store an identity into a persona.
1921 *
1922 * PARAMETERS
1923 * osscntxt {IN} Success.
1924 * identity {IN/OUT} Trusted Identity.
1925 * persona {IN/OUT} Persona.
1926 *
1927 * NOTES
1928 * The identity is not saved with the persona in the wallet until
1929 * the persona is stored.
1930 *
1931 * The identity parameter is double indirect so that it can point
1932 * into the persona at the conclusion of the call.
1933 *
1934 * RETURNS
1935 * NZERROR_OK Success.
1936 */
1937nzerror nztiStoreTrustedIdentity( nzctx *, nzttIdentity **,
1938 nzttPersona * );
1939
1940/*--------------------- nzteSetProtection ---------------------*/
1941
1942/*
1943 * NAME
1944 * nzteSetProtection - Set the protection type for a CE function.
1945 *
1946 * PARAMETERS
1947 * osscntxt {IN} OSS context.
1948 * persona {IN/OUT} Persona.
1949 * func {IN} CE function.
1950 * tdufmt {IN} TDU Format.
1951 * protinfo {IN} Protection information specific to this format.
1952 *
1953 * NOTES
1954 *
1955 * RETURNS
1956 * NZERROR_OK Success.
1957 * NZERROR_TK_PROTECTION Unsupported protection.
1958 * NZERROR_TK_PARMS Error in protection info.
1959 */
1960nzerror nzteSetProtection( nzctx *, nzttPersona *, nzttcef, nztttdufmt,
1961 nzttProtInfo * );
1962
1963/*--------------------- nzteGetProtection ---------------------*/
1964
1965/*
1966 * NAME
1967 * nzteGetProtection - Get the protection type for a CE function.
1968 *
1969 * PARAMETERS
1970 * osscntxt {IN} OSS context.
1971 * persona {IN} Persona.
1972 * func {IN} CE function.
1973 * tdufmt {OUT} TDU format.
1974 * protinfo {OUT} Protection information.
1975 *
1976 * NOTES
1977 *
1978 * RETURNS
1979 * NZERROR_OK Success.
1980 */
1981nzerror nzteGetProtection( nzctx *, nzttPersona *, nzttcef, nztttdufmt *,
1982 nzttProtInfo * );
1983
1984/*-------------------- nztiRemoveIdentity --------------------*/
1985
1986/*
1987 * NAME
1988 * nztiRemoveIdentity - Remove an identity from an open persona.
1989 *
1990 * PARAMETERS
1991 * osscntxt {IN} OSS context.
1992 * identity {IN/OUT} Identity.
1993 *
1994 * NOTES
1995 * If the persona is not stored, this identity will still be in the
1996 * persona stored in the wallet.
1997 *
1998 * The identity parameter is doubly indirect so that at the
1999 * conclusion of the function, the pointer can be set to NULL.
2000 *
2001 * RETURNS
2002 * NZERROR_OK Success.
2003 * NZERROR_TK_NOTFOUND Identity not found.
2004 * NZERROR_TK_NOTOPEN Persona is not open.
2005 */
2006nzerror nztiRemoveIdentity( nzctx *, nzttIdentity ** );
2007
2008/*----------------- nztifdn -----------------*/
2009
2010/*
2011 * NAME
2012 * nztifdn - create an Identity From a Distinguished Name
2013 *
2014 * PARAMETERS
2015 * osscntxt {IN} OSS context.
2016 * length {IN} Length of the distinguished name
2017 * distinguished_name {IN} distinguished name string
2018 * ppidentity {OUT} created identity
2019 *
2020 * NOTES
2021 * Given a distinguished name, return the identity that corresponds to it.
2022 *
2023 * RETURNS
2024 * NZERROR_OK Success.
2025 */
2026nzerror nztifdn( nzctx *ossctx,
2027 ub4 length,
2028 text *distinguished_name,
2029 nzttIdentity **ppidentity );
2030
2031/*--------------------- nztxSignExpansion ---------------------*/
2032
2033/*
2034 * NAME
2035 * nztxSignExpansion - Determine the size of the attached signature buffer.
2036 *
2037 * PARAMETERS
2038 * osscntxt {IN} OSS context.
2039 * persona {IN} Persona.
2040 * inlen {IN} Length of input.
2041 * tdulen {OUT} Buffer needed for signature.
2042 *
2043 * NOTES
2044 *
2045 * RETURNS
2046 * NZERROR_OK Success.
2047 * NZERROR_TK_NOTOPEN Persona is not open.
2048 * NZERROR_TK_NOTSUPP Function not supported with persona.
2049 */
2050nzerror nztxSignExpansion( nzctx *, nzttPersona *, ub4, ub4 * );
2051
2052/*--------------- nztxsd_SignDetachedExpansion ---------------*/
2053
2054/*
2055 * NAME
2056 * nztxsd_SignDetachedExpansion - Determine the size of buffer needed.
2057 *
2058 * PARAMETERS
2059 * osscntxt {IN} OSS context.
2060 * persona {IN} Persona.
2061 * inlen {IN} Length of input.
2062 * tdulen {OUT} Buffer needed for signature.
2063 *
2064 * NOTES
2065 *
2066 * RETURNS
2067 * NZERROR_OK Success.
2068 * NZERROR_TK_NOTOPEN Persona is not open.
2069 * NZERROR_TK_NOTSUPP Function not supported with persona.
2070 */
2071nzerror nztxsd_SignDetachedExpansion( nzctx *, nzttPersona *, ub4,
2072 ub4 * );
2073
2074/*------------------------ nztEncrypt ------------------------*/
2075
2076/*
2077 * NAME
2078 * nztEncrypt - Symmetrically encrypt
2079 *
2080 * PARAMETERS
2081 * osscntxt {IN} OSS context.
2082 * persona {IN} Persona.
2083 * inlen {IN} Length of this input part.
2084 * in {IN} This input part.
2085 * tdubuf {IN/OUT} TDU buffer.
2086 *
2087 * NOTES
2088 *
2089 * RETURNS
2090 * NZERROR_OK Success.
2091 * NZERROR_TK_CANTGROW Needed to grow TDU buffer but could not.
2092 * NZERROR_TK_NOTOPEN Persona is not open.
2093 * NZERROR_TK_NOTSUPP Function not supported with persona.
2094 */
2095nzerror nztEncrypt( nzctx *, nzttPersona *, nzttces, ub4, ub1 *,
2096 nzttBufferBlock * );
2097
2098/*------------------- nztxEncryptExpansion -------------------*/
2099
2100/*
2101 * NAME
2102 * nztxEncryptExpansion - Determine the size of the TDU to encrypt.
2103 *
2104 * PARAMETERS
2105 * osscntxt {IN} OSS context.
2106 * persona {IN} Persona.
2107 * inlen {IN} Length of this input part.
2108 * tdulen {OUT} Length of TDU.
2109 *
2110 * NOTES
2111 *
2112 * RETURNS
2113 * NZERROR_OK Success.
2114 * NZERROR_TK_NOTOPEN Persona is not open.
2115 * NZERROR_TK_NOTSUPP Function not supported with persona.
2116 */
2117nzerror nztxEncryptExpansion( nzctx *, nzttPersona *, ub4, ub4 * );
2118
2119/*------------------------ nztDecrypt ------------------------*/
2120
2121/*
2122 * NAME
2123 * nztDecrypt - Decrypt an Encrypted message.
2124 *
2125 * PARAMETERS
2126 * osscntxt {IN} OSS context.
2127 * persona {IN} Persona.
2128 * state {IN} State of decryption.
2129 * inlen {IN} Length of this input part.
2130 * in {IN} This input part.
2131 * out {IN/OUT} Cleartext message.
2132 *
2133 * NOTES
2134 *
2135 * RETURNS
2136 * NZERROR_OK Success.
2137 * NZERROR_TK_CANTGROW Needed to grow TDU buffer but could not.
2138 * NZERROR_TK_NOTOPEN Persona is not open.
2139 * NZERROR_TK_NOTSUPP Function not supported with persona.
2140 */
2141nzerror nztDecrypt( nzctx *, nzttPersona *, nzttces, ub4, ub1 *,
2142 nzttBufferBlock * );
2143
2144/*------------------------ nztEnvelope ------------------------*/
2145
2146/*
2147 * NAME
2148 * nztEnvelope - Sign and PKEncrypt a message.
2149 *
2150 * PARAMETERS
2151 * osscntxt {IN} OSS context.
2152 * persona {IN} Persona.
2153 * nrecipients {IN} Number of recipients for this encryption.
2154 * recipients {IN} List of recipients.
2155 * state {IN} State of encryption.
2156 * inlen {IN} Length of this input part.
2157 * in {IN} This input part.
2158 * tdubuf {IN/OUT} TDU buffer.
2159 *
2160 * NOTES
2161 *
2162 * RETURNS
2163 * NZERROR_OK Success.
2164 * NZERROR_TK_CANTGROW Needed to grow output buffer but could not.
2165 * NZERROR_TK_NOTOPEN Persona is not open.
2166 * NZERROR_TK_NOTSUPP Function not supported with persona.
2167 */
2168nzerror nztEnvelope( nzctx *, nzttPersona *, ub4, nzttIdentity *,
2169 nzttces, ub4, ub1 *, nzttBufferBlock * );
2170
2171/*----------------------- nztDeEnvelope -----------------------*/
2172
2173/*
2174 * NAME
2175 * nztDeEnvelope - PKDecrypt and verify a message.
2176 *
2177 * PARAMETERS
2178 * osscntxt {IN} OSS context.
2179 * persona {IN} Persona.
2180 * state {IN} State of encryption.
2181 * inlen {IN} Length of this input part.
2182 * in {IN} This input part.
2183 * out {OUT} Message from TDU.
2184 * verified {OUT} TRUE if verified.
2185 * validated {OUT} TRUE if validated.
2186 * sender {OUT} Identity of sender.
2187 *
2188 * NOTES
2189 *
2190 * RETURNS
2191 * NZERROR_OK Success.
2192 * NZERROR_TK_CANTGROW Needed to grow TDU buffer but could not.
2193 * NZERROR_TK_NOTOPEN Persona is not open.
2194 * NZERROR_TK_NOTSUPP Function not supported with persona.
2195 */
2196nzerror nztDeEnvelope( nzctx *, nzttPersona *, nzttces, ub4, ub1 *,
2197 nzttBufferBlock *, boolean *, boolean *,
2198 nzttIdentity ** );
2199
2200/*----------------------- nztKeyedHash -----------------------*/
2201
2202/*
2203 * NAME
2204 * nztKeyedHash - Generate a keyed hash.
2205 *
2206 * PARAMETERS
2207 * osscntxt {IN} OSS context.
2208 * persona {IN} Persona.
2209 * state {IN} State of hash.
2210 * inlen {IN} Length of this input.
2211 * in {IN} This input.
2212 * tdu {IN/OUT} Output tdu.
2213 *
2214 * NOTES
2215 *
2216 * RETURNS
2217 * NZERROR_OK Success.
2218 * NZERROR_TK_CANTGROW Needed to grow TDU buffer but could not.
2219 * NZERROR_TK_NOTOPEN Persona is not open.
2220 * NZERROR_TK_NOTSUPP Function not supported with persona.
2221 */
2222nzerror nztKeyedHash( nzctx *, nzttPersona *, nzttces, ub4, ub1 *,
2223 nzttBufferBlock * );
2224
2225/*------------------ nztxKeyedHashExpansion ------------------*/
2226
2227/*
2228 * NAME
2229 * nztxKeyedHashExpansion - Determine the space needed for a keyed hash.
2230 *
2231 * PARAMETERS
2232 * osscntxt {IN} OSS context.
2233 * persona {IN} Persona.
2234 * inlen {IN} Length of this input.
2235 * tdulen {OUT} TDU length.
2236 *
2237 * NOTES
2238 *
2239 * RETURNS
2240 * NZERROR_OK Success.
2241 * NZERROR_TK_NOTOPEN Persona is not open.
2242 * NZERROR_TK_NOTSUPP Function not supported with persona.
2243 */
2244nzerror nztxKeyedHashExpansion( nzctx *, nzttPersona *, ub4,
2245 ub4 * );
2246
2247/*--------------------- nztxHashExpansion ---------------------*/
2248
2249/*
2250 * NAME
2251 * nztxHashExpansion - Determine the size of the TDU for a hash.
2252 *
2253 * PARAMETERS
2254 * osscntxt {IN} OSS context.
2255 * persona {IN} Persona.
2256 * inlen {IN} Length of this input.
2257 * tdulen {OUT} TDU length.
2258 *
2259 * NOTES
2260 *
2261 * RETURNS
2262 * NZERROR_OK Success.
2263 * NZERROR_TK_NOTOPEN Persona is not open.
2264 * NZERROR_TK_NOTSUPP Function not supported with persona.
2265 */
2266nzerror nztxHashExpansion( nzctx *, nzttPersona *, ub4, ub4 * );
2267
2268/*---------------- nztiae_IsAuthEnabled ----------------*/
2269
2270/*
2271 * NAME
2272 * nztiae_IsAuthEnabled - Checks to see if Authentication is Enabled
2273 * in the current Cipher Spec.
2274 *
2275 * PARAMETERS
2276 * ctx {IN} Oracle SSL Context
2277 * ncipher {IN} CipherSuite
2278 * authEnabled {OUT} Boolean for is Auth Enabled?
2279 *
2280 * NOTES
2281 *
2282 * RETURNS
2283 * NZERROR_OK on success.
2284 * NZERROR_TK_INV_CIPHR_TYPE if Cipher Spec is not Recognized.
2285 */
2286
2287nzerror nztiae_IsAuthEnabled( nzctx *ctx,
2288 ub2 ncipher,
2289 boolean *authEnabled );
2290
2291/*---------------- nztiee_IsEncrEnabled ----------------*/
2292/*
2293 * NAME
2294 * nztiee_IsEncrEnabled - Checks to see if Encryption is Enabled
2295 * in the current Cipher Spec.
2296 *
2297 * PARAMETERS
2298 * ctx {IN} Oracle SSL Context
2299 * ncipher {IN} CipherSuite
2300 * EncrEnabled {OUT} Boolean for is Auth Enabled?
2301 *
2302 * NOTES
2303 *
2304 * RETURNS
2305 * NZERROR_OK on success.
2306 * NZERROR_TK_INV_CIPHR_TYPE if Cipher Spec is not Recognized.
2307 */
2308
2309nzerror nztiee_IsEncrEnabled( nzctx *ctx,
2310 ub2 ncipher,
2311 boolean *EncrEnabled );
2312
2313/*---------------- nztihe_IsHashEnabled ----------------*/
2314/*
2315 * NAME
2316 * nztihe_IsHashEnabled - Checks to see if HAshing is Enabled
2317 * in the current Cipher Spec.
2318 *
2319 * PARAMETERS
2320 * ctx {IN} Oracle SSL Context
2321 * ncipher {IN} CipherSuite
2322 * hashEnabled {OUT} Boolean for is Auth Enabled?
2323 *
2324 * NOTES
2325 *
2326 * RETURNS
2327 * NZERROR_OK on success.
2328 * NZERROR_TK_INV_CIPHR_TYPE if Cipher Spec is not Recognized.
2329 */
2330
2331nzerror nztihe_IsHashEnabled( nzctx *ctx,
2332 ub2 ncipher,
2333 boolean *hashEnabled );
2334
2335/*
2336 *
2337 */
2338
2339nzerror nztGetIssuerName( nzctx *ctx,
2340 nzttIdentity *identity,
2341 ub1 **issuername,
2342 ub4 *issuernamelen );
2343
2344nzerror nztGetSubjectName( nzctx *ctx,
2345 nzttIdentity *identity,
2346 ub1 **subjectname,
2347 ub4 *subjectnamelen );
2348
2349nzerror nztGetBase64Cert( nzctx *ctx,
2350 nzttIdentity *identity,
2351 ub1 **b64cert,
2352 ub4 *b64certlen );
2353
2354nzerror nztGetSerialNumber( nzctx *ctx,
2355 nzttIdentity *identity,
2356 ub1 **serialnum,
2357 ub4 *serialnumlen );
2358
2359nzerror nztGetValidDate( nzctx *ctx,
2360 nzttIdentity *identity,
2361 ub4 *startdate,
2362 ub4 *enddate );
2363
2364nzerror nztGetVersion( nzctx *ctx,
2365 nzttIdentity *identity,
2366 nzstrc *pVerStr );
2367
2368nzerror nztGetPublicKey( nzctx *ctx,
2369 nzttIdentity *identity,
2370 ub1 **pubKey,
2371 ub4 *pubKeylen );
2372
2373nzerror nztGenericDestroy( nzctx *ctx,
2374 ub1 **var );
2375
2376nzerror nztSetAppDefaultLocation( nzctx *ctx,
2377 text *,
2378 size_t );
2379
2380nzerror nztSearchNZDefault( nzctx *ctx,
2381 boolean *search );
2382
2383nzerror nztSetLightWeight(nzctx *ctx,
2384 boolean flag);
2385
2386#endif /* NZT_ORACLE */
2387