cbaker6 / CertificateSigningRequest

@@ -44,6 +44,7 @@
Loading
44 44
    private let objectOrganizationName: [UInt8] = [0x06, 0x03, 0x55, 0x04, 0x0A]
45 45
    private let objectOrganizationalUnitName: [UInt8] = [0x06, 0x03, 0x55, 0x04, 0x0B]
46 46
    private let objectStateOrProvinceName: [UInt8] = [0x06, 0x03, 0x55, 0x04, 0x08]
47 +
    private let objectSerialNumber: [UInt8] = [0x06, 0x03, 0x55, 0x04, 0x05]
47 48
    private let sequenceTag: UInt8 = 0x30
48 49
    private let setTag: UInt8 = 0x31
49 50
    private let commonName: String?
@@ -54,19 +55,21 @@
Loading
54 55
    private let organizationName: String?
55 56
    private let organizationUnitName: String?
56 57
    private let stateOrProvinceName: String?
58 +
    private let serialNumber: String?
57 59
    private var keyAlgorithm: KeyAlgorithm!
58 60
    private var subjectDER: Data?
59 61
60 62
    public init(commonName: String? = nil, organizationName: String? = nil,
61 63
                organizationUnitName: String? = nil, countryName: String? = nil,
62 64
                stateOrProvinceName: String? = nil, localityName: String? = nil,
63 -
                emailAddress: String? = nil, description: String? = nil,
64 -
                keyAlgorithm: KeyAlgorithm) {
65 +
                serialNumber: String? = nil, emailAddress: String? = nil,
66 +
                description: String? = nil, keyAlgorithm: KeyAlgorithm) {
65 67
        self.commonName = commonName
66 68
        self.organizationName = organizationName
67 69
        self.organizationUnitName = organizationUnitName
68 70
        self.countryName = countryName
69 71
        self.stateOrProvinceName = stateOrProvinceName
72 +
        self.serialNumber = serialNumber
70 73
        self.localityName = localityName
71 74
        self.emailAddress = emailAddress
72 75
        self.csrDescription = description
@@ -77,13 +80,13 @@
Loading
77 80
    public convenience override init() {
78 81
        self.init(commonName: nil, organizationName: nil, organizationUnitName: nil,
79 82
                  countryName: nil, stateOrProvinceName: nil, localityName: nil,
80 -
                  keyAlgorithm: KeyAlgorithm.rsa(signatureType: .sha512))
83 +
                  serialNumber: nil, keyAlgorithm: KeyAlgorithm.rsa(signatureType: .sha512))
81 84
    }
82 85
83 86
    public convenience init(keyAlgorithm: KeyAlgorithm) {
84 87
        self.init(commonName: nil, organizationName: nil, organizationUnitName: nil,
85 88
                  countryName: nil, stateOrProvinceName: nil, localityName: nil,
86 -
                  keyAlgorithm: keyAlgorithm)
89 +
                  serialNumber: nil, keyAlgorithm: keyAlgorithm)
87 90
    }
88 91
89 92
    public func build(_ publicKeyBits: Data, privateKey: SecKey, publicKey: SecKey?=nil) -> Data? {
@@ -214,6 +217,10 @@
Loading
214 217
        if let description = csrDescription {
215 218
            appendSubjectItem(objectDescription, value: description, into: &subject)
216 219
        }
220 +
        
221 +
        if let serialNumber = serialNumber {
222 +
            appendSubjectItem(objectSerialNumber, value: serialNumber, into: &subject)
223 +
        }
217 224
218 225
        enclose(&subject, by: sequenceTag)// Enclose into SEQUENCE
219 226
        subjectDER = subject
Files Coverage
Sources/CertificateSigningRequest 91.94%
Project Totals (2 files) 91.94%
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading