]> git.saurik.com Git - apple/security.git/blob - OSX/sec/securityd/SecDbKeychainV7-protobufs/generated_source/SecDbKeychainSerializedSecretData.m
Security-59306.11.20.tar.gz
[apple/security.git] / OSX / sec / securityd / SecDbKeychainV7-protobufs / generated_source / SecDbKeychainSerializedSecretData.m
1 // This file was automatically generated by protocompiler
2 // DO NOT EDIT!
3 // Compiled from SecDbKeychainSerializedSecretData.proto
4
5 #import "SecDbKeychainSerializedSecretData.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 SecDbKeychainSerializedSecretData
15
16 @synthesize ciphertext = _ciphertext;
17 @synthesize wrappedKey = _wrappedKey;
18 @synthesize tamperCheck = _tamperCheck;
19 - (BOOL)hasSecDbBackupWrappedItemKey
20 {
21 return _secDbBackupWrappedItemKey != nil;
22 }
23 @synthesize secDbBackupWrappedItemKey = _secDbBackupWrappedItemKey;
24
25 - (NSString *)description
26 {
27 return [NSString stringWithFormat:@"%@ %@", [super description], [self dictionaryRepresentation]];
28 }
29
30 - (NSDictionary *)dictionaryRepresentation
31 {
32 NSMutableDictionary *dict = [NSMutableDictionary dictionary];
33 if (self->_ciphertext)
34 {
35 [dict setObject:self->_ciphertext forKey:@"ciphertext"];
36 }
37 if (self->_wrappedKey)
38 {
39 [dict setObject:self->_wrappedKey forKey:@"wrappedKey"];
40 }
41 if (self->_tamperCheck)
42 {
43 [dict setObject:self->_tamperCheck forKey:@"tamperCheck"];
44 }
45 if (self->_secDbBackupWrappedItemKey)
46 {
47 [dict setObject:self->_secDbBackupWrappedItemKey forKey:@"SecDbBackupWrappedItemKey"];
48 }
49 return dict;
50 }
51
52 BOOL SecDbKeychainSerializedSecretDataReadFrom(__unsafe_unretained SecDbKeychainSerializedSecretData *self, __unsafe_unretained PBDataReader *reader) {
53 while (PBReaderHasMoreData(reader)) {
54 uint32_t tag = 0;
55 uint8_t aType = 0;
56
57 PBReaderReadTag32AndType(reader, &tag, &aType);
58
59 if (PBReaderHasError(reader))
60 break;
61
62 if (aType == TYPE_END_GROUP) {
63 break;
64 }
65
66 switch (tag) {
67
68 case 1 /* ciphertext */:
69 {
70 NSData *new_ciphertext = PBReaderReadData(reader);
71 self->_ciphertext = new_ciphertext;
72 }
73 break;
74 case 2 /* wrappedKey */:
75 {
76 NSData *new_wrappedKey = PBReaderReadData(reader);
77 self->_wrappedKey = new_wrappedKey;
78 }
79 break;
80 case 3 /* tamperCheck */:
81 {
82 NSString *new_tamperCheck = PBReaderReadString(reader);
83 self->_tamperCheck = new_tamperCheck;
84 }
85 break;
86 case 4 /* secDbBackupWrappedItemKey */:
87 {
88 NSData *new_secDbBackupWrappedItemKey = PBReaderReadData(reader);
89 self->_secDbBackupWrappedItemKey = new_secDbBackupWrappedItemKey;
90 }
91 break;
92 default:
93 if (!PBReaderSkipValueWithTag(reader, tag, aType))
94 return NO;
95 break;
96 }
97 }
98 return !PBReaderHasError(reader);
99 }
100
101 - (BOOL)readFrom:(PBDataReader *)reader
102 {
103 return SecDbKeychainSerializedSecretDataReadFrom(self, reader);
104 }
105 - (void)writeTo:(PBDataWriter *)writer
106 {
107 /* ciphertext */
108 {
109 assert(nil != self->_ciphertext);
110 PBDataWriterWriteDataField(writer, self->_ciphertext, 1);
111 }
112 /* wrappedKey */
113 {
114 assert(nil != self->_wrappedKey);
115 PBDataWriterWriteDataField(writer, self->_wrappedKey, 2);
116 }
117 /* tamperCheck */
118 {
119 assert(nil != self->_tamperCheck);
120 PBDataWriterWriteStringField(writer, self->_tamperCheck, 3);
121 }
122 /* secDbBackupWrappedItemKey */
123 {
124 if (self->_secDbBackupWrappedItemKey)
125 {
126 PBDataWriterWriteDataField(writer, self->_secDbBackupWrappedItemKey, 4);
127 }
128 }
129 }
130
131 - (void)copyTo:(SecDbKeychainSerializedSecretData *)other
132 {
133 other.ciphertext = _ciphertext;
134 other.wrappedKey = _wrappedKey;
135 other.tamperCheck = _tamperCheck;
136 if (_secDbBackupWrappedItemKey)
137 {
138 other.secDbBackupWrappedItemKey = _secDbBackupWrappedItemKey;
139 }
140 }
141
142 - (id)copyWithZone:(NSZone *)zone
143 {
144 SecDbKeychainSerializedSecretData *copy = [[[self class] allocWithZone:zone] init];
145 copy->_ciphertext = [_ciphertext copyWithZone:zone];
146 copy->_wrappedKey = [_wrappedKey copyWithZone:zone];
147 copy->_tamperCheck = [_tamperCheck copyWithZone:zone];
148 copy->_secDbBackupWrappedItemKey = [_secDbBackupWrappedItemKey copyWithZone:zone];
149 return copy;
150 }
151
152 - (BOOL)isEqual:(id)object
153 {
154 SecDbKeychainSerializedSecretData *other = (SecDbKeychainSerializedSecretData *)object;
155 return [other isMemberOfClass:[self class]]
156 &&
157 ((!self->_ciphertext && !other->_ciphertext) || [self->_ciphertext isEqual:other->_ciphertext])
158 &&
159 ((!self->_wrappedKey && !other->_wrappedKey) || [self->_wrappedKey isEqual:other->_wrappedKey])
160 &&
161 ((!self->_tamperCheck && !other->_tamperCheck) || [self->_tamperCheck isEqual:other->_tamperCheck])
162 &&
163 ((!self->_secDbBackupWrappedItemKey && !other->_secDbBackupWrappedItemKey) || [self->_secDbBackupWrappedItemKey isEqual:other->_secDbBackupWrappedItemKey])
164 ;
165 }
166
167 - (NSUInteger)hash
168 {
169 return 0
170 ^
171 [self->_ciphertext hash]
172 ^
173 [self->_wrappedKey hash]
174 ^
175 [self->_tamperCheck hash]
176 ^
177 [self->_secDbBackupWrappedItemKey hash]
178 ;
179 }
180
181 - (void)mergeFrom:(SecDbKeychainSerializedSecretData *)other
182 {
183 if (other->_ciphertext)
184 {
185 [self setCiphertext:other->_ciphertext];
186 }
187 if (other->_wrappedKey)
188 {
189 [self setWrappedKey:other->_wrappedKey];
190 }
191 if (other->_tamperCheck)
192 {
193 [self setTamperCheck:other->_tamperCheck];
194 }
195 if (other->_secDbBackupWrappedItemKey)
196 {
197 [self setSecDbBackupWrappedItemKey:other->_secDbBackupWrappedItemKey];
198 }
199 }
200
201 @end
202