Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 30 additions & 11 deletions ASN1Decoder/X509Certificate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -194,24 +194,43 @@ public class X509Certificate: CustomStringConvertible {
return block1[X509BlockPosition.dateValidity]?.sub(1)?.value as? Date
}

/// Gets the signature algorithm OID, which should contain the same OID as in
/// - See: RFC 5280 4.1.1.2
public var signatureAlgorithmOID: String? {
return asn1[0].sub(1)?.sub(0)?.value as? String
}

/// Gets the signature algorithm name, which should contain the same OID as in
/// - See: RFC 5280 4.1.1.2
public var signatureAlgorithmName: String? {
return OID.description(of: signatureAlgorithmOID ?? "")
}

/// Gets the signature algorithm parameters
/// - See: RFC 5280 4.1.1.2
public var signatureAlgorithmParams: Data? {
return asn1[0].sub(1)?.sub(1)?.rawValue
}

/// Gets the signature value (the raw signature bits) from the certificate.
public var signature: Data? {
public var signatureValue: Data? {
return asn1[0].sub(2)?.value as? Data
}

/// Gets the signature algorithm name for the certificate signature algorithm.
public var sigAlgName: String? {
return OID.description(of: sigAlgOID ?? "")
/// Gets the signature algorithm OID string from the inner tbs Certificate.
/// - See: RFC 5280 4.1.2.3
public var innerSignatureAlgorithmOID: String? {
return block1[X509BlockPosition.signatureAlg]?.sub(0)?.value as? String
}

/// Gets the signature algorithm OID string from the certificate.
public var sigAlgOID: String? {
return block1.sub(2)?.sub(0)?.value as? String
/// Gets the signature algorithm name for the inner tbs certificate signature algorithm.
public var innerSignatureAlgorithmName: String? {
return OID.description(of: innerSignatureAlgorithmOID ?? "")
}

/// Gets the DER-encoded signature algorithm parameters from this certificate's signature algorithm.
public var sigAlgParams: Data? {
return nil
/// Gets the DER-encoded signature algorithm parameters from this inner tbs certificate's signature algorithm.
public var innerSignatureAlgorithmParameters: Data? {
return block1[X509BlockPosition.signatureAlg]?.sub(1)?.rawValue
}

/**
Expand Down