]> git.saurik.com Git - apple/security.git/blob - OSX/sec/securityd/SecDbBackupManager-protobufs/generated_source/SecDbBackupKeyClassSigningKey.m
Security-59306.11.20.tar.gz
[apple/security.git] / OSX / sec / securityd / SecDbBackupManager-protobufs / generated_source / SecDbBackupKeyClassSigningKey.m
1 // This file was automatically generated by protocompiler
2 // DO NOT EDIT!
3 // Compiled from SecDbBackupRecoverySet.proto
4
5 #import "SecDbBackupKeyClassSigningKey.h"
6 #import <ProtocolBuffer/PBConstants.h>
7 #import <ProtocolBuffer/PBHashUtil.h>
8 #import <ProtocolBuffer/PBDataReader.h>
9
10 #if !__has_feature(objc_arc)
11 # error This generated file depends on ARC but it is not enabled; turn on ARC, or use 'objc_use_arc' option to generate non-ARC code.
12 #endif
13
14 @implementation SecDbBackupKeyClassSigningKey
15
16 @synthesize keyClass = _keyClass;
17 - (void)setKeyClass:(int32_t)v
18 {
19 _has.keyClass = YES;
20 _keyClass = v;
21 }
22 - (void)setHasKeyClass:(BOOL)f
23 {
24 _has.keyClass = f;
25 }
26 - (BOOL)hasKeyClass
27 {
28 return _has.keyClass;
29 }
30 - (BOOL)hasPublicKey
31 {
32 return _publicKey != nil;
33 }
34 @synthesize publicKey = _publicKey;
35 - (BOOL)hasAksRefKey
36 {
37 return _aksRefKey != nil;
38 }
39 @synthesize aksRefKey = _aksRefKey;
40 - (BOOL)hasAksWrappedKey
41 {
42 return _aksWrappedKey != nil;
43 }
44 @synthesize aksWrappedKey = _aksWrappedKey;
45 - (BOOL)hasBackupWrappedKey
46 {
47 return _backupWrappedKey != nil;
48 }
49 @synthesize backupWrappedKey = _backupWrappedKey;
50
51 - (NSString *)description
52 {
53 return [NSString stringWithFormat:@"%@ %@", [super description], [self dictionaryRepresentation]];
54 }
55
56 - (NSDictionary *)dictionaryRepresentation
57 {
58 NSMutableDictionary *dict = [NSMutableDictionary dictionary];
59 if (self->_has.keyClass)
60 {
61 [dict setObject:[NSNumber numberWithInt:self->_keyClass] forKey:@"keyClass"];
62 }
63 if (self->_publicKey)
64 {
65 [dict setObject:self->_publicKey forKey:@"publicKey"];
66 }
67 if (self->_aksRefKey)
68 {
69 [dict setObject:self->_aksRefKey forKey:@"aksRefKey"];
70 }
71 if (self->_aksWrappedKey)
72 {
73 [dict setObject:self->_aksWrappedKey forKey:@"aksWrappedKey"];
74 }
75 if (self->_backupWrappedKey)
76 {
77 [dict setObject:self->_backupWrappedKey forKey:@"backupWrappedKey"];
78 }
79 return dict;
80 }
81
82 BOOL SecDbBackupKeyClassSigningKeyReadFrom(__unsafe_unretained SecDbBackupKeyClassSigningKey *self, __unsafe_unretained PBDataReader *reader) {
83 while (PBReaderHasMoreData(reader)) {
84 uint32_t tag = 0;
85 uint8_t aType = 0;
86
87 PBReaderReadTag32AndType(reader, &tag, &aType);
88
89 if (PBReaderHasError(reader))
90 break;
91
92 if (aType == TYPE_END_GROUP) {
93 break;
94 }
95
96 switch (tag) {
97
98 case 1 /* keyClass */:
99 {
100 self->_has.keyClass = YES;
101 self->_keyClass = PBReaderReadInt32(reader);
102 }
103 break;
104 case 3 /* publicKey */:
105 {
106 NSData *new_publicKey = PBReaderReadData(reader);
107 self->_publicKey = new_publicKey;
108 }
109 break;
110 case 4 /* aksRefKey */:
111 {
112 NSData *new_aksRefKey = PBReaderReadData(reader);
113 self->_aksRefKey = new_aksRefKey;
114 }
115 break;
116 case 5 /* aksWrappedKey */:
117 {
118 NSData *new_aksWrappedKey = PBReaderReadData(reader);
119 self->_aksWrappedKey = new_aksWrappedKey;
120 }
121 break;
122 case 6 /* backupWrappedKey */:
123 {
124 NSData *new_backupWrappedKey = PBReaderReadData(reader);
125 self->_backupWrappedKey = new_backupWrappedKey;
126 }
127 break;
128 default:
129 if (!PBReaderSkipValueWithTag(reader, tag, aType))
130 return NO;
131 break;
132 }
133 }
134 return !PBReaderHasError(reader);
135 }
136
137 - (BOOL)readFrom:(PBDataReader *)reader
138 {
139 return SecDbBackupKeyClassSigningKeyReadFrom(self, reader);
140 }
141 - (void)writeTo:(PBDataWriter *)writer
142 {
143 /* keyClass */
144 {
145 if (self->_has.keyClass)
146 {
147 PBDataWriterWriteInt32Field(writer, self->_keyClass, 1);
148 }
149 }
150 /* publicKey */
151 {
152 if (self->_publicKey)
153 {
154 PBDataWriterWriteDataField(writer, self->_publicKey, 3);
155 }
156 }
157 /* aksRefKey */
158 {
159 if (self->_aksRefKey)
160 {
161 PBDataWriterWriteDataField(writer, self->_aksRefKey, 4);
162 }
163 }
164 /* aksWrappedKey */
165 {
166 if (self->_aksWrappedKey)
167 {
168 PBDataWriterWriteDataField(writer, self->_aksWrappedKey, 5);
169 }
170 }
171 /* backupWrappedKey */
172 {
173 if (self->_backupWrappedKey)
174 {
175 PBDataWriterWriteDataField(writer, self->_backupWrappedKey, 6);
176 }
177 }
178 }
179
180 - (void)copyTo:(SecDbBackupKeyClassSigningKey *)other
181 {
182 if (self->_has.keyClass)
183 {
184 other->_keyClass = _keyClass;
185 other->_has.keyClass = YES;
186 }
187 if (_publicKey)
188 {
189 other.publicKey = _publicKey;
190 }
191 if (_aksRefKey)
192 {
193 other.aksRefKey = _aksRefKey;
194 }
195 if (_aksWrappedKey)
196 {
197 other.aksWrappedKey = _aksWrappedKey;
198 }
199 if (_backupWrappedKey)
200 {
201 other.backupWrappedKey = _backupWrappedKey;
202 }
203 }
204
205 - (id)copyWithZone:(NSZone *)zone
206 {
207 SecDbBackupKeyClassSigningKey *copy = [[[self class] allocWithZone:zone] init];
208 if (self->_has.keyClass)
209 {
210 copy->_keyClass = _keyClass;
211 copy->_has.keyClass = YES;
212 }
213 copy->_publicKey = [_publicKey copyWithZone:zone];
214 copy->_aksRefKey = [_aksRefKey copyWithZone:zone];
215 copy->_aksWrappedKey = [_aksWrappedKey copyWithZone:zone];
216 copy->_backupWrappedKey = [_backupWrappedKey copyWithZone:zone];
217 return copy;
218 }
219
220 - (BOOL)isEqual:(id)object
221 {
222 SecDbBackupKeyClassSigningKey *other = (SecDbBackupKeyClassSigningKey *)object;
223 return [other isMemberOfClass:[self class]]
224 &&
225 ((self->_has.keyClass && other->_has.keyClass && self->_keyClass == other->_keyClass) || (!self->_has.keyClass && !other->_has.keyClass))
226 &&
227 ((!self->_publicKey && !other->_publicKey) || [self->_publicKey isEqual:other->_publicKey])
228 &&
229 ((!self->_aksRefKey && !other->_aksRefKey) || [self->_aksRefKey isEqual:other->_aksRefKey])
230 &&
231 ((!self->_aksWrappedKey && !other->_aksWrappedKey) || [self->_aksWrappedKey isEqual:other->_aksWrappedKey])
232 &&
233 ((!self->_backupWrappedKey && !other->_backupWrappedKey) || [self->_backupWrappedKey isEqual:other->_backupWrappedKey])
234 ;
235 }
236
237 - (NSUInteger)hash
238 {
239 return 0
240 ^
241 (self->_has.keyClass ? PBHashInt((NSUInteger)self->_keyClass) : 0)
242 ^
243 [self->_publicKey hash]
244 ^
245 [self->_aksRefKey hash]
246 ^
247 [self->_aksWrappedKey hash]
248 ^
249 [self->_backupWrappedKey hash]
250 ;
251 }
252
253 - (void)mergeFrom:(SecDbBackupKeyClassSigningKey *)other
254 {
255 if (other->_has.keyClass)
256 {
257 self->_keyClass = other->_keyClass;
258 self->_has.keyClass = YES;
259 }
260 if (other->_publicKey)
261 {
262 [self setPublicKey:other->_publicKey];
263 }
264 if (other->_aksRefKey)
265 {
266 [self setAksRefKey:other->_aksRefKey];
267 }
268 if (other->_aksWrappedKey)
269 {
270 [self setAksWrappedKey:other->_aksWrappedKey];
271 }
272 if (other->_backupWrappedKey)
273 {
274 [self setBackupWrappedKey:other->_backupWrappedKey];
275 }
276 }
277
278 @end
279