2019-06-29 23:09:24 +02:00
|
|
|
//
|
2019-07-02 20:20:56 +02:00
|
|
|
// CryptographicKeys.swift
|
2019-06-29 23:09:24 +02:00
|
|
|
// passKit
|
|
|
|
|
//
|
|
|
|
|
// Created by Danny Moesch on 29.06.19.
|
|
|
|
|
// Copyright © 2019 Bob Sun. All rights reserved.
|
|
|
|
|
//
|
|
|
|
|
|
2019-07-02 20:20:56 +02:00
|
|
|
public protocol CryptographicKey {
|
|
|
|
|
func getKeychainKey() -> String
|
|
|
|
|
func getFileSharingPath() -> String
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-28 02:57:11 +01:00
|
|
|
public enum PGPKey: CryptographicKey {
|
2019-06-29 23:09:24 +02:00
|
|
|
case PUBLIC
|
|
|
|
|
case PRIVATE
|
|
|
|
|
|
|
|
|
|
public func getKeychainKey() -> String {
|
|
|
|
|
switch self {
|
|
|
|
|
case .PUBLIC:
|
|
|
|
|
return "pgpPublicKey"
|
|
|
|
|
case .PRIVATE:
|
|
|
|
|
return "pgpPrivateKey"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-07-02 20:20:56 +02:00
|
|
|
public func getFileSharingPath() -> String {
|
2019-06-29 23:09:24 +02:00
|
|
|
switch self {
|
|
|
|
|
case .PUBLIC:
|
|
|
|
|
return Globals.iTunesFileSharingPGPPublic
|
|
|
|
|
case .PRIVATE:
|
|
|
|
|
return Globals.iTunesFileSharingPGPPrivate
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-07-02 20:20:56 +02:00
|
|
|
|
2021-12-28 02:57:11 +01:00
|
|
|
public enum SSHKey: CryptographicKey {
|
2019-07-02 20:28:47 +02:00
|
|
|
case PRIVATE
|
|
|
|
|
|
|
|
|
|
public func getKeychainKey() -> String {
|
|
|
|
|
switch self {
|
|
|
|
|
case .PRIVATE:
|
|
|
|
|
return "sshPrivateKey"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public func getFileSharingPath() -> String {
|
|
|
|
|
switch self {
|
|
|
|
|
case .PRIVATE:
|
|
|
|
|
return Globals.iTunesFileSharingSSHPrivate
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|