1Tspi_Context_UnregisTtCeGrKSeoyf(t3w)are Stack Developer'sTRsepfie_rCeonncteext_UnregisterKey(3)
2
3
4
6 Tspi_Context_UnregisterKey - unregister a key from the persistent stor‐
7 age device.
8
10 #include <tss/platform.h>
11 #include <tss/tcpa_defines.h>
12 #include <tss/tcpa_typedef.h>
13 #include <tss/tcpa_struct.h>
14 #include <tss/tss_typedef.h>
15 #include <tss/tss_structs.h>
16 #include <tss/tspi.h>
17
18 TSS_RESULT Tspi_Context_UnregisterKey(TSS_HCONTEXT hContext, TSS_FLAG persistentStorageType,
19 TSS_UUID uuidKey, TSS_HKEY* phKey);
20
21
22
24 TSS_Context_UnregisterKey provides the capabilities of the TSS Core
25 Service or TSS Service Provider
26
28 hContext
29 The handle of the context object.
30
31 persistentStorageType
32 Flag indicating the persistent storage.
33
34 uuidKey
35 The UUID of the key to be removed from the persistent storage.
36
37 phKey
38 Recieves the handle of a key object containing the information from the
39 archive.
40
41 pulRespDataLength
42 Recieves the length (in bytes) of the prgbRespData parameter.
43
44 prgbRespData
45 On successful completion of the command, this parameter points to the
46 buffer containing the actual data of the specified capability. The
47 handle of the object to be destroyed
48
49
51 Tspi_Context_UnregisterKey returns TSS_SUCCESS on success, otherwise
52 one of the following values are returned:
53
54 TSS_E_INVALID_HANDLE - the parameter hContext is an invalid parameter.
55
56 TSS_E_PS_KEY_NOTFOUND - the parameter uuidKey is an invalid UUID.
57
58 TSS_E_INTERNAL_ERROR - An error occurred internal to the TSS.
59
61 #include <trousers/tss.h>
62
63 int
64 main(void)
65 {
66 TSS_FLAGS initFlags = ...;
67 TSS_HKEY hKey, hSRK;
68 TSS_UUID keyUUID = {...};
69
70 // Create a TSP handle
71 result = Tspi_Context_Create(&hContext);
72 if (result != TSS_SUCCESS)
73 Error_Path();
74
75 // Connect to the TCSD
76 result = Tspi_Context_Connect(hContext, GLOBALSERVER);
77 if (result != TSS_SUCCESS)
78 Error_Path();
79
80 // Create the Key Object
81 result = Tspi_Context_CreateObject(hContext,
82 TSS_OBJECT_TYPE_RSAKEY,
83 initFlags, &hKey);
84 if (result != TSS_SUCCESS)
85 Error_Path();
86
87 // Load parent Key by UUID
88 result = Tspi_Context_LoadKeyByUUID(hContext, TSS_PS_TYPE_SYSTEM,
89 SRK_UUID, &hSRK);
90 if (result != TSS_SUCCESS)
91 Error_Path();
92
93 // Do policy/secret handling here
94
95 result = Tspi_Key_CreateKey(hKey, hSRK, 0);
96 if (result != TSS_SUCCESS)
97 Error_Path();
98
99 // Register the Key in System PS (on the TCSD's platform)
100 result = Tspi_Context_RegisterKey(hContext, hKey, TSS_PS_TYPE_SYSTEM,
101 keyUUID, TSS_PS_TYPE_SYSTEM,
102 SRK_UUID);
103 if (result != TSS_SUCCESS)
104 Error_Path();
105
106 /* ...
107 *
108 * Use the key as needed, exiting the program if necessary, reloading
109 * the key using Tspi_Context_LoadKeyByUUID() after each restart. Once
110 * the key is no longer useful, unregister it from system PS as part
111 * of clean up.
112 */
113
114 // Unregister the Key
115 result = Tspi_Context_UnregisterKey(hContext, TSS_PS_TYPE_SYSTEM,
116 migratableSignUUID, &hKey);
117 if (result != TSS_SUCCESS)
118 Error_Path();
119
120 // exit, discarding hKey
121 }
122
123
125 Tspi_Context_UnregisterKey conforms to the Trusted Computing Group
126 Software Specification version 1.1 Golden
127
129 Tspi_Key_CreateKey(3), Tspi_Context_RegisterKey(3).
130
131
132
133TSS 1.1 2004-05-26 Tspi_Context_UnregisterKey(3)