diff --git a/SOPE/NGCards/NGVCard.h b/SOPE/NGCards/NGVCard.h index 9553da380..f070e7153 100644 --- a/SOPE/NGCards/NGVCard.h +++ b/SOPE/NGCards/NGVCard.h @@ -128,6 +128,8 @@ typedef enum - (NSArray *) categories; - (NSString *) photo; - (void) setPhoto: (NSString *) _value; +- (NSData *) certificate; +- (void) setCertificate: (NSData *) theCertificate; // - (void) setN: (NGVCardName *) _v; diff --git a/SOPE/NGCards/NGVCard.m b/SOPE/NGCards/NGVCard.m index 24f1f879e..48cc9d9a7 100644 --- a/SOPE/NGCards/NGVCard.m +++ b/SOPE/NGCards/NGVCard.m @@ -302,6 +302,27 @@ [photo setSingleValue: _value forKey: @""]; } +- (NSData *) certificate +{ + CardElement *key; + + key = [self uniqueChildWithTag: @"key"]; + return [[[key valuesAtIndex: 0 forKey: @""] objectAtIndex: 0] dataByDecodingBase64]; +} + +- (void) setCertificate: (NSData *) theCertificate +{ + CardElement *key; + NSString *value; + + value = [theCertificate stringByEncodingBase64]; + key = [self uniqueChildWithTag: @"key"]; + [key setValue: 0 ofAttribute: @"encoding" to: @"base64"]; + [key setValue: 0 ofAttribute: @"type" to: @"application/pkcs7-signature"]; + + [key setSingleValue: value forKey: @""]; +} + - (void) setOrg: (NSString *) anOrg units: (NSArray *) someUnits