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