]>
git.saurik.com Git - apple/security.git/blob - CertTool/CertUI.h
2 * Copyright (c) 2002-2003 Apple Computer, Inc. All Rights Reserved.
4 * The contents of this file constitute Original Code as defined in and are
5 * subject to the Apple Public Source License Version 1.2 (the 'License').
6 * You may not use this file except in compliance with the License. Please
7 * obtain a copy of the License at http://www.apple.com/publicsource and
8 * read it before using this file.
10 * This Original Code and all software distributed under the License are
11 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
12 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
13 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
14 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
15 * Please see the License for the specific language governing rights and
16 * limitations under the License.
22 Description: stdio-based routines to get cert info from user.
27 #ifndef _CREATECERT_CERT_UI_H_
28 #define _CREATECERT_CERT_UI_H_
30 #include <Security/cssmtype.h>
31 #include <Security/cssmapple.h>
36 enum AbortException
{kEOFException
};
38 /* Dump error info. */
45 * -- guaranteed no buffer overflow
46 * -- guaranteed NULL-terminated string
47 * -- handles empty string (i.e., response is just CR) properly
54 * Prompt and safe getString.
56 void getStringWithPrompt(
57 const char *prompt
, // need not end in newline
62 * Used to interactively cook up an array of CSSM_APPLE_TP_NAME_OIDs, representing
66 const CSSM_OID
*oid
; // e.g., CSSMOID_CommonName
67 const char *description
; // e.g., "Common Name"
68 const char *example
; // e.g., "www.apple.com"
73 /* Fill in a CSSM_APPLE_TP_NAME_OID array. */
75 CSSM_APPLE_TP_NAME_OID
*subjectNames
, // size MAX_NAMES mallocd by caller
76 uint32
*numNames
); // RETURNED
79 * Free strings mallocd in getNameOids.
82 CSSM_APPLE_TP_NAME_OID
*subjectNames
,
85 /* get key size and algorithm for subject key */
87 CSSM_ALGORITHMS
&keyAlg
,
88 uint32
&keySizeInBits
);
90 /* given a signing key, obtain signing algorithm (int and oid format) */
92 const CSSM_KEY
*signingKey
,
93 CSSM_ALGORITHMS
&sigAlg
,
94 const CSSM_OID
* &sigOid
);
100 /* these are OR-able bitfields */
101 typedef unsigned CU_KeyUsage
;
102 #define kKeyUseSigning 0x01
103 #define kKeyUseEncrypting 0x02
105 CU_KeyUsage
getKeyUsage(bool isRoot
);
112 #endif /* _CREATECERT_CERT_UI_H_ */