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