Skip to content
Open
Show file tree
Hide file tree
Changes from 5 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
4 changes: 2 additions & 2 deletions ASN1Decoder/ASN1Decoder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,8 @@ enum ASN1Error: Error {
}

extension Data {
func toIntValue() -> UInt64? {
if self.count > 8 { // check if suitable for UInt64
public func toIntValue() -> UInt64? {
if self.count > 8 || self.isEmpty { // check if suitable for UInt64
return nil
}

Expand Down
4 changes: 2 additions & 2 deletions ASN1Decoder/ASN1Object.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ public class ASN1Object: CustomStringConvertible {

public var identifier: ASN1Identifier?

var sub: [ASN1Object]?
public internal(set) var sub: [ASN1Object]?

weak var parent: ASN1Object?
public internal(set) weak var parent: ASN1Object?
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those changes come from #32 on which this PR is based on.


public func sub(_ index: Int) -> ASN1Object? {
if let sub = self.sub, index >= 0, index < sub.count {
Expand Down
2 changes: 1 addition & 1 deletion ASN1Decoder/OID.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public enum OID: String {
case md5WithRSAEncryption = "1.2.840.113549.1.1.4"
case sha1WithRSAEncryption = "1.2.840.113549.1.1.5"

//Digest algorithms
// Digest algorithms
case sha1 = "1.3.14.3.2.26"
case pkcsSha256 = "1.3.6.1.4.1.22554.1.2.1"
case sha2Family = "1.3.6.1.4.1.22554.1.2"
Expand Down
2 changes: 1 addition & 1 deletion ASN1Decoder/PKCS7_Signature.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import Foundation

extension PKCS7 {
public var signatures: [SignatureInfo]? {
//Signer infos sequence. https://tools.ietf.org/html/rfc5652#section-5.3
// Signer infos sequence. https://tools.ietf.org/html/rfc5652#section-5.3

guard let signerInfos = mainBlock.sub(4) else {return nil}

Expand Down