Skip to content
This repository was archived by the owner on Apr 13, 2026. It is now read-only.

Commit ba66c92

Browse files
committed
Replace cdoc with libcdoc
Signed-off-by: Raul Metsma <raul@metsma.ee>
1 parent ddd7a19 commit ba66c92

55 files changed

Lines changed: 582 additions & 1107 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ jobs:
9999
- name: Set up Homebrew
100100
id: set-up-homebrew
101101
uses: Homebrew/actions/setup-homebrew@master
102-
- name: Install Swift-sh
103-
run: brew install swift-sh
102+
- name: Install Swift-sh and FlatBuffers
103+
run: brew install swift-sh flatbuffers
104104
- name: Build and Archive
105105
env:
106106
APP_PROVISIONING_PROFILE_UUID: ${{ secrets.APP_PROVISIONING_PROFILE_UUID }}

.github/workflows/codeql.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ jobs:
2626
with:
2727
submodules: recursive
2828

29+
- name: Install FlatBuffers
30+
run: brew install flatbuffers
31+
2932
# Creating sample files needed to build, but not needed for CodeQL.
3033
# .plist files need a sample structure to avoid error: "unable to read input file as a property list"
3134
- name: Create sample files

CryptoLib/CryptoLib.xcodeproj/project.pbxproj

Lines changed: 32 additions & 75 deletions
Large diffs are not rendered by default.

CryptoLib/CryptoLib/Addressee.h

Lines changed: 0 additions & 32 deletions
This file was deleted.

CryptoLib/CryptoLib/Addressee.m

Lines changed: 0 additions & 28 deletions
This file was deleted.
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
//
2+
// Addressee.swift
3+
// CryptoLib
4+
/*
5+
* Copyright 2017 - 2024 Riigi Infosüsteemi Amet
6+
*
7+
* This library is free software; you can redistribute it and/or
8+
* modify it under the terms of the GNU Lesser General Public
9+
* License as published by the Free Software Foundation; either
10+
* version 2.1 of the License, or (at your option) any later version.
11+
*
12+
* This library is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15+
* Lesser General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU Lesser General Public
18+
* License along with this library; if not, write to the Free Software
19+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20+
*
21+
*/
22+
23+
import ASN1Decoder
24+
25+
public class Addressee: NSObject {
26+
@objc public var data: Data
27+
public let identifier: String
28+
public let givenName: String?
29+
public let surname: String?
30+
public let certType: CertType
31+
public var validTo: Date?
32+
33+
@objc public init(cn: String, certType: CertType, validTo: Date?, data: Data) {
34+
let split = cn.split(separator: ",").map { String($0) }
35+
if split.count > 1 {
36+
surname = split[0]
37+
givenName = split[1]
38+
identifier = split[2]
39+
} else {
40+
surname = nil
41+
givenName = nil
42+
identifier = cn
43+
}
44+
self.certType = certType
45+
self.validTo = validTo
46+
self.data = data
47+
}
48+
49+
@objc convenience public init(cn: String, pub: Data) {
50+
self.init(cn: cn, certType: .UnknownType, validTo: nil, data: pub)
51+
}
52+
53+
convenience init(cert: Data) {
54+
let x509 = try? X509Certificate(der: cert)
55+
self.init(cn: x509?.subject(oid: .commonName)?.joined(separator: ",") ?? "", certType: x509?.certType() ?? .UnknownType, validTo: x509?.notAfter, data: cert)
56+
}
57+
58+
public override func isEqual(_ object: Any?) -> Bool {
59+
guard let other = object as? Addressee else { return false }
60+
return
61+
data == other.data &&
62+
identifier == other.identifier &&
63+
givenName == other.givenName &&
64+
surname == other.surname &&
65+
certType == other.certType &&
66+
validTo == other.validTo
67+
}
68+
}

CryptoLib/CryptoLib/CdocInfo.h

Lines changed: 0 additions & 31 deletions
This file was deleted.

CryptoLib/CryptoLib/CdocInfo.m

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)