]>
git.saurik.com Git - apple/security.git/blob - SecurityTests/clxutils/ocspTool/ocspUtils.cpp
4 #include <utilLib/cspwrap.h>
5 #include <Security/SecKey.h>
6 #include <Security/SecKeyPriv.h>
10 * Sign some data with an identity.
15 CSSM_ALGORITHMS algId
, // RSA/SHA1, DSA/SHA1
16 CSSM_DATA
&sig
) // caller must APP_FREE()
18 const CSSM_KEY
*privCssmKey
;
21 CSSM_CSP_HANDLE cspHand
;
24 ortn
= SecIdentityCopyPrivateKey(idRef
, &privKeyRef
);
26 cssmPerror("SecIdentityCopyPrivateKey", ortn
);
29 ortn
= SecKeyGetCSSMKey(privKeyRef
, &privCssmKey
);
31 cssmPerror("SecKeyGetCSSMKey", ortn
);
34 ortn
= SecKeyGetCSPHandle(privKeyRef
, &cspHand
);
36 cssmPerror("SecKeyGetCSPHandle", ortn
);
41 crtn
= cspSign(cspHand
, algId
, (CSSM_KEY_PTR
)privCssmKey
,
44 cssmPerror("cspSign", crtn
);
48 CFRelease(privKeyRef
);