mirror of
https://github.com/maxgoedjen/secretive.git
synced 2026-03-05 09:24:49 +01:00
Secure enclave implementation
This commit is contained in:
24
SecretAgentKit/Info.plist
Normal file
24
SecretAgentKit/Info.plist
Normal file
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>$(CURRENT_PROJECT_VERSION)</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>Copyright © 2020 Max Goedjen. All rights reserved.</string>
|
||||
</dict>
|
||||
</plist>
|
||||
25
SecretAgentKit/OpenSSHReader.swift
Normal file
25
SecretAgentKit/OpenSSHReader.swift
Normal file
@@ -0,0 +1,25 @@
|
||||
import Foundation
|
||||
|
||||
public class OpenSSHReader {
|
||||
|
||||
var remaining: Data
|
||||
|
||||
public init(data: Data) {
|
||||
remaining = Data(data)
|
||||
}
|
||||
|
||||
public func readNextChunk() throws -> Data {
|
||||
let lengthRange = 0..<(UInt32.bitWidth/8)
|
||||
let lengthChunk = remaining[lengthRange]
|
||||
remaining.removeSubrange(lengthRange)
|
||||
let littleEndianLength = lengthChunk.withUnsafeBytes { pointer in
|
||||
return pointer.load(as: UInt32.self)
|
||||
}
|
||||
let length = Int(littleEndianLength.bigEndian)
|
||||
let dataRange = 0..<length
|
||||
let ret = Data(remaining[dataRange])
|
||||
remaining.removeSubrange(dataRange)
|
||||
return ret
|
||||
}
|
||||
|
||||
}
|
||||
38
SecretAgentKit/SSHAgentProtocol.swift
Normal file
38
SecretAgentKit/SSHAgentProtocol.swift
Normal file
@@ -0,0 +1,38 @@
|
||||
import Foundation
|
||||
|
||||
public enum SSHAgent {}
|
||||
|
||||
extension SSHAgent {
|
||||
|
||||
public enum RequestType: UInt8, CustomDebugStringConvertible {
|
||||
case requestIdentities = 11
|
||||
case signRequest = 13
|
||||
|
||||
public var debugDescription: String {
|
||||
switch self {
|
||||
case .requestIdentities:
|
||||
return "RequestIdentities"
|
||||
default:
|
||||
return "SignRequest"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum ResponseType: UInt8, CustomDebugStringConvertible {
|
||||
case agentFailure = 5
|
||||
case agentIdentitiesAnswer = 12
|
||||
case agentSignResponse = 14
|
||||
|
||||
public var debugDescription: String {
|
||||
switch self {
|
||||
case .agentFailure:
|
||||
return "AgentFailure"
|
||||
case .agentIdentitiesAnswer:
|
||||
return "AgentIdentitiesAnswer"
|
||||
case .agentSignResponse:
|
||||
return "AgentSignResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
19
SecretAgentKit/SecretAgentKit.h
Normal file
19
SecretAgentKit/SecretAgentKit.h
Normal file
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// SecretAgentKit.h
|
||||
// SecretAgentKit
|
||||
//
|
||||
// Created by Max Goedjen on 2/22/20.
|
||||
// Copyright © 2020 Max Goedjen. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
//! Project version number for SecretAgentKit.
|
||||
FOUNDATION_EXPORT double SecretAgentKitVersionNumber;
|
||||
|
||||
//! Project version string for SecretAgentKit.
|
||||
FOUNDATION_EXPORT const unsigned char SecretAgentKitVersionString[];
|
||||
|
||||
// In this header, you should import all the public headers of your framework using statements like #import <SecretAgentKit/PublicHeader.h>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user