PTX509Certificate
@interface PTX509Certificate : NSObject
This class represents an X509 public-key certificate, as specified in RFC 5280.
-
Constructor from filepath. The input must be in DER, BER, or PEM encoding. The certificate must be in X.509 format.
Declaration
Objective-C
- (instancetype)initWithIn_certificate_path:(NSString *)in_certificate_path;
Swift
init!(in_certificate_path: String!)
Parameters
in_certificate_path
– the path to the file containing the certificate
-
Undocumented
Declaration
Objective-C
- (instancetype)initWithIn_cert_buf: (NSData*)in_cert_buf;
Swift
init!(in_cert_buf: Data!)
-
Retrieves the names of the certificate issuer as a map of OIDs (i.e. one of the object identifiers from the X.500 attribute types) to string values. The issuer field identifies the entity that has signed and issued the certificate. The returned value will contain all of the AttributeTypeAndValue items from all of the RelativeDistinguishedNames in the Name of the issuer. See RFC 5280, section 4.1.2.4 and Appendix A.1 (page 116).
Declaration
Objective-C
- (PTX501DistinguishedName *)GetIssuerField;
Swift
func getIssuerField() -> PTX501DistinguishedName!
Return Value
an X501DistinguishedName object
-
Retrieves the names of the certificate subject as a map of OIDs (i.e. one of the
- object identifiers from the X.500 attribute types) to string values. The subject field
- represents the identity of the entity associated with the certificate’s public key. The
- returned value will contain all of the AttributeTypeAndValue items from all of the
- RelativeDistinguishedNames in the Name of the subject. See RFC 5280, section 4.1.2.6
- and Appendix A.1 (page 116). *
- - returns: an X501DistinguishedName object
Declaration
Objective-C
- (PTX501DistinguishedName *)GetSubjectField;
Swift
func getSubjectField() -> PTX501DistinguishedName!
-
Retrieves the notBefore time from the certificate’s Validity entry in the form of an integral value representing an epoch time.
Declaration
Objective-C
- (long long)GetNotBeforeEpochTime;
Swift
func getNotBeforeEpochTime() -> Int64
Return Value
an integer containing an epoch time
-
Retrieves the notAfter time from the certificate’s Validity entry in the form of an integral value representing an epoch time.
Declaration
Objective-C
- (long long)GetNotAfterEpochTime;
Swift
func getNotAfterEpochTime() -> Int64
Return Value
an integer containing an epoch time
-
Retrieves the version number representing which version of X509 the certificate corresponds to, from the certificate.
Note
The X509 version number in the certificate, which we return unchanged here, is zero-indexed and therefore is one less in value than the actual version. e.g. X509v3 is represented by a returned version number of 2.
Declaration
Objective-C
- (unsigned int)GetRawX509VersionNumber;
Swift
func getRawX509VersionNumber() -> UInt32
Return Value
an integer containing the version number
-
Returns a string representation of the certificate.
Note
Output may change in future versions.
Declaration
Objective-C
- (NSString *)ToString;
Swift
func toString() -> String!
Return Value
a string representation of the certificate.
-
Retrieves, in a string, a text representation of a cryptographically-secure digest of the certificate that can be used to identify it uniquely.
Note
Default algorithm parameter is currently SHA-256, but may change in future without further warning, pursuant to security needs.
Declaration
Objective-C
- (NSString *)GetFingerprint:(PTDigestAlgorithmType)in_digest_algorithm;
Swift
func getFingerprint(_ in_digest_algorithm: PTDigestAlgorithmType) -> String!
Parameters
in_digest_algorithm
An enumeration representing the digest algorithm to use. Currently supported are SHA-1 (SHA-160), SHA-256, SHA-384, and SHA-512.
Return Value
a string representation of the fingerprint, in the form of double ASCII characters representing hex bytes, separated by colons
-
Retrieves the serialNumber entry from the certificate.
Declaration
Objective-C
- (NSData *)GetSerialNumber;
Swift
func getSerialNumber() -> Data!
Return Value
a big-integer-style container holding bytes representing the components of an integral serial number in big-endian order.
-
Retrieves all extensions (as first specified in V3 of X509, see RFC 5280) from the certificate.
Declaration
Objective-C
- (NSArray<PTX509Extension *> *)GetExtensions;
Swift
func getExtensions() -> [PTX509Extension]!
Return Value
a container of X509Extension objects.
-
Retrieves the certificate as binary DER-encoded data. (DER is short for Distinguished Encoding Rules.).
Declaration
Objective-C
- (NSData *)GetData;
Swift
func getData() -> Data!
Return Value
a container of bytes representing the certificate, encoded as binary DER.