(feat) add KEY support for certificate handling

This commit is contained in:
Ludovic Marcotte
2017-12-23 04:31:43 -05:00
parent 8afa87e953
commit 6c993be9f1
2 changed files with 23 additions and 0 deletions
+2
View File
@@ -128,6 +128,8 @@ typedef enum
- (NSArray *) categories;
- (NSString *) photo;
- (void) setPhoto: (NSString *) _value;
- (NSData *) certificate;
- (void) setCertificate: (NSData *) theCertificate;
// - (void) setN: (NGVCardName *) _v;
+21
View File
@@ -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