nss_sys/bindings/
keythi.rs

1/* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5use crate::*;
6use std::os::raw::{c_int, c_uchar, c_void};
7
8pub type SECKEYPublicKey = SECKEYPublicKeyStr;
9#[repr(C)]
10pub struct SECKEYPublicKeyStr {
11    pub arena: *mut PLArenaPool,
12    pub keyType: u32, /* KeyType */
13    pub pkcs11Slot: *mut PK11SlotInfo,
14    pub pkcs11ID: CK_OBJECT_HANDLE,
15    pub u: SECKEYPublicKeyStr_u,
16}
17
18#[repr(C)]
19pub union SECKEYPublicKeyStr_u {
20    pub rsa: SECKEYRSAPublicKey,
21    pub dsa: SECKEYDSAPublicKey,
22    pub dh: SECKEYDHPublicKey,
23    pub kea: SECKEYKEAPublicKey,
24    pub fortezza: SECKEYFortezzaPublicKey,
25    pub ec: SECKEYECPublicKey,
26}
27
28pub type SECKEYPrivateKey = SECKEYPrivateKeyStr;
29#[repr(C)]
30pub struct SECKEYPrivateKeyStr {
31    pub arena: *mut PLArenaPool,
32    pub keyType: u32, /* KeyType */
33    pub pkcs11Slot: *mut PK11SlotInfo,
34    pub pkcs11ID: CK_OBJECT_HANDLE,
35    pub pkcs11IsTemp: PRBool,
36    pub wincx: *mut c_void,
37    pub staticflags: PRUint32,
38}
39
40#[repr(u32)]
41pub enum KeyType {
42    nullKey = 0,
43    rsaKey = 1,
44    dsaKey = 2,
45    fortezzaKey = 3,
46    dhKey = 4,
47    keaKey = 5,
48    ecKey = 6,
49    rsaPssKey = 7,
50    rsaOaepKey = 8,
51}
52
53pub type SECKEYRSAPublicKey = SECKEYRSAPublicKeyStr;
54#[repr(C)]
55#[derive(Copy, Clone)]
56pub struct SECKEYRSAPublicKeyStr {
57    pub arena: *mut PLArenaPool,
58    pub modulus: SECItem,
59    pub publicExponent: SECItem,
60}
61
62pub type SECKEYDSAPublicKey = SECKEYDSAPublicKeyStr;
63#[repr(C)]
64#[derive(Copy, Clone)]
65pub struct SECKEYDSAPublicKeyStr {
66    pub params: SECKEYPQGParams,
67    pub publicValue: SECItem,
68}
69
70pub type SECKEYPQGParams = SECKEYPQGParamsStr;
71#[repr(C)]
72#[derive(Copy, Clone)]
73pub struct SECKEYPQGParamsStr {
74    pub arena: *mut PLArenaPool,
75    pub prime: SECItem,
76    pub subPrime: SECItem,
77    pub base: SECItem,
78}
79
80pub type SECKEYDHPublicKey = SECKEYDHPublicKeyStr;
81#[repr(C)]
82#[derive(Copy, Clone)]
83pub struct SECKEYDHPublicKeyStr {
84    pub arena: *mut PLArenaPool,
85    pub prime: SECItem,
86    pub base: SECItem,
87    pub publicValue: SECItem,
88}
89
90pub type SECKEYKEAPublicKey = SECKEYKEAPublicKeyStr;
91#[repr(C)]
92#[derive(Copy, Clone)]
93pub struct SECKEYKEAPublicKeyStr {
94    pub params: SECKEYKEAParams,
95    pub publicValue: SECItem,
96}
97
98pub type SECKEYKEAParams = SECKEYKEAParamsStr;
99#[repr(C)]
100#[derive(Copy, Clone)]
101pub struct SECKEYKEAParamsStr {
102    pub arena: *mut PLArenaPool,
103    pub hash: SECItem,
104}
105
106pub type SECKEYFortezzaPublicKey = SECKEYFortezzaPublicKeyStr;
107#[repr(C)]
108#[derive(Copy, Clone)]
109pub struct SECKEYFortezzaPublicKeyStr {
110    pub KEAversion: c_int,
111    pub DSSversion: c_int,
112    pub KMID: [c_uchar; 8usize],
113    pub clearance: SECItem,
114    pub KEApriviledge: SECItem,
115    pub DSSpriviledge: SECItem,
116    pub KEAKey: SECItem,
117    pub DSSKey: SECItem,
118    pub params: SECKEYPQGParams,
119    pub keaParams: SECKEYPQGParams,
120}
121
122pub type SECKEYECPublicKey = SECKEYECPublicKeyStr;
123#[repr(C)]
124#[derive(Copy, Clone)]
125pub struct SECKEYECPublicKeyStr {
126    pub DEREncodedParams: SECKEYECParams,
127    pub size: c_int,
128    pub publicValue: SECItem,
129    pub encoding: u32, /* ECPointEncoding */
130}
131
132pub type SECKEYECParams = SECItem;
133
134#[repr(u32)]
135#[derive(Copy, Clone)]
136pub enum ECPointEncoding {
137    ECPoint_Uncompressed = 0,
138    ECPoint_XOnly = 1,
139    ECPoint_Undefined = 2,
140}