Implement -description for X509Certificate
This commit is contained in:
parent
3b0fbe7868
commit
165ee6acca
2 changed files with 26 additions and 1 deletions
|
@ -23,6 +23,7 @@
|
||||||
#include <openssl/x509.h>
|
#include <openssl/x509.h>
|
||||||
|
|
||||||
#import <ObjFW/OFObject.h>
|
#import <ObjFW/OFObject.h>
|
||||||
|
#import <ObjFW/OFString.h>
|
||||||
@class OFDictionary;
|
@class OFDictionary;
|
||||||
|
|
||||||
/* OIDs: */
|
/* OIDs: */
|
||||||
|
@ -65,3 +66,6 @@
|
||||||
- (OFString*)X509_stringFromASN1Object: (ASN1_OBJECT*)obj;
|
- (OFString*)X509_stringFromASN1Object: (ASN1_OBJECT*)obj;
|
||||||
- (OFString*)X509_stringFromASN1String: (ASN1_STRING*)str;
|
- (OFString*)X509_stringFromASN1String: (ASN1_STRING*)str;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@interface X509OID: OFString {}
|
||||||
|
@end
|
||||||
|
|
|
@ -90,6 +90,18 @@
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (OFString*)description
|
||||||
|
{
|
||||||
|
OFMutableString *ret = nil;//[OFMutableString string];
|
||||||
|
|
||||||
|
[ret appendFormat: @"Issuer: %@\n\n", [self issuer]];
|
||||||
|
[ret appendFormat: @"Subject: %@\n\n", [self subject]];
|
||||||
|
[ret appendFormat: @"SANs: %@", [self subjectAlternativeName]];
|
||||||
|
|
||||||
|
[ret makeImmutable];
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
- (OFDictionary*)issuer
|
- (OFDictionary*)issuer
|
||||||
{
|
{
|
||||||
if (issuer == nil) {
|
if (issuer == nil) {
|
||||||
|
@ -383,7 +395,7 @@
|
||||||
[self resizeMemory: buf
|
[self resizeMemory: buf
|
||||||
toSize: buf_len];
|
toSize: buf_len];
|
||||||
}
|
}
|
||||||
ret = [OFString stringWithUTF8String: buf];
|
ret = [X509OID stringWithUTF8String: buf];
|
||||||
[self freeMemory: buf];
|
[self freeMemory: buf];
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -399,3 +411,12 @@
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@implementation X509OID
|
||||||
|
- (OFString*)description
|
||||||
|
{
|
||||||
|
char tmp[1024];
|
||||||
|
OBJ_obj2txt(tmp, sizeof(tmp), OBJ_txt2obj(s->cString, 1), 0);
|
||||||
|
return [OFString stringWithUTF8String: tmp];
|
||||||
|
}
|
||||||
|
@end
|
||||||
|
|
Reference in a new issue