mirror of
https://github.com/ProtonMail/protoncore_ios.git
synced 2026-01-11 19:56:33 +00:00
chore(crypto): Remove the multiversion crypto lib builds
The default builds contain the v3 API from now.
This commit is contained in:
parent
5378d11919
commit
aa22fbcb66
130 changed files with 3 additions and 19489 deletions
|
|
@ -1071,62 +1071,6 @@
|
|||
ReferencedContainer = "container:">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "GoLibsCryptoMultiversionGo"
|
||||
BuildableName = "GoLibsCryptoMultiversionGo"
|
||||
BlueprintName = "GoLibsCryptoMultiversionGo"
|
||||
ReferencedContainer = "container:">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "GoLibsCryptoMultiversionPatchedGo"
|
||||
BuildableName = "GoLibsCryptoMultiversionPatchedGo"
|
||||
BlueprintName = "GoLibsCryptoMultiversionPatchedGo"
|
||||
ReferencedContainer = "container:">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "ProtonCoreCryptoMultiversionGoImplementation"
|
||||
BuildableName = "ProtonCoreCryptoMultiversionGoImplementation"
|
||||
BlueprintName = "ProtonCoreCryptoMultiversionGoImplementation"
|
||||
ReferencedContainer = "container:">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "ProtonCoreCryptoMultiversionPatchedGoImplementation"
|
||||
BuildableName = "ProtonCoreCryptoMultiversionPatchedGoImplementation"
|
||||
BlueprintName = "ProtonCoreCryptoMultiversionPatchedGoImplementation"
|
||||
ReferencedContainer = "container:">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
|
|
@ -1756,26 +1700,6 @@
|
|||
ReferencedContainer = "container:">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "ProtonCoreCryptoMultiversionGoImplementationTests"
|
||||
BuildableName = "ProtonCoreCryptoMultiversionGoImplementationTests"
|
||||
BlueprintName = "ProtonCoreCryptoMultiversionGoImplementationTests"
|
||||
ReferencedContainer = "container:">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "ProtonCoreCryptoMultiversionPatchedGoImplementationTests"
|
||||
BuildableName = "ProtonCoreCryptoMultiversionPatchedGoImplementationTests"
|
||||
BlueprintName = "ProtonCoreCryptoMultiversionPatchedGoImplementationTests"
|
||||
ReferencedContainer = "container:">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
|
|
|
|||
|
|
@ -31,8 +31,6 @@ func products(from newProduct: String) -> [Product] {
|
|||
.goLibsCryptoSearchGo,
|
||||
.goLibsCryptoPatchedGo,
|
||||
.goLibsCryptoVPNPatchedGo,
|
||||
.goLibsCryptoMultiversionGo,
|
||||
.goLibsCryptoMultiversionPatchedGo,
|
||||
.vCard
|
||||
]
|
||||
|
||||
|
|
@ -122,8 +120,6 @@ extension String {
|
|||
static let cryptoPatchedGoImplementation: String = "ProtonCoreCryptoPatchedGoImplementation"
|
||||
static let cryptoVPNPatchedGoImplementation: String = "ProtonCoreCryptoVPNPatchedGoImplementation"
|
||||
static let cryptoSearchGoImplementation: String = "ProtonCoreCryptoSearchGoImplementation"
|
||||
static let cryptoMultiversionGoImplementation: String = "ProtonCoreCryptoMultiversionGoImplementation"
|
||||
static let cryptoMultiversionPatchedGoImplementation: String = "ProtonCoreCryptoMultiversionPatchedGoImplementation"
|
||||
static let dataModel: String = "ProtonCoreDataModel"
|
||||
static let doh: String = "ProtonCoreDoh"
|
||||
static let environment: String = "ProtonCoreEnvironment"
|
||||
|
|
@ -135,8 +131,6 @@ extension String {
|
|||
static let goLibsCryptoPatchedGo: String = "GoLibsCryptoPatchedGo"
|
||||
static let goLibsCryptoVPNPatchedGo: String = "GoLibsCryptoVPNPatchedGo"
|
||||
static let goLibsCryptoSearchGo: String = "GoLibsCryptoSearchGo"
|
||||
static let goLibsCryptoMultiversionGo: String = "GoLibsCryptoMultiversionGo"
|
||||
static let goLibsCryptoMultiversionPatchedGo: String = "GoLibsCryptoMultiversionPatchedGo"
|
||||
static let hash: String = "ProtonCoreHash"
|
||||
static let humanVerification: String = "ProtonCoreHumanVerification"
|
||||
static let humanVerificationResourcesiOS: String = "ProtonCoreHumanVerificationResourcesiOS"
|
||||
|
|
@ -245,8 +239,6 @@ extension Target.Dependency {
|
|||
static var cryptoPatchedGoImplementation: Target.Dependency { .target(name: .cryptoPatchedGoImplementation) }
|
||||
static var cryptoVPNPatchedGoImplementation: Target.Dependency { .target(name: .cryptoVPNPatchedGoImplementation) }
|
||||
static var cryptoSearchGoImplementation: Target.Dependency { .target(name: .cryptoSearchGoImplementation) }
|
||||
static var cryptoMultiversionGoImplementation: Target.Dependency { .target(name: .cryptoMultiversionGoImplementation) }
|
||||
static var cryptoMultiversionPatchedGoImplementation: Target.Dependency { .target(name: .cryptoMultiversionPatchedGoImplementation) }
|
||||
static var dataModel: Target.Dependency { .target(name: .dataModel) }
|
||||
static var doh: Target.Dependency { .target(name: .doh) }
|
||||
static var environment: Target.Dependency { .target(name: .environment) }
|
||||
|
|
@ -258,8 +250,6 @@ extension Target.Dependency {
|
|||
static var goLibsCryptoPatchedGo: Target.Dependency { .target(name: .goLibsCryptoPatchedGo) }
|
||||
static var goLibsCryptoVPNPatchedGo: Target.Dependency { .target(name: .goLibsCryptoVPNPatchedGo) }
|
||||
static var goLibsCryptoSearchGo: Target.Dependency { .target(name: .goLibsCryptoSearchGo) }
|
||||
static var goLibsCryptoMultiversionGo: Target.Dependency { .target(name: .goLibsCryptoMultiversionGo) }
|
||||
static var goLibsCryptoMultiversionPatchedGo: Target.Dependency { .target(name: .goLibsCryptoMultiversionPatchedGo) }
|
||||
static var hash: Target.Dependency { .target(name: .hash) }
|
||||
static var humanVerification: Target.Dependency { .target(name: .humanVerification) }
|
||||
static var humanVerificationResourcesiOS: Target.Dependency { .target(name: .humanVerificationResourcesiOS,
|
||||
|
|
@ -626,9 +616,7 @@ add(
|
|||
.cryptoGoImplementation,
|
||||
.cryptoPatchedGoImplementation,
|
||||
.cryptoVPNPatchedGoImplementation,
|
||||
.cryptoSearchGoImplementation,
|
||||
.cryptoMultiversionGoImplementation,
|
||||
.cryptoMultiversionPatchedGoImplementation,
|
||||
.cryptoSearchGoImplementation
|
||||
],
|
||||
targets: [
|
||||
coreTarget(name: .cryptoGoImplementation,
|
||||
|
|
@ -659,20 +647,6 @@ add(
|
|||
],
|
||||
path: "libraries/CryptoGoImplementation/Crypto+Search-Go"),
|
||||
|
||||
coreTarget(name: .cryptoMultiversionGoImplementation,
|
||||
dependencies: [
|
||||
.goLibsCryptoMultiversionGo,
|
||||
.cryptoGoInterface
|
||||
],
|
||||
path: "libraries/CryptoGoImplementation/Crypto+multiversion-Go"),
|
||||
|
||||
coreTarget(name: .cryptoMultiversionPatchedGoImplementation,
|
||||
dependencies: [
|
||||
.goLibsCryptoMultiversionPatchedGo,
|
||||
.cryptoGoInterface
|
||||
],
|
||||
path: "libraries/CryptoGoImplementation/Crypto+multiversion-patched-Go"),
|
||||
|
||||
coreTestTarget(name: .cryptoGoImplementation + "Tests",
|
||||
dependencies: [
|
||||
.goLibsCryptoGo,
|
||||
|
|
@ -703,23 +677,7 @@ add(
|
|||
.cryptoSearchGoImplementation,
|
||||
.cryptoGoInterface
|
||||
],
|
||||
path: "libraries/CryptoGoImplementation/Tests-Crypto+Search-Go"),
|
||||
|
||||
coreTestTarget(name: .cryptoMultiversionGoImplementation + "Tests",
|
||||
dependencies: [
|
||||
.goLibsCryptoMultiversionGo,
|
||||
.cryptoMultiversionGoImplementation,
|
||||
.cryptoGoInterface
|
||||
],
|
||||
path: "libraries/CryptoGoImplementation/Tests-Crypto+multiversion-Go"),
|
||||
|
||||
coreTestTarget(name: .cryptoMultiversionPatchedGoImplementation + "Tests",
|
||||
dependencies: [
|
||||
.goLibsCryptoMultiversionPatchedGo,
|
||||
.cryptoMultiversionPatchedGoImplementation,
|
||||
.cryptoGoInterface
|
||||
],
|
||||
path: "libraries/CryptoGoImplementation/Tests-Crypto+multiversion-patched-Go")
|
||||
path: "libraries/CryptoGoImplementation/Tests-Crypto+Search-Go")
|
||||
]
|
||||
)
|
||||
|
||||
|
|
@ -911,17 +869,13 @@ add(
|
|||
.goLibsCryptoGo,
|
||||
.goLibsCryptoPatchedGo,
|
||||
.goLibsCryptoVPNPatchedGo,
|
||||
.goLibsCryptoSearchGo,
|
||||
.goLibsCryptoMultiversionGo,
|
||||
.goLibsCryptoMultiversionPatchedGo,
|
||||
.goLibsCryptoSearchGo
|
||||
],
|
||||
targets: [
|
||||
.binaryTarget(name: .goLibsCryptoGo, path: "vendor/Crypto-Go/GoLibs.xcframework"),
|
||||
.binaryTarget(name: .goLibsCryptoPatchedGo, path: "vendor/Crypto-patched-Go/GoLibs.xcframework"),
|
||||
.binaryTarget(name: .goLibsCryptoVPNPatchedGo, path: "vendor/Crypto+VPN-patched-Go/GoLibs.xcframework"),
|
||||
.binaryTarget(name: .goLibsCryptoSearchGo, path: "vendor/Crypto+Search-Go/GoLibs.xcframework"),
|
||||
.binaryTarget(name: .goLibsCryptoMultiversionGo, path: "vendor/Crypto+multiversion-Go/GoLibs.xcframework"),
|
||||
.binaryTarget(name: .goLibsCryptoMultiversionPatchedGo, path: "vendor/Crypto+multiversion-patched-Go/GoLibs.xcframework"),
|
||||
]
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,76 +0,0 @@
|
|||
<?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>AvailableLibraries</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>BinaryPath</key>
|
||||
<string>GoLibs.framework/Versions/A/GoLibs</string>
|
||||
<key>LibraryIdentifier</key>
|
||||
<string>ios-arm64_x86_64-maccatalyst</string>
|
||||
<key>LibraryPath</key>
|
||||
<string>GoLibs.framework</string>
|
||||
<key>SupportedArchitectures</key>
|
||||
<array>
|
||||
<string>arm64</string>
|
||||
<string>x86_64</string>
|
||||
</array>
|
||||
<key>SupportedPlatform</key>
|
||||
<string>ios</string>
|
||||
<key>SupportedPlatformVariant</key>
|
||||
<string>maccatalyst</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>BinaryPath</key>
|
||||
<string>GoLibs.framework/GoLibs</string>
|
||||
<key>LibraryIdentifier</key>
|
||||
<string>ios-arm64_x86_64-simulator</string>
|
||||
<key>LibraryPath</key>
|
||||
<string>GoLibs.framework</string>
|
||||
<key>SupportedArchitectures</key>
|
||||
<array>
|
||||
<string>arm64</string>
|
||||
<string>x86_64</string>
|
||||
</array>
|
||||
<key>SupportedPlatform</key>
|
||||
<string>ios</string>
|
||||
<key>SupportedPlatformVariant</key>
|
||||
<string>simulator</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>BinaryPath</key>
|
||||
<string>GoLibs.framework/Versions/A/GoLibs</string>
|
||||
<key>LibraryIdentifier</key>
|
||||
<string>macos-arm64_x86_64</string>
|
||||
<key>LibraryPath</key>
|
||||
<string>GoLibs.framework</string>
|
||||
<key>SupportedArchitectures</key>
|
||||
<array>
|
||||
<string>arm64</string>
|
||||
<string>x86_64</string>
|
||||
</array>
|
||||
<key>SupportedPlatform</key>
|
||||
<string>macos</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>BinaryPath</key>
|
||||
<string>GoLibs.framework/GoLibs</string>
|
||||
<key>LibraryIdentifier</key>
|
||||
<string>ios-arm64</string>
|
||||
<key>LibraryPath</key>
|
||||
<string>GoLibs.framework</string>
|
||||
<key>SupportedArchitectures</key>
|
||||
<array>
|
||||
<string>arm64</string>
|
||||
</array>
|
||||
<key>SupportedPlatform</key>
|
||||
<string>ios</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>XFWK</string>
|
||||
<key>XCFrameworkFormatVersion</key>
|
||||
<string>1.0</string>
|
||||
</dict>
|
||||
</plist>
|
||||
Binary file not shown.
|
|
@ -1,39 +0,0 @@
|
|||
// Objective-C API for talking to github.com/ProtonMail/gopenpgp/v2/armor Go package.
|
||||
// gobind -lang=objc github.com/ProtonMail/gopenpgp/v2/armor
|
||||
//
|
||||
// File is generated by gobind. Do not edit.
|
||||
|
||||
#ifndef __Armor_H__
|
||||
#define __Armor_H__
|
||||
|
||||
@import Foundation;
|
||||
#include "ref.h"
|
||||
#include "Universe.objc.h"
|
||||
|
||||
#include "Constants.objc.h"
|
||||
|
||||
/**
|
||||
* ArmorKey armors input as a public key.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull ArmorArmorKey(NSData* _Nullable input, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* ArmorWithType armors input with the given armorType.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull ArmorArmorWithType(NSData* _Nullable input, NSString* _Nullable armorType, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* ArmorWithTypeAndCustomHeaders armors input with the given armorType and
|
||||
headers.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull ArmorArmorWithTypeAndCustomHeaders(NSData* _Nullable input, NSString* _Nullable armorType, NSString* _Nullable version, NSString* _Nullable comment, NSError* _Nullable* _Nullable error);
|
||||
|
||||
// skipped function ArmorWithTypeBuffered with unsupported parameter or return types
|
||||
|
||||
|
||||
/**
|
||||
* Unarmor unarmors an armored input into a byte array.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable ArmorUnarmor(NSString* _Nullable input, NSError* _Nullable* _Nullable error);
|
||||
|
||||
#endif
|
||||
|
|
@ -1,72 +0,0 @@
|
|||
// Objective-C API for talking to github.com/ProtonMail/gopenpgp/v2/constants Go package.
|
||||
// gobind -lang=objc github.com/ProtonMail/gopenpgp/v2/constants
|
||||
//
|
||||
// File is generated by gobind. Do not edit.
|
||||
|
||||
#ifndef __Constants_H__
|
||||
#define __Constants_H__
|
||||
|
||||
@import Foundation;
|
||||
#include "ref.h"
|
||||
#include "Universe.objc.h"
|
||||
|
||||
|
||||
/**
|
||||
* Cipher suite names.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsAES128;
|
||||
/**
|
||||
* Cipher suite names.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsAES192;
|
||||
/**
|
||||
* Cipher suite names.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsAES256;
|
||||
/**
|
||||
* Constants for armored data.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsArmorHeaderComment;
|
||||
/**
|
||||
* Constants for armored data.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsArmorHeaderVersion;
|
||||
/**
|
||||
* Cipher suite names.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsCAST5;
|
||||
FOUNDATION_EXPORT const int64_t ConstantsDefaultCompression;
|
||||
FOUNDATION_EXPORT const int64_t ConstantsDefaultCompressionLevel;
|
||||
/**
|
||||
* Constants for armored data.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsPGPMessageHeader;
|
||||
/**
|
||||
* Constants for armored data.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsPGPSignatureHeader;
|
||||
/**
|
||||
* Constants for armored data.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsPrivateKeyHeader;
|
||||
/**
|
||||
* Constants for armored data.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsPublicKeyHeader;
|
||||
FOUNDATION_EXPORT const long ConstantsSIGNATURE_BAD_CONTEXT;
|
||||
FOUNDATION_EXPORT const long ConstantsSIGNATURE_FAILED;
|
||||
FOUNDATION_EXPORT const long ConstantsSIGNATURE_NOT_SIGNED;
|
||||
FOUNDATION_EXPORT const long ConstantsSIGNATURE_NO_VERIFIER;
|
||||
FOUNDATION_EXPORT const long ConstantsSIGNATURE_OK;
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsSignatureContextName;
|
||||
/**
|
||||
* Cipher suite names.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsThreeDES;
|
||||
/**
|
||||
* Cipher suite names.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsTripleDES;
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsVersion;
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,25 +0,0 @@
|
|||
|
||||
// Objective-C API for talking to the following Go packages
|
||||
//
|
||||
// github.com/ProtonMail/gopenpgp/v2/crypto
|
||||
// github.com/ProtonMail/gopenpgp/v2/armor
|
||||
// github.com/ProtonMail/gopenpgp/v2/constants
|
||||
// github.com/ProtonMail/gopenpgp/v2/models
|
||||
// github.com/ProtonMail/gopenpgp/v2/subtle
|
||||
// github.com/ProtonMail/gopenpgp/v2/helper
|
||||
// github.com/ProtonMail/go-srp
|
||||
//
|
||||
// File is generated by gomobile bind. Do not edit.
|
||||
#ifndef __GoLibs_FRAMEWORK_H__
|
||||
#define __GoLibs_FRAMEWORK_H__
|
||||
|
||||
#include "Crypto.objc.h"
|
||||
#include "Armor.objc.h"
|
||||
#include "Constants.objc.h"
|
||||
#include "Models.objc.h"
|
||||
#include "Subtle.objc.h"
|
||||
#include "Helper.objc.h"
|
||||
#include "Srp.objc.h"
|
||||
#include "Universe.objc.h"
|
||||
|
||||
#endif
|
||||
|
|
@ -1,481 +0,0 @@
|
|||
// Objective-C API for talking to github.com/ProtonMail/gopenpgp/v2/helper Go package.
|
||||
// gobind -lang=objc github.com/ProtonMail/gopenpgp/v2/helper
|
||||
//
|
||||
// File is generated by gobind. Do not edit.
|
||||
|
||||
#ifndef __Helper_H__
|
||||
#define __Helper_H__
|
||||
|
||||
@import Foundation;
|
||||
#include "ref.h"
|
||||
#include "Universe.objc.h"
|
||||
|
||||
#include "Crypto.objc.h"
|
||||
|
||||
@class HelperEncryptSignArmoredDetachedMobileResult;
|
||||
@class HelperEncryptSignBinaryDetachedMobileResult;
|
||||
@class HelperExplicitVerifyMessage;
|
||||
@class HelperGo2AndroidReader;
|
||||
@class HelperGo2IOSReader;
|
||||
@class HelperMobile2GoReader;
|
||||
@class HelperMobile2GoWriter;
|
||||
@class HelperMobile2GoWriterWithSHA256;
|
||||
@class HelperMobileReadResult;
|
||||
@protocol HelperMobileReader;
|
||||
@class HelperMobileReader;
|
||||
|
||||
@protocol HelperMobileReader <NSObject>
|
||||
- (HelperMobileReadResult* _Nullable)read:(long)max error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
@interface HelperEncryptSignArmoredDetachedMobileResult : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) NSString* _Nonnull ciphertextArmored;
|
||||
@property (nonatomic) NSString* _Nonnull encryptedSignatureArmored;
|
||||
@end
|
||||
|
||||
@interface HelperEncryptSignBinaryDetachedMobileResult : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) NSData* _Nullable encryptedData;
|
||||
@property (nonatomic) NSString* _Nonnull encryptedSignatureArmored;
|
||||
@end
|
||||
|
||||
@interface HelperExplicitVerifyMessage : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) CryptoPlainMessage* _Nullable message;
|
||||
@property (nonatomic) CryptoSignatureVerificationError* _Nullable signatureVerificationError;
|
||||
@end
|
||||
|
||||
/**
|
||||
* Go2AndroidReader is used to wrap a native golang Reader in the golang runtime,
|
||||
to be usable in the android app runtime (via gomobile).
|
||||
*/
|
||||
@interface HelperGo2AndroidReader : NSObject <goSeqRefInterface, CryptoReader> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
/**
|
||||
* NewGo2AndroidReader wraps a native golang Reader to be usable in the mobile app runtime (via gomobile).
|
||||
It doesn't follow the standard golang Reader behavior, and returns n = -1 on EOF.
|
||||
*/
|
||||
- (nullable instancetype)init:(id<CryptoReader> _Nullable)reader;
|
||||
/**
|
||||
* Read reads bytes into the provided buffer and returns the number of bytes read
|
||||
It doesn't follow the standard golang Reader behavior, and returns n = -1 on EOF.
|
||||
*/
|
||||
- (BOOL)read:(NSData* _Nullable)b n:(long* _Nullable)n error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
/**
|
||||
* Go2IOSReader is used to wrap a native golang Reader in the golang runtime,
|
||||
to be usable in the iOS app runtime (via gomobile) as a MobileReader.
|
||||
*/
|
||||
@interface HelperGo2IOSReader : NSObject <goSeqRefInterface, HelperMobileReader> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
/**
|
||||
* NewGo2IOSReader wraps a native golang Reader to be usable in the ios app runtime (via gomobile).
|
||||
*/
|
||||
- (nullable instancetype)init:(id<CryptoReader> _Nullable)reader;
|
||||
/**
|
||||
* Read reads at most <max> bytes from the wrapped Reader and returns the read data as a MobileReadResult.
|
||||
*/
|
||||
- (HelperMobileReadResult* _Nullable)read:(long)max error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
/**
|
||||
* Mobile2GoReader is used to wrap a MobileReader in the mobile app runtime,
|
||||
to be usable in the golang runtime (via gomobile) as a native Reader.
|
||||
*/
|
||||
@interface HelperMobile2GoReader : NSObject <goSeqRefInterface, CryptoReader> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
/**
|
||||
* NewMobile2GoReader wraps a MobileReader to be usable in the golang runtime (via gomobile).
|
||||
*/
|
||||
- (nullable instancetype)init:(id<HelperMobileReader> _Nullable)reader;
|
||||
/**
|
||||
* Read reads data from the wrapped MobileReader and copies the read data in the provided buffer.
|
||||
It also handles the conversion of EOF to an error.
|
||||
*/
|
||||
- (BOOL)read:(NSData* _Nullable)b n:(long* _Nullable)n error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
/**
|
||||
* Mobile2GoWriter is used to wrap a writer in the mobile app runtime,
|
||||
to be usable in the golang runtime (via gomobile).
|
||||
*/
|
||||
@interface HelperMobile2GoWriter : NSObject <goSeqRefInterface, CryptoWriter> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
/**
|
||||
* NewMobile2GoWriter wraps a writer to be usable in the golang runtime (via gomobile).
|
||||
*/
|
||||
- (nullable instancetype)init:(id<CryptoWriter> _Nullable)writer;
|
||||
/**
|
||||
* Write writes the data in the provided buffer in the wrapped writer.
|
||||
It clones the provided data to prevent errors with garbage collectors.
|
||||
*/
|
||||
- (BOOL)write:(NSData* _Nullable)b n:(long* _Nullable)n error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
/**
|
||||
* Mobile2GoWriterWithSHA256 is used to wrap a writer in the mobile app runtime,
|
||||
to be usable in the golang runtime (via gomobile).
|
||||
It also computes the SHA256 hash of the data being written on the fly.
|
||||
*/
|
||||
@interface HelperMobile2GoWriterWithSHA256 : NSObject <goSeqRefInterface, CryptoWriter> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
/**
|
||||
* NewMobile2GoWriterWithSHA256 wraps a writer to be usable in the golang runtime (via gomobile).
|
||||
The wrapper also computes the SHA256 hash of the data being written on the fly.
|
||||
*/
|
||||
- (nullable instancetype)init:(id<CryptoWriter> _Nullable)writer;
|
||||
/**
|
||||
* GetSHA256 returns the SHA256 hash of the data that's been written so far.
|
||||
*/
|
||||
- (NSData* _Nullable)getSHA256;
|
||||
/**
|
||||
* Write writes the data in the provided buffer in the wrapped writer.
|
||||
It clones the provided data to prevent errors with garbage collectors.
|
||||
It also computes the SHA256 hash of the data being written on the fly.
|
||||
*/
|
||||
- (BOOL)write:(NSData* _Nullable)b n:(long* _Nullable)n error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
/**
|
||||
* MobileReadResult is what needs to be returned by MobileReader.Read.
|
||||
The read data is passed as a return value rather than passed as an argument to the reader.
|
||||
This avoids problems introduced by gomobile that prevent the use of native golang readers.
|
||||
*/
|
||||
@interface HelperMobileReadResult : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
/**
|
||||
* NewMobileReadResult initialize a MobileReadResult with the correct values.
|
||||
It clones the data to avoid the garbage collector freeing the data too early.
|
||||
*/
|
||||
- (nullable instancetype)init:(long)n eof:(BOOL)eof data:(NSData* _Nullable)data;
|
||||
@property (nonatomic) long n;
|
||||
@property (nonatomic) BOOL isEOF;
|
||||
@property (nonatomic) NSData* _Nullable data;
|
||||
@end
|
||||
|
||||
FOUNDATION_EXPORT const int64_t HelperAES_BLOCK_SIZE;
|
||||
|
||||
/**
|
||||
* DecryptAttachment takes a keypacket and datpacket
|
||||
and returns a decrypted PlainMessage
|
||||
Specifically designed for attachments rather than text messages.
|
||||
*/
|
||||
FOUNDATION_EXPORT CryptoPlainMessage* _Nullable HelperDecryptAttachment(NSData* _Nullable keyPacket, NSData* _Nullable dataPacket, CryptoKeyRing* _Nullable keyRing, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptAttachmentWithKey decrypts a binary file
|
||||
Using a given armored private key and its passphrase.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable HelperDecryptAttachmentWithKey(NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSData* _Nullable keyPacket, NSData* _Nullable dataPacket, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptBinaryMessageArmored decrypts an armored PGP message given a private key
|
||||
and its passphrase.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable HelperDecryptBinaryMessageArmored(NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSString* _Nullable ciphertext, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptExplicitVerify decrypts a PGP message given a private keyring
|
||||
and a public keyring to verify the embedded signature. Returns the plain
|
||||
data and an error on signature verification failure.
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperExplicitVerifyMessage* _Nullable HelperDecryptExplicitVerify(CryptoPGPMessage* _Nullable pgpMessage, CryptoKeyRing* _Nullable privateKeyRing, CryptoKeyRing* _Nullable publicKeyRing, int64_t verifyTime, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptExplicitVerifyWithContext decrypts a PGP message given a private keyring
|
||||
and a public keyring to verify the embedded signature. Returns the plain
|
||||
data and an error on signature verification failure.
|
||||
The caller can provide a context that will be used to verify the signature.
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperExplicitVerifyMessage* _Nullable HelperDecryptExplicitVerifyWithContext(CryptoPGPMessage* _Nullable pgpMessage, CryptoKeyRing* _Nullable privateKeyRing, CryptoKeyRing* _Nullable publicKeyRing, int64_t verifyTime, CryptoVerificationContext* _Nullable verificationContext, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptMessageArmored decrypts an armored PGP message given a private key
|
||||
and its passphrase.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperDecryptMessageArmored(NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSString* _Nullable ciphertext, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptMessageWithPassword decrypts an armored message with a random token.
|
||||
The algorithm is derived from the armoring.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperDecryptMessageWithPassword(NSData* _Nullable password, NSString* _Nullable ciphertext, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptSessionKey decrypts a session key
|
||||
using a given armored private key
|
||||
and its passphrase.
|
||||
*/
|
||||
FOUNDATION_EXPORT CryptoSessionKey* _Nullable HelperDecryptSessionKey(NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSData* _Nullable encryptedSessionKey, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptSessionKeyExplicitVerify decrypts a PGP data packet given a session key
|
||||
and a public keyring to verify the embedded signature. Returns the plain data and
|
||||
an error on signature verification failure.
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperExplicitVerifyMessage* _Nullable HelperDecryptSessionKeyExplicitVerify(NSData* _Nullable dataPacket, CryptoSessionKey* _Nullable sessionKey, CryptoKeyRing* _Nullable publicKeyRing, int64_t verifyTime, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptSessionKeyExplicitVerifyWithContext decrypts a PGP data packet given a session key
|
||||
and a public keyring to verify the embedded signature. Returns the plain data and
|
||||
an error on signature verification failure.
|
||||
The caller can provide a context that will be used to verify the signature.
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperExplicitVerifyMessage* _Nullable HelperDecryptSessionKeyExplicitVerifyWithContext(NSData* _Nullable dataPacket, CryptoSessionKey* _Nullable sessionKey, CryptoKeyRing* _Nullable publicKeyRing, int64_t verifyTime, CryptoVerificationContext* _Nullable verificationContext, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptVerifyArmoredDetached decrypts an armored pgp message
|
||||
and verify a detached armored encrypted signature
|
||||
given a publicKey, and a privateKey with its passphrase.
|
||||
Returns the plain data or an error on
|
||||
signature verification failure.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable HelperDecryptVerifyArmoredDetached(NSString* _Nullable publicKey, NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSString* _Nullable ciphertextArmored, NSString* _Nullable encryptedSignatureArmored, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptVerifyAttachment decrypts and verifies an attachment split into the
|
||||
keyPacket, dataPacket and an armored (!) signature, given a publicKey, and a
|
||||
privateKey with its passphrase. Returns the plain data or an error on
|
||||
signature verification failure.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable HelperDecryptVerifyAttachment(NSString* _Nullable publicKey, NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSData* _Nullable keyPacket, NSData* _Nullable dataPacket, NSString* _Nullable armoredSignature, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptVerifyBinaryDetached decrypts binary encrypted data
|
||||
and verify a detached armored encrypted signature
|
||||
given a publicKey, and a privateKey with its passphrase.
|
||||
Returns the plain data or an error on
|
||||
signature verification failure.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable HelperDecryptVerifyBinaryDetached(NSString* _Nullable publicKey, NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSData* _Nullable encryptedData, NSString* _Nullable encryptedSignatureArmored, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptVerifyMessageArmored decrypts an armored PGP message given a private
|
||||
key and its passphrase and verifies the embedded signature. Returns the
|
||||
plain data or an error on signature verification failure.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperDecryptVerifyMessageArmored(NSString* _Nullable publicKey, NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSString* _Nullable ciphertext, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptAttachment encrypts a file given a plainData and a fileName.
|
||||
Returns a PGPSplitMessage containing a session key packet and symmetrically
|
||||
encrypted data. Specifically designed for attachments rather than text
|
||||
messages.
|
||||
*/
|
||||
FOUNDATION_EXPORT CryptoPGPSplitMessage* _Nullable HelperEncryptAttachment(NSData* _Nullable plainData, NSString* _Nullable filename, CryptoKeyRing* _Nullable keyRing, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptAttachmentWithKey encrypts a binary file
|
||||
Using a given armored public key.
|
||||
*/
|
||||
FOUNDATION_EXPORT CryptoPGPSplitMessage* _Nullable HelperEncryptAttachmentWithKey(NSString* _Nullable publicKey, NSString* _Nullable filename, NSData* _Nullable plainData, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptBinaryMessageArmored generates an armored PGP message given a binary data and
|
||||
an armored public key.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperEncryptBinaryMessageArmored(NSString* _Nullable key, NSData* _Nullable data, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptMessageArmored generates an armored PGP message given a plaintext and
|
||||
an armored public key.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperEncryptMessageArmored(NSString* _Nullable key, NSString* _Nullable plaintext, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptMessageWithPassword encrypts a string with a passphrase using AES256.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperEncryptMessageWithPassword(NSData* _Nullable password, NSString* _Nullable plaintext, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptPGPMessageToAdditionalKey decrypts the session key of the input PGPSplitMessage with a private key in keyRing
|
||||
and encrypts it towards the additionalKeys by adding the additional key packets to the input PGPSplitMessage.
|
||||
If successful, new key packets are added to message.
|
||||
* messageToModify : The encrypted pgp message that should be modified
|
||||
* keyRing : The private keys to decrypt the session key in the messageToModify.
|
||||
* additionalKey : The public keys the message should be additionally encrypted to.
|
||||
*/
|
||||
FOUNDATION_EXPORT BOOL HelperEncryptPGPMessageToAdditionalKey(CryptoPGPSplitMessage* _Nullable messageToModify, CryptoKeyRing* _Nullable keyRing, CryptoKeyRing* _Nullable additionalKey, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptSessionKey encrypts a session key
|
||||
using a given armored public key.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable HelperEncryptSessionKey(NSString* _Nullable publicKey, CryptoSessionKey* _Nullable sessionKey, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptSignArmoredDetachedMobile wraps the encryptSignArmoredDetached method
|
||||
to have only one return argument for mobile.
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperEncryptSignArmoredDetachedMobileResult* _Nullable HelperEncryptSignArmoredDetachedMobile(NSString* _Nullable publicKey, NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSData* _Nullable plainData, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptSignBinaryDetachedMobile wraps the encryptSignBinaryDetached method
|
||||
to have only one return argument for mobile.
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperEncryptSignBinaryDetachedMobileResult* _Nullable HelperEncryptSignBinaryDetachedMobile(NSString* _Nullable publicKey, NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSData* _Nullable plainData, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptSignMessageArmored generates an armored signed PGP message given a
|
||||
plaintext and an armored public key a private key and its passphrase.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperEncryptSignMessageArmored(NSString* _Nullable publicKey, NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSString* _Nullable plaintext, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* FreeOSMemory can be used to explicitly
|
||||
call the garbage collector and
|
||||
return the unused memory to the OS.
|
||||
*/
|
||||
FOUNDATION_EXPORT void HelperFreeOSMemory(void);
|
||||
|
||||
/**
|
||||
* GenerateKey generates a key of the given keyType ("rsa" or "x25519"), encrypts it, and returns an armored string.
|
||||
If keyType is "rsa", bits is the RSA bitsize of the key.
|
||||
If keyType is "x25519" bits is unused.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperGenerateKey(NSString* _Nullable name, NSString* _Nullable email, NSData* _Nullable passphrase, NSString* _Nullable keyType, long bits, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* GetJsonSHA256Fingerprints returns the SHA256 fingeprints of key and subkeys,
|
||||
encoded in JSON, since gomobile can not handle arrays.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable HelperGetJsonSHA256Fingerprints(NSString* _Nullable publicKey, NSError* _Nullable* _Nullable error);
|
||||
|
||||
// skipped function GetSHA256Fingerprints with unsupported parameter or return types
|
||||
|
||||
|
||||
/**
|
||||
* NewGo2AndroidReader wraps a native golang Reader to be usable in the mobile app runtime (via gomobile).
|
||||
It doesn't follow the standard golang Reader behavior, and returns n = -1 on EOF.
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperGo2AndroidReader* _Nullable HelperNewGo2AndroidReader(id<CryptoReader> _Nullable reader);
|
||||
|
||||
/**
|
||||
* NewGo2IOSReader wraps a native golang Reader to be usable in the ios app runtime (via gomobile).
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperGo2IOSReader* _Nullable HelperNewGo2IOSReader(id<CryptoReader> _Nullable reader);
|
||||
|
||||
/**
|
||||
* NewMobile2GoReader wraps a MobileReader to be usable in the golang runtime (via gomobile).
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperMobile2GoReader* _Nullable HelperNewMobile2GoReader(id<HelperMobileReader> _Nullable reader);
|
||||
|
||||
/**
|
||||
* NewMobile2GoWriter wraps a writer to be usable in the golang runtime (via gomobile).
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperMobile2GoWriter* _Nullable HelperNewMobile2GoWriter(id<CryptoWriter> _Nullable writer);
|
||||
|
||||
/**
|
||||
* NewMobile2GoWriterWithSHA256 wraps a writer to be usable in the golang runtime (via gomobile).
|
||||
The wrapper also computes the SHA256 hash of the data being written on the fly.
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperMobile2GoWriterWithSHA256* _Nullable HelperNewMobile2GoWriterWithSHA256(id<CryptoWriter> _Nullable writer);
|
||||
|
||||
/**
|
||||
* NewMobileReadResult initialize a MobileReadResult with the correct values.
|
||||
It clones the data to avoid the garbage collector freeing the data too early.
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperMobileReadResult* _Nullable HelperNewMobileReadResult(long n, BOOL eof, NSData* _Nullable data);
|
||||
|
||||
/**
|
||||
* QuickCheckDecrypt checks with high probability if the provided session key
|
||||
can decrypt the encrypted data packet given its 24 byte long prefix.
|
||||
The method only considers the first 24 bytes of the prefix slice (prefix[:24]).
|
||||
NOTE: Only works for SEIPDv1 packets with AES.
|
||||
*/
|
||||
FOUNDATION_EXPORT BOOL HelperQuickCheckDecrypt(CryptoSessionKey* _Nullable sessionKey, NSData* _Nullable prefix, BOOL* _Nullable ret0_, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* QuickCheckDecryptReader checks with high probability if the provided session key
|
||||
can decrypt a data packet given its 24 byte long prefix.
|
||||
The method reads up to but not exactly 24 bytes from the prefixReader.
|
||||
NOTE: Only works for SEIPDv1 packets with AES.
|
||||
*/
|
||||
FOUNDATION_EXPORT BOOL HelperQuickCheckDecryptReader(CryptoSessionKey* _Nullable sessionKey, id<CryptoReader> _Nullable prefixReader, BOOL* _Nullable ret0_, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* SignCleartextMessage signs text given a private keyring, canonicalizes and
|
||||
trims the newlines, and returns the PGP-compliant special armoring.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperSignCleartextMessage(CryptoKeyRing* _Nullable keyRing, NSString* _Nullable text, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* SignCleartextMessageArmored signs text given a private key and its
|
||||
passphrase, canonicalizes and trims the newlines, and returns the
|
||||
PGP-compliant special armoring.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperSignCleartextMessageArmored(NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSString* _Nullable text, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* UpdatePrivateKeyPassphrase decrypts the given armored privateKey with oldPassphrase,
|
||||
re-encrypts it with newPassphrase, and returns the new armored key.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperUpdatePrivateKeyPassphrase(NSString* _Nullable privateKey, NSData* _Nullable oldPassphrase, NSData* _Nullable newPassphrase, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* VerifyCleartextMessage verifies PGP-compliant armored signed plain text
|
||||
given the public keyring and returns the text or err if the verification
|
||||
fails.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperVerifyCleartextMessage(CryptoKeyRing* _Nullable keyRing, NSString* _Nullable armored, int64_t verifyTime, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* VerifyCleartextMessageArmored verifies PGP-compliant armored signed plain
|
||||
text given the public key and returns the text or err if the verification
|
||||
fails.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperVerifyCleartextMessageArmored(NSString* _Nullable publicKey, NSString* _Nullable armored, int64_t verifyTime, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* VerifySignatureExplicit calls the reader's VerifySignature()
|
||||
and tries to cast the returned error to a SignatureVerificationError.
|
||||
*/
|
||||
FOUNDATION_EXPORT CryptoSignatureVerificationError* _Nullable HelperVerifySignatureExplicit(CryptoPlainMessageReader* _Nullable reader, NSError* _Nullable* _Nullable error);
|
||||
|
||||
@class HelperMobileReader;
|
||||
|
||||
/**
|
||||
* MobileReader is the interface that readers in the mobile runtime must use and implement.
|
||||
This is a workaround to some of the gomobile limitations.
|
||||
*/
|
||||
@interface HelperMobileReader : NSObject <goSeqRefInterface, HelperMobileReader> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (HelperMobileReadResult* _Nullable)read:(long)max error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
#endif
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
// Objective-C API for talking to github.com/ProtonMail/gopenpgp/v2/models Go package.
|
||||
// gobind -lang=objc github.com/ProtonMail/gopenpgp/v2/models
|
||||
//
|
||||
// File is generated by gobind. Do not edit.
|
||||
|
||||
#ifndef __Models_H__
|
||||
#define __Models_H__
|
||||
|
||||
@import Foundation;
|
||||
#include "ref.h"
|
||||
#include "Universe.objc.h"
|
||||
|
||||
|
||||
@class ModelsEncryptedSigned;
|
||||
|
||||
/**
|
||||
* EncryptedSigned contains an encrypted message and signature.
|
||||
*/
|
||||
@interface ModelsEncryptedSigned : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) NSString* _Nonnull encrypted;
|
||||
@property (nonatomic) NSString* _Nonnull signature;
|
||||
@end
|
||||
|
||||
#endif
|
||||
|
|
@ -1,265 +0,0 @@
|
|||
// Objective-C API for talking to github.com/ProtonMail/go-srp Go package.
|
||||
// gobind -lang=objc github.com/ProtonMail/go-srp
|
||||
//
|
||||
// File is generated by gobind. Do not edit.
|
||||
|
||||
#ifndef __Srp_H__
|
||||
#define __Srp_H__
|
||||
|
||||
@import Foundation;
|
||||
#include "ref.h"
|
||||
#include "Universe.objc.h"
|
||||
|
||||
|
||||
@class SrpAuth;
|
||||
@class SrpProofs;
|
||||
@class SrpServer;
|
||||
|
||||
/**
|
||||
* Auth stores byte data for the calculation of SRP proofs.
|
||||
* Changed SrpAuto to Auth because the name will be used as srp.SrpAuto by other packages and as SrpSrpAuth on mobile
|
||||
* Also the data from the API called Auth. it could be match the meaning and reduce the confusion
|
||||
*/
|
||||
@interface SrpAuth : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
/**
|
||||
* NewAuth Creates new Auth from strings input. Salt and server ephemeral are in
|
||||
base64 format. Modulus is base64 with signature attached. The signature is
|
||||
verified against server key. The version controls password hash algorithm.
|
||||
|
||||
Parameters:
|
||||
- version int: The *x* component of the vector.
|
||||
- username string: The *y* component of the vector.
|
||||
- password []byte: The *z* component of the vector.
|
||||
- b64salt string: The std-base64 formatted salt
|
||||
Returns:
|
||||
- auth *Auth: the pre calculated auth information
|
||||
- err error: throw error
|
||||
Usage:
|
||||
|
||||
Warnings:
|
||||
- Be careful! Poos can hurt.
|
||||
*/
|
||||
- (nullable instancetype)init:(long)version username:(NSString* _Nullable)username password:(NSData* _Nullable)password b64salt:(NSString* _Nullable)b64salt signedModulus:(NSString* _Nullable)signedModulus serverEphemeral:(NSString* _Nullable)serverEphemeral;
|
||||
/**
|
||||
* NewAuthForVerifier Creates new Auth from strings input. Salt and server ephemeral are in
|
||||
base64 format. Modulus is base64 with signature attached. The signature is
|
||||
verified against server key. The version controls password hash algorithm.
|
||||
|
||||
Parameters:
|
||||
- version int: The *x* component of the vector.
|
||||
- username string: The *y* component of the vector.
|
||||
- password []byte: The *z* component of the vector.
|
||||
- salt string:
|
||||
Returns:
|
||||
- auth *Auth: the pre calculated auth information
|
||||
- err error: throw error
|
||||
Usage:
|
||||
|
||||
Warnings:
|
||||
- none.
|
||||
*/
|
||||
- (nullable instancetype)initForVerifier:(NSData* _Nullable)password signedModulus:(NSString* _Nullable)signedModulus rawSalt:(NSData* _Nullable)rawSalt;
|
||||
@property (nonatomic) NSData* _Nullable modulus;
|
||||
@property (nonatomic) NSData* _Nullable serverEphemeral;
|
||||
@property (nonatomic) NSData* _Nullable hashedPassword;
|
||||
@property (nonatomic) long version;
|
||||
/**
|
||||
* GenerateProofs calculates SPR proofs.
|
||||
*/
|
||||
- (SrpProofs* _Nullable)generateProofs:(long)bitLength error:(NSError* _Nullable* _Nullable)error;
|
||||
/**
|
||||
* GenerateVerifier verifier for update pwds and create accounts
|
||||
*/
|
||||
- (NSData* _Nullable)generateVerifier:(long)bitLength error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
/**
|
||||
* Proofs Srp Proofs object. Changed SrpProofs to Proofs because the name will be used as srp.SrpProofs by other packages and as SrpSrpProofs on mobile
|
||||
ClientProof []byte client proof
|
||||
ClientEphemeral []byte calculated from
|
||||
ExpectedServerProof []byte
|
||||
*/
|
||||
@interface SrpProofs : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) NSData* _Nullable clientProof;
|
||||
@property (nonatomic) NSData* _Nullable clientEphemeral;
|
||||
@property (nonatomic) NSData* _Nullable expectedServerProof;
|
||||
@end
|
||||
|
||||
/**
|
||||
* Server stores the internal state for the validation of SRP proofs.
|
||||
*/
|
||||
@interface SrpServer : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
/**
|
||||
* NewServer creates a new server instance from the raw binary data.
|
||||
*/
|
||||
- (nullable instancetype)init:(NSData* _Nullable)modulusBytes verifier:(NSData* _Nullable)verifier bitLength:(long)bitLength;
|
||||
/**
|
||||
* NewServerFromSigned creates a new server instance from the signed modulus and the binary verifier.
|
||||
*/
|
||||
- (nullable instancetype)initFromSigned:(NSString* _Nullable)signedModulus verifier:(NSData* _Nullable)verifier bitLength:(long)bitLength;
|
||||
/**
|
||||
* NewServerWithSecret creates a new server instance without generating a random secret from the raw binary data.
|
||||
Use with caution as the secret should not be reused.
|
||||
*/
|
||||
- (nullable instancetype)initWithSecret:(NSData* _Nullable)modulusBytes verifier:(NSData* _Nullable)verifier secretBytes:(NSData* _Nullable)secretBytes bitLength:(long)bitLength;
|
||||
/**
|
||||
* GenerateChallenge is the first step for SRP exchange, and generates a valid challenge for the provided verifier.
|
||||
*/
|
||||
- (NSData* _Nullable)generateChallenge:(NSError* _Nullable* _Nullable)error;
|
||||
/**
|
||||
* GetSharedSession returns the shared secret as byte if the session has concluded in valid state.
|
||||
*/
|
||||
- (NSData* _Nullable)getSharedSession:(NSError* _Nullable* _Nullable)error;
|
||||
/**
|
||||
* IsCompleted returns true if the exchange has been concluded in valid state.
|
||||
*/
|
||||
- (BOOL)isCompleted;
|
||||
/**
|
||||
* VerifyProofs Verifies the client proof and - if valid - generates the shared secret and returnd the server proof.
|
||||
It concludes the exchange in valid state if successful.
|
||||
*/
|
||||
- (NSData* _Nullable)verifyProofs:(NSData* _Nullable)clientEphemeralBytes clientProofBytes:(NSData* _Nullable)clientProofBytes error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const SrpVersion;
|
||||
|
||||
@interface Srp : NSObject
|
||||
/**
|
||||
* Implementation following the "context" package
|
||||
*/
|
||||
+ (NSError* _Nullable) deadlineExceeded;
|
||||
+ (void) setDeadlineExceeded:(NSError* _Nullable)v;
|
||||
|
||||
/**
|
||||
* ErrDataAfterModulus found extra data after decode the modulus
|
||||
*/
|
||||
+ (NSError* _Nullable) errDataAfterModulus;
|
||||
+ (void) setErrDataAfterModulus:(NSError* _Nullable)v;
|
||||
|
||||
/**
|
||||
* ErrInvalidSignature invalid modulus signature
|
||||
*/
|
||||
+ (NSError* _Nullable) errInvalidSignature;
|
||||
+ (void) setErrInvalidSignature:(NSError* _Nullable)v;
|
||||
|
||||
// skipped variable RandReader with unsupported type: io.Reader
|
||||
|
||||
@end
|
||||
|
||||
/**
|
||||
* Argon2PreimageChallenge computes the base64 solution for a given Argon2 base64
|
||||
challenge within deadlineUnixMilli milliseconds, if any was found. Deadlines are measured
|
||||
on the wall clock, not the monotonic clock, due to unreliability on mobile devices.
|
||||
deadlineUnixMilli = -1 means unlimited time.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull SrpArgon2PreimageChallenge(NSString* _Nullable b64Challenge, int64_t deadlineUnixMilli, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* ECDLPChallenge computes the base64 solution for a given ECDLP base64 challenge
|
||||
within deadlineUnixMilli milliseconds, if any was found. Deadlines are measured on the
|
||||
wall clock, not the monotonic clock, due to unreliability on mobile devices.
|
||||
deadlineUnixMilli = -1 means unlimited time.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull SrpECDLPChallenge(NSString* _Nullable b64Challenge, int64_t deadlineUnixMilli, NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT NSString* _Nonnull SrpGetModulusKey(void);
|
||||
|
||||
/**
|
||||
* HashPassword returns the hash of password argument. Based on version number
|
||||
following arguments are used in addition to password:
|
||||
* 0, 1, 2: userName and modulus
|
||||
* 3, 4: salt and modulus
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable SrpHashPassword(long authVersion, NSData* _Nullable password, NSString* _Nullable userName, NSData* _Nullable salt, NSData* _Nullable modulus, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* MailboxPassword get mailbox password hash
|
||||
|
||||
Parameters:
|
||||
- password []byte: a mailbox password
|
||||
- salt []byte: a salt is random 128 bits data
|
||||
Returns:
|
||||
- hashed []byte: a hashed password
|
||||
- err error: throw error
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable SrpMailboxPassword(NSData* _Nullable password, NSData* _Nullable salt, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* NewAuth Creates new Auth from strings input. Salt and server ephemeral are in
|
||||
base64 format. Modulus is base64 with signature attached. The signature is
|
||||
verified against server key. The version controls password hash algorithm.
|
||||
|
||||
Parameters:
|
||||
- version int: The *x* component of the vector.
|
||||
- username string: The *y* component of the vector.
|
||||
- password []byte: The *z* component of the vector.
|
||||
- b64salt string: The std-base64 formatted salt
|
||||
Returns:
|
||||
- auth *Auth: the pre calculated auth information
|
||||
- err error: throw error
|
||||
Usage:
|
||||
|
||||
Warnings:
|
||||
- Be careful! Poos can hurt.
|
||||
*/
|
||||
FOUNDATION_EXPORT SrpAuth* _Nullable SrpNewAuth(long version, NSString* _Nullable username, NSData* _Nullable password, NSString* _Nullable b64salt, NSString* _Nullable signedModulus, NSString* _Nullable serverEphemeral, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* NewAuthForVerifier Creates new Auth from strings input. Salt and server ephemeral are in
|
||||
base64 format. Modulus is base64 with signature attached. The signature is
|
||||
verified against server key. The version controls password hash algorithm.
|
||||
|
||||
Parameters:
|
||||
- version int: The *x* component of the vector.
|
||||
- username string: The *y* component of the vector.
|
||||
- password []byte: The *z* component of the vector.
|
||||
- salt string:
|
||||
Returns:
|
||||
- auth *Auth: the pre calculated auth information
|
||||
- err error: throw error
|
||||
Usage:
|
||||
|
||||
Warnings:
|
||||
- none.
|
||||
*/
|
||||
FOUNDATION_EXPORT SrpAuth* _Nullable SrpNewAuthForVerifier(NSData* _Nullable password, NSString* _Nullable signedModulus, NSData* _Nullable rawSalt, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* NewServer creates a new server instance from the raw binary data.
|
||||
*/
|
||||
FOUNDATION_EXPORT SrpServer* _Nullable SrpNewServer(NSData* _Nullable modulusBytes, NSData* _Nullable verifier, long bitLength, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* NewServerFromSigned creates a new server instance from the signed modulus and the binary verifier.
|
||||
*/
|
||||
FOUNDATION_EXPORT SrpServer* _Nullable SrpNewServerFromSigned(NSString* _Nullable signedModulus, NSData* _Nullable verifier, long bitLength, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* NewServerWithSecret creates a new server instance without generating a random secret from the raw binary data.
|
||||
Use with caution as the secret should not be reused.
|
||||
*/
|
||||
FOUNDATION_EXPORT SrpServer* _Nullable SrpNewServerWithSecret(NSData* _Nullable modulusBytes, NSData* _Nullable verifier, NSData* _Nullable secretBytes, long bitLength, NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT NSData* _Nullable SrpRandomBits(long bits, NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT NSData* _Nullable SrpRandomBytes(long byes, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* VersionNumber get current library version
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull SrpVersionNumber(void);
|
||||
|
||||
#endif
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
// Objective-C API for talking to github.com/ProtonMail/gopenpgp/v2/subtle Go package.
|
||||
// gobind -lang=objc github.com/ProtonMail/gopenpgp/v2/subtle
|
||||
//
|
||||
// File is generated by gobind. Do not edit.
|
||||
|
||||
#ifndef __Subtle_H__
|
||||
#define __Subtle_H__
|
||||
|
||||
@import Foundation;
|
||||
#include "ref.h"
|
||||
#include "Universe.objc.h"
|
||||
|
||||
|
||||
/**
|
||||
* DecryptWithoutIntegrity decrypts data encrypted with AES-CTR.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable SubtleDecryptWithoutIntegrity(NSData* _Nullable key, NSData* _Nullable input, NSData* _Nullable iv, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DeriveKey derives a key from a password using scrypt. n should be set to the
|
||||
highest power of 2 you can derive within 100 milliseconds.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable SubtleDeriveKey(NSString* _Nullable password, NSData* _Nullable salt, long n, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptWithoutIntegrity encrypts data with AES-CTR. Note: this encryption
|
||||
mode is not secure when stored/sent on an untrusted medium.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable SubtleEncryptWithoutIntegrity(NSData* _Nullable key, NSData* _Nullable input, NSData* _Nullable iv, NSError* _Nullable* _Nullable error);
|
||||
|
||||
#endif
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
// Objective-C API for talking to Go package.
|
||||
// gobind -lang=objc
|
||||
//
|
||||
// File is generated by gobind. Do not edit.
|
||||
|
||||
#ifndef __Universe_H__
|
||||
#define __Universe_H__
|
||||
|
||||
@import Foundation;
|
||||
#include "ref.h"
|
||||
|
||||
@protocol Universeerror;
|
||||
@class Universeerror;
|
||||
|
||||
@protocol Universeerror <NSObject>
|
||||
- (NSString* _Nonnull)error;
|
||||
@end
|
||||
|
||||
@class Universeerror;
|
||||
|
||||
@interface Universeerror : NSError <goSeqRefInterface, Universeerror> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (NSString* _Nonnull)error;
|
||||
@end
|
||||
|
||||
#endif
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
// Copyright 2015 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
#ifndef __GO_REF_HDR__
|
||||
#define __GO_REF_HDR__
|
||||
|
||||
#include <Foundation/Foundation.h>
|
||||
|
||||
// GoSeqRef is an object tagged with an integer for passing back and
|
||||
// forth across the language boundary. A GoSeqRef may represent either
|
||||
// an instance of a Go object, or an Objective-C object passed to Go.
|
||||
// The explicit allocation of a GoSeqRef is used to pin a Go object
|
||||
// when it is passed to Objective-C. The Go seq package maintains a
|
||||
// reference to the Go object in a map keyed by the refnum along with
|
||||
// a reference count. When the reference count reaches zero, the Go
|
||||
// seq package will clear the corresponding entry in the map.
|
||||
@interface GoSeqRef : NSObject {
|
||||
}
|
||||
@property(readonly) int32_t refnum;
|
||||
@property(strong) id obj; // NULL when representing a Go object.
|
||||
|
||||
// new GoSeqRef object to proxy a Go object. The refnum must be
|
||||
// provided from Go side.
|
||||
- (instancetype)initWithRefnum:(int32_t)refnum obj:(id)obj;
|
||||
|
||||
- (int32_t)incNum;
|
||||
|
||||
@end
|
||||
|
||||
@protocol goSeqRefInterface
|
||||
-(GoSeqRef*) _ref;
|
||||
@end
|
||||
|
||||
#endif
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
<?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>CFBundleExecutable</key>
|
||||
<string>GoLibs</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>GoLibs</string>
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>100.0</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.0.1756305244</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>0.0.1756305244</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
framework module "GoLibs" {
|
||||
header "ref.h"
|
||||
header "Crypto.objc.h"
|
||||
header "Armor.objc.h"
|
||||
header "Constants.objc.h"
|
||||
header "Models.objc.h"
|
||||
header "Subtle.objc.h"
|
||||
header "Helper.objc.h"
|
||||
header "Srp.objc.h"
|
||||
header "Universe.objc.h"
|
||||
header "GoLibs.h"
|
||||
|
||||
export *
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
Versions/Current/GoLibs
|
||||
|
|
@ -1 +0,0 @@
|
|||
Versions/Current/Headers
|
||||
|
|
@ -1 +0,0 @@
|
|||
Versions/Current/Modules
|
||||
|
|
@ -1 +0,0 @@
|
|||
Versions/Current/Resources
|
||||
Binary file not shown.
|
|
@ -1,39 +0,0 @@
|
|||
// Objective-C API for talking to github.com/ProtonMail/gopenpgp/v2/armor Go package.
|
||||
// gobind -lang=objc github.com/ProtonMail/gopenpgp/v2/armor
|
||||
//
|
||||
// File is generated by gobind. Do not edit.
|
||||
|
||||
#ifndef __Armor_H__
|
||||
#define __Armor_H__
|
||||
|
||||
@import Foundation;
|
||||
#include "ref.h"
|
||||
#include "Universe.objc.h"
|
||||
|
||||
#include "Constants.objc.h"
|
||||
|
||||
/**
|
||||
* ArmorKey armors input as a public key.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull ArmorArmorKey(NSData* _Nullable input, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* ArmorWithType armors input with the given armorType.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull ArmorArmorWithType(NSData* _Nullable input, NSString* _Nullable armorType, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* ArmorWithTypeAndCustomHeaders armors input with the given armorType and
|
||||
headers.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull ArmorArmorWithTypeAndCustomHeaders(NSData* _Nullable input, NSString* _Nullable armorType, NSString* _Nullable version, NSString* _Nullable comment, NSError* _Nullable* _Nullable error);
|
||||
|
||||
// skipped function ArmorWithTypeBuffered with unsupported parameter or return types
|
||||
|
||||
|
||||
/**
|
||||
* Unarmor unarmors an armored input into a byte array.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable ArmorUnarmor(NSString* _Nullable input, NSError* _Nullable* _Nullable error);
|
||||
|
||||
#endif
|
||||
|
|
@ -1,72 +0,0 @@
|
|||
// Objective-C API for talking to github.com/ProtonMail/gopenpgp/v2/constants Go package.
|
||||
// gobind -lang=objc github.com/ProtonMail/gopenpgp/v2/constants
|
||||
//
|
||||
// File is generated by gobind. Do not edit.
|
||||
|
||||
#ifndef __Constants_H__
|
||||
#define __Constants_H__
|
||||
|
||||
@import Foundation;
|
||||
#include "ref.h"
|
||||
#include "Universe.objc.h"
|
||||
|
||||
|
||||
/**
|
||||
* Cipher suite names.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsAES128;
|
||||
/**
|
||||
* Cipher suite names.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsAES192;
|
||||
/**
|
||||
* Cipher suite names.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsAES256;
|
||||
/**
|
||||
* Constants for armored data.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsArmorHeaderComment;
|
||||
/**
|
||||
* Constants for armored data.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsArmorHeaderVersion;
|
||||
/**
|
||||
* Cipher suite names.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsCAST5;
|
||||
FOUNDATION_EXPORT const int64_t ConstantsDefaultCompression;
|
||||
FOUNDATION_EXPORT const int64_t ConstantsDefaultCompressionLevel;
|
||||
/**
|
||||
* Constants for armored data.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsPGPMessageHeader;
|
||||
/**
|
||||
* Constants for armored data.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsPGPSignatureHeader;
|
||||
/**
|
||||
* Constants for armored data.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsPrivateKeyHeader;
|
||||
/**
|
||||
* Constants for armored data.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsPublicKeyHeader;
|
||||
FOUNDATION_EXPORT const long ConstantsSIGNATURE_BAD_CONTEXT;
|
||||
FOUNDATION_EXPORT const long ConstantsSIGNATURE_FAILED;
|
||||
FOUNDATION_EXPORT const long ConstantsSIGNATURE_NOT_SIGNED;
|
||||
FOUNDATION_EXPORT const long ConstantsSIGNATURE_NO_VERIFIER;
|
||||
FOUNDATION_EXPORT const long ConstantsSIGNATURE_OK;
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsSignatureContextName;
|
||||
/**
|
||||
* Cipher suite names.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsThreeDES;
|
||||
/**
|
||||
* Cipher suite names.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsTripleDES;
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsVersion;
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,25 +0,0 @@
|
|||
|
||||
// Objective-C API for talking to the following Go packages
|
||||
//
|
||||
// github.com/ProtonMail/gopenpgp/v2/crypto
|
||||
// github.com/ProtonMail/gopenpgp/v2/armor
|
||||
// github.com/ProtonMail/gopenpgp/v2/constants
|
||||
// github.com/ProtonMail/gopenpgp/v2/models
|
||||
// github.com/ProtonMail/gopenpgp/v2/subtle
|
||||
// github.com/ProtonMail/gopenpgp/v2/helper
|
||||
// github.com/ProtonMail/go-srp
|
||||
//
|
||||
// File is generated by gomobile bind. Do not edit.
|
||||
#ifndef __GoLibs_FRAMEWORK_H__
|
||||
#define __GoLibs_FRAMEWORK_H__
|
||||
|
||||
#include "Crypto.objc.h"
|
||||
#include "Armor.objc.h"
|
||||
#include "Constants.objc.h"
|
||||
#include "Models.objc.h"
|
||||
#include "Subtle.objc.h"
|
||||
#include "Helper.objc.h"
|
||||
#include "Srp.objc.h"
|
||||
#include "Universe.objc.h"
|
||||
|
||||
#endif
|
||||
|
|
@ -1,481 +0,0 @@
|
|||
// Objective-C API for talking to github.com/ProtonMail/gopenpgp/v2/helper Go package.
|
||||
// gobind -lang=objc github.com/ProtonMail/gopenpgp/v2/helper
|
||||
//
|
||||
// File is generated by gobind. Do not edit.
|
||||
|
||||
#ifndef __Helper_H__
|
||||
#define __Helper_H__
|
||||
|
||||
@import Foundation;
|
||||
#include "ref.h"
|
||||
#include "Universe.objc.h"
|
||||
|
||||
#include "Crypto.objc.h"
|
||||
|
||||
@class HelperEncryptSignArmoredDetachedMobileResult;
|
||||
@class HelperEncryptSignBinaryDetachedMobileResult;
|
||||
@class HelperExplicitVerifyMessage;
|
||||
@class HelperGo2AndroidReader;
|
||||
@class HelperGo2IOSReader;
|
||||
@class HelperMobile2GoReader;
|
||||
@class HelperMobile2GoWriter;
|
||||
@class HelperMobile2GoWriterWithSHA256;
|
||||
@class HelperMobileReadResult;
|
||||
@protocol HelperMobileReader;
|
||||
@class HelperMobileReader;
|
||||
|
||||
@protocol HelperMobileReader <NSObject>
|
||||
- (HelperMobileReadResult* _Nullable)read:(long)max error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
@interface HelperEncryptSignArmoredDetachedMobileResult : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) NSString* _Nonnull ciphertextArmored;
|
||||
@property (nonatomic) NSString* _Nonnull encryptedSignatureArmored;
|
||||
@end
|
||||
|
||||
@interface HelperEncryptSignBinaryDetachedMobileResult : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) NSData* _Nullable encryptedData;
|
||||
@property (nonatomic) NSString* _Nonnull encryptedSignatureArmored;
|
||||
@end
|
||||
|
||||
@interface HelperExplicitVerifyMessage : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) CryptoPlainMessage* _Nullable message;
|
||||
@property (nonatomic) CryptoSignatureVerificationError* _Nullable signatureVerificationError;
|
||||
@end
|
||||
|
||||
/**
|
||||
* Go2AndroidReader is used to wrap a native golang Reader in the golang runtime,
|
||||
to be usable in the android app runtime (via gomobile).
|
||||
*/
|
||||
@interface HelperGo2AndroidReader : NSObject <goSeqRefInterface, CryptoReader> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
/**
|
||||
* NewGo2AndroidReader wraps a native golang Reader to be usable in the mobile app runtime (via gomobile).
|
||||
It doesn't follow the standard golang Reader behavior, and returns n = -1 on EOF.
|
||||
*/
|
||||
- (nullable instancetype)init:(id<CryptoReader> _Nullable)reader;
|
||||
/**
|
||||
* Read reads bytes into the provided buffer and returns the number of bytes read
|
||||
It doesn't follow the standard golang Reader behavior, and returns n = -1 on EOF.
|
||||
*/
|
||||
- (BOOL)read:(NSData* _Nullable)b n:(long* _Nullable)n error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
/**
|
||||
* Go2IOSReader is used to wrap a native golang Reader in the golang runtime,
|
||||
to be usable in the iOS app runtime (via gomobile) as a MobileReader.
|
||||
*/
|
||||
@interface HelperGo2IOSReader : NSObject <goSeqRefInterface, HelperMobileReader> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
/**
|
||||
* NewGo2IOSReader wraps a native golang Reader to be usable in the ios app runtime (via gomobile).
|
||||
*/
|
||||
- (nullable instancetype)init:(id<CryptoReader> _Nullable)reader;
|
||||
/**
|
||||
* Read reads at most <max> bytes from the wrapped Reader and returns the read data as a MobileReadResult.
|
||||
*/
|
||||
- (HelperMobileReadResult* _Nullable)read:(long)max error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
/**
|
||||
* Mobile2GoReader is used to wrap a MobileReader in the mobile app runtime,
|
||||
to be usable in the golang runtime (via gomobile) as a native Reader.
|
||||
*/
|
||||
@interface HelperMobile2GoReader : NSObject <goSeqRefInterface, CryptoReader> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
/**
|
||||
* NewMobile2GoReader wraps a MobileReader to be usable in the golang runtime (via gomobile).
|
||||
*/
|
||||
- (nullable instancetype)init:(id<HelperMobileReader> _Nullable)reader;
|
||||
/**
|
||||
* Read reads data from the wrapped MobileReader and copies the read data in the provided buffer.
|
||||
It also handles the conversion of EOF to an error.
|
||||
*/
|
||||
- (BOOL)read:(NSData* _Nullable)b n:(long* _Nullable)n error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
/**
|
||||
* Mobile2GoWriter is used to wrap a writer in the mobile app runtime,
|
||||
to be usable in the golang runtime (via gomobile).
|
||||
*/
|
||||
@interface HelperMobile2GoWriter : NSObject <goSeqRefInterface, CryptoWriter> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
/**
|
||||
* NewMobile2GoWriter wraps a writer to be usable in the golang runtime (via gomobile).
|
||||
*/
|
||||
- (nullable instancetype)init:(id<CryptoWriter> _Nullable)writer;
|
||||
/**
|
||||
* Write writes the data in the provided buffer in the wrapped writer.
|
||||
It clones the provided data to prevent errors with garbage collectors.
|
||||
*/
|
||||
- (BOOL)write:(NSData* _Nullable)b n:(long* _Nullable)n error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
/**
|
||||
* Mobile2GoWriterWithSHA256 is used to wrap a writer in the mobile app runtime,
|
||||
to be usable in the golang runtime (via gomobile).
|
||||
It also computes the SHA256 hash of the data being written on the fly.
|
||||
*/
|
||||
@interface HelperMobile2GoWriterWithSHA256 : NSObject <goSeqRefInterface, CryptoWriter> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
/**
|
||||
* NewMobile2GoWriterWithSHA256 wraps a writer to be usable in the golang runtime (via gomobile).
|
||||
The wrapper also computes the SHA256 hash of the data being written on the fly.
|
||||
*/
|
||||
- (nullable instancetype)init:(id<CryptoWriter> _Nullable)writer;
|
||||
/**
|
||||
* GetSHA256 returns the SHA256 hash of the data that's been written so far.
|
||||
*/
|
||||
- (NSData* _Nullable)getSHA256;
|
||||
/**
|
||||
* Write writes the data in the provided buffer in the wrapped writer.
|
||||
It clones the provided data to prevent errors with garbage collectors.
|
||||
It also computes the SHA256 hash of the data being written on the fly.
|
||||
*/
|
||||
- (BOOL)write:(NSData* _Nullable)b n:(long* _Nullable)n error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
/**
|
||||
* MobileReadResult is what needs to be returned by MobileReader.Read.
|
||||
The read data is passed as a return value rather than passed as an argument to the reader.
|
||||
This avoids problems introduced by gomobile that prevent the use of native golang readers.
|
||||
*/
|
||||
@interface HelperMobileReadResult : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
/**
|
||||
* NewMobileReadResult initialize a MobileReadResult with the correct values.
|
||||
It clones the data to avoid the garbage collector freeing the data too early.
|
||||
*/
|
||||
- (nullable instancetype)init:(long)n eof:(BOOL)eof data:(NSData* _Nullable)data;
|
||||
@property (nonatomic) long n;
|
||||
@property (nonatomic) BOOL isEOF;
|
||||
@property (nonatomic) NSData* _Nullable data;
|
||||
@end
|
||||
|
||||
FOUNDATION_EXPORT const int64_t HelperAES_BLOCK_SIZE;
|
||||
|
||||
/**
|
||||
* DecryptAttachment takes a keypacket and datpacket
|
||||
and returns a decrypted PlainMessage
|
||||
Specifically designed for attachments rather than text messages.
|
||||
*/
|
||||
FOUNDATION_EXPORT CryptoPlainMessage* _Nullable HelperDecryptAttachment(NSData* _Nullable keyPacket, NSData* _Nullable dataPacket, CryptoKeyRing* _Nullable keyRing, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptAttachmentWithKey decrypts a binary file
|
||||
Using a given armored private key and its passphrase.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable HelperDecryptAttachmentWithKey(NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSData* _Nullable keyPacket, NSData* _Nullable dataPacket, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptBinaryMessageArmored decrypts an armored PGP message given a private key
|
||||
and its passphrase.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable HelperDecryptBinaryMessageArmored(NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSString* _Nullable ciphertext, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptExplicitVerify decrypts a PGP message given a private keyring
|
||||
and a public keyring to verify the embedded signature. Returns the plain
|
||||
data and an error on signature verification failure.
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperExplicitVerifyMessage* _Nullable HelperDecryptExplicitVerify(CryptoPGPMessage* _Nullable pgpMessage, CryptoKeyRing* _Nullable privateKeyRing, CryptoKeyRing* _Nullable publicKeyRing, int64_t verifyTime, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptExplicitVerifyWithContext decrypts a PGP message given a private keyring
|
||||
and a public keyring to verify the embedded signature. Returns the plain
|
||||
data and an error on signature verification failure.
|
||||
The caller can provide a context that will be used to verify the signature.
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperExplicitVerifyMessage* _Nullable HelperDecryptExplicitVerifyWithContext(CryptoPGPMessage* _Nullable pgpMessage, CryptoKeyRing* _Nullable privateKeyRing, CryptoKeyRing* _Nullable publicKeyRing, int64_t verifyTime, CryptoVerificationContext* _Nullable verificationContext, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptMessageArmored decrypts an armored PGP message given a private key
|
||||
and its passphrase.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperDecryptMessageArmored(NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSString* _Nullable ciphertext, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptMessageWithPassword decrypts an armored message with a random token.
|
||||
The algorithm is derived from the armoring.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperDecryptMessageWithPassword(NSData* _Nullable password, NSString* _Nullable ciphertext, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptSessionKey decrypts a session key
|
||||
using a given armored private key
|
||||
and its passphrase.
|
||||
*/
|
||||
FOUNDATION_EXPORT CryptoSessionKey* _Nullable HelperDecryptSessionKey(NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSData* _Nullable encryptedSessionKey, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptSessionKeyExplicitVerify decrypts a PGP data packet given a session key
|
||||
and a public keyring to verify the embedded signature. Returns the plain data and
|
||||
an error on signature verification failure.
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperExplicitVerifyMessage* _Nullable HelperDecryptSessionKeyExplicitVerify(NSData* _Nullable dataPacket, CryptoSessionKey* _Nullable sessionKey, CryptoKeyRing* _Nullable publicKeyRing, int64_t verifyTime, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptSessionKeyExplicitVerifyWithContext decrypts a PGP data packet given a session key
|
||||
and a public keyring to verify the embedded signature. Returns the plain data and
|
||||
an error on signature verification failure.
|
||||
The caller can provide a context that will be used to verify the signature.
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperExplicitVerifyMessage* _Nullable HelperDecryptSessionKeyExplicitVerifyWithContext(NSData* _Nullable dataPacket, CryptoSessionKey* _Nullable sessionKey, CryptoKeyRing* _Nullable publicKeyRing, int64_t verifyTime, CryptoVerificationContext* _Nullable verificationContext, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptVerifyArmoredDetached decrypts an armored pgp message
|
||||
and verify a detached armored encrypted signature
|
||||
given a publicKey, and a privateKey with its passphrase.
|
||||
Returns the plain data or an error on
|
||||
signature verification failure.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable HelperDecryptVerifyArmoredDetached(NSString* _Nullable publicKey, NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSString* _Nullable ciphertextArmored, NSString* _Nullable encryptedSignatureArmored, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptVerifyAttachment decrypts and verifies an attachment split into the
|
||||
keyPacket, dataPacket and an armored (!) signature, given a publicKey, and a
|
||||
privateKey with its passphrase. Returns the plain data or an error on
|
||||
signature verification failure.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable HelperDecryptVerifyAttachment(NSString* _Nullable publicKey, NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSData* _Nullable keyPacket, NSData* _Nullable dataPacket, NSString* _Nullable armoredSignature, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptVerifyBinaryDetached decrypts binary encrypted data
|
||||
and verify a detached armored encrypted signature
|
||||
given a publicKey, and a privateKey with its passphrase.
|
||||
Returns the plain data or an error on
|
||||
signature verification failure.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable HelperDecryptVerifyBinaryDetached(NSString* _Nullable publicKey, NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSData* _Nullable encryptedData, NSString* _Nullable encryptedSignatureArmored, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptVerifyMessageArmored decrypts an armored PGP message given a private
|
||||
key and its passphrase and verifies the embedded signature. Returns the
|
||||
plain data or an error on signature verification failure.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperDecryptVerifyMessageArmored(NSString* _Nullable publicKey, NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSString* _Nullable ciphertext, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptAttachment encrypts a file given a plainData and a fileName.
|
||||
Returns a PGPSplitMessage containing a session key packet and symmetrically
|
||||
encrypted data. Specifically designed for attachments rather than text
|
||||
messages.
|
||||
*/
|
||||
FOUNDATION_EXPORT CryptoPGPSplitMessage* _Nullable HelperEncryptAttachment(NSData* _Nullable plainData, NSString* _Nullable filename, CryptoKeyRing* _Nullable keyRing, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptAttachmentWithKey encrypts a binary file
|
||||
Using a given armored public key.
|
||||
*/
|
||||
FOUNDATION_EXPORT CryptoPGPSplitMessage* _Nullable HelperEncryptAttachmentWithKey(NSString* _Nullable publicKey, NSString* _Nullable filename, NSData* _Nullable plainData, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptBinaryMessageArmored generates an armored PGP message given a binary data and
|
||||
an armored public key.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperEncryptBinaryMessageArmored(NSString* _Nullable key, NSData* _Nullable data, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptMessageArmored generates an armored PGP message given a plaintext and
|
||||
an armored public key.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperEncryptMessageArmored(NSString* _Nullable key, NSString* _Nullable plaintext, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptMessageWithPassword encrypts a string with a passphrase using AES256.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperEncryptMessageWithPassword(NSData* _Nullable password, NSString* _Nullable plaintext, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptPGPMessageToAdditionalKey decrypts the session key of the input PGPSplitMessage with a private key in keyRing
|
||||
and encrypts it towards the additionalKeys by adding the additional key packets to the input PGPSplitMessage.
|
||||
If successful, new key packets are added to message.
|
||||
* messageToModify : The encrypted pgp message that should be modified
|
||||
* keyRing : The private keys to decrypt the session key in the messageToModify.
|
||||
* additionalKey : The public keys the message should be additionally encrypted to.
|
||||
*/
|
||||
FOUNDATION_EXPORT BOOL HelperEncryptPGPMessageToAdditionalKey(CryptoPGPSplitMessage* _Nullable messageToModify, CryptoKeyRing* _Nullable keyRing, CryptoKeyRing* _Nullable additionalKey, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptSessionKey encrypts a session key
|
||||
using a given armored public key.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable HelperEncryptSessionKey(NSString* _Nullable publicKey, CryptoSessionKey* _Nullable sessionKey, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptSignArmoredDetachedMobile wraps the encryptSignArmoredDetached method
|
||||
to have only one return argument for mobile.
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperEncryptSignArmoredDetachedMobileResult* _Nullable HelperEncryptSignArmoredDetachedMobile(NSString* _Nullable publicKey, NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSData* _Nullable plainData, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptSignBinaryDetachedMobile wraps the encryptSignBinaryDetached method
|
||||
to have only one return argument for mobile.
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperEncryptSignBinaryDetachedMobileResult* _Nullable HelperEncryptSignBinaryDetachedMobile(NSString* _Nullable publicKey, NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSData* _Nullable plainData, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptSignMessageArmored generates an armored signed PGP message given a
|
||||
plaintext and an armored public key a private key and its passphrase.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperEncryptSignMessageArmored(NSString* _Nullable publicKey, NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSString* _Nullable plaintext, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* FreeOSMemory can be used to explicitly
|
||||
call the garbage collector and
|
||||
return the unused memory to the OS.
|
||||
*/
|
||||
FOUNDATION_EXPORT void HelperFreeOSMemory(void);
|
||||
|
||||
/**
|
||||
* GenerateKey generates a key of the given keyType ("rsa" or "x25519"), encrypts it, and returns an armored string.
|
||||
If keyType is "rsa", bits is the RSA bitsize of the key.
|
||||
If keyType is "x25519" bits is unused.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperGenerateKey(NSString* _Nullable name, NSString* _Nullable email, NSData* _Nullable passphrase, NSString* _Nullable keyType, long bits, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* GetJsonSHA256Fingerprints returns the SHA256 fingeprints of key and subkeys,
|
||||
encoded in JSON, since gomobile can not handle arrays.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable HelperGetJsonSHA256Fingerprints(NSString* _Nullable publicKey, NSError* _Nullable* _Nullable error);
|
||||
|
||||
// skipped function GetSHA256Fingerprints with unsupported parameter or return types
|
||||
|
||||
|
||||
/**
|
||||
* NewGo2AndroidReader wraps a native golang Reader to be usable in the mobile app runtime (via gomobile).
|
||||
It doesn't follow the standard golang Reader behavior, and returns n = -1 on EOF.
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperGo2AndroidReader* _Nullable HelperNewGo2AndroidReader(id<CryptoReader> _Nullable reader);
|
||||
|
||||
/**
|
||||
* NewGo2IOSReader wraps a native golang Reader to be usable in the ios app runtime (via gomobile).
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperGo2IOSReader* _Nullable HelperNewGo2IOSReader(id<CryptoReader> _Nullable reader);
|
||||
|
||||
/**
|
||||
* NewMobile2GoReader wraps a MobileReader to be usable in the golang runtime (via gomobile).
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperMobile2GoReader* _Nullable HelperNewMobile2GoReader(id<HelperMobileReader> _Nullable reader);
|
||||
|
||||
/**
|
||||
* NewMobile2GoWriter wraps a writer to be usable in the golang runtime (via gomobile).
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperMobile2GoWriter* _Nullable HelperNewMobile2GoWriter(id<CryptoWriter> _Nullable writer);
|
||||
|
||||
/**
|
||||
* NewMobile2GoWriterWithSHA256 wraps a writer to be usable in the golang runtime (via gomobile).
|
||||
The wrapper also computes the SHA256 hash of the data being written on the fly.
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperMobile2GoWriterWithSHA256* _Nullable HelperNewMobile2GoWriterWithSHA256(id<CryptoWriter> _Nullable writer);
|
||||
|
||||
/**
|
||||
* NewMobileReadResult initialize a MobileReadResult with the correct values.
|
||||
It clones the data to avoid the garbage collector freeing the data too early.
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperMobileReadResult* _Nullable HelperNewMobileReadResult(long n, BOOL eof, NSData* _Nullable data);
|
||||
|
||||
/**
|
||||
* QuickCheckDecrypt checks with high probability if the provided session key
|
||||
can decrypt the encrypted data packet given its 24 byte long prefix.
|
||||
The method only considers the first 24 bytes of the prefix slice (prefix[:24]).
|
||||
NOTE: Only works for SEIPDv1 packets with AES.
|
||||
*/
|
||||
FOUNDATION_EXPORT BOOL HelperQuickCheckDecrypt(CryptoSessionKey* _Nullable sessionKey, NSData* _Nullable prefix, BOOL* _Nullable ret0_, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* QuickCheckDecryptReader checks with high probability if the provided session key
|
||||
can decrypt a data packet given its 24 byte long prefix.
|
||||
The method reads up to but not exactly 24 bytes from the prefixReader.
|
||||
NOTE: Only works for SEIPDv1 packets with AES.
|
||||
*/
|
||||
FOUNDATION_EXPORT BOOL HelperQuickCheckDecryptReader(CryptoSessionKey* _Nullable sessionKey, id<CryptoReader> _Nullable prefixReader, BOOL* _Nullable ret0_, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* SignCleartextMessage signs text given a private keyring, canonicalizes and
|
||||
trims the newlines, and returns the PGP-compliant special armoring.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperSignCleartextMessage(CryptoKeyRing* _Nullable keyRing, NSString* _Nullable text, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* SignCleartextMessageArmored signs text given a private key and its
|
||||
passphrase, canonicalizes and trims the newlines, and returns the
|
||||
PGP-compliant special armoring.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperSignCleartextMessageArmored(NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSString* _Nullable text, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* UpdatePrivateKeyPassphrase decrypts the given armored privateKey with oldPassphrase,
|
||||
re-encrypts it with newPassphrase, and returns the new armored key.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperUpdatePrivateKeyPassphrase(NSString* _Nullable privateKey, NSData* _Nullable oldPassphrase, NSData* _Nullable newPassphrase, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* VerifyCleartextMessage verifies PGP-compliant armored signed plain text
|
||||
given the public keyring and returns the text or err if the verification
|
||||
fails.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperVerifyCleartextMessage(CryptoKeyRing* _Nullable keyRing, NSString* _Nullable armored, int64_t verifyTime, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* VerifyCleartextMessageArmored verifies PGP-compliant armored signed plain
|
||||
text given the public key and returns the text or err if the verification
|
||||
fails.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperVerifyCleartextMessageArmored(NSString* _Nullable publicKey, NSString* _Nullable armored, int64_t verifyTime, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* VerifySignatureExplicit calls the reader's VerifySignature()
|
||||
and tries to cast the returned error to a SignatureVerificationError.
|
||||
*/
|
||||
FOUNDATION_EXPORT CryptoSignatureVerificationError* _Nullable HelperVerifySignatureExplicit(CryptoPlainMessageReader* _Nullable reader, NSError* _Nullable* _Nullable error);
|
||||
|
||||
@class HelperMobileReader;
|
||||
|
||||
/**
|
||||
* MobileReader is the interface that readers in the mobile runtime must use and implement.
|
||||
This is a workaround to some of the gomobile limitations.
|
||||
*/
|
||||
@interface HelperMobileReader : NSObject <goSeqRefInterface, HelperMobileReader> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (HelperMobileReadResult* _Nullable)read:(long)max error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
#endif
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
// Objective-C API for talking to github.com/ProtonMail/gopenpgp/v2/models Go package.
|
||||
// gobind -lang=objc github.com/ProtonMail/gopenpgp/v2/models
|
||||
//
|
||||
// File is generated by gobind. Do not edit.
|
||||
|
||||
#ifndef __Models_H__
|
||||
#define __Models_H__
|
||||
|
||||
@import Foundation;
|
||||
#include "ref.h"
|
||||
#include "Universe.objc.h"
|
||||
|
||||
|
||||
@class ModelsEncryptedSigned;
|
||||
|
||||
/**
|
||||
* EncryptedSigned contains an encrypted message and signature.
|
||||
*/
|
||||
@interface ModelsEncryptedSigned : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) NSString* _Nonnull encrypted;
|
||||
@property (nonatomic) NSString* _Nonnull signature;
|
||||
@end
|
||||
|
||||
#endif
|
||||
|
|
@ -1,265 +0,0 @@
|
|||
// Objective-C API for talking to github.com/ProtonMail/go-srp Go package.
|
||||
// gobind -lang=objc github.com/ProtonMail/go-srp
|
||||
//
|
||||
// File is generated by gobind. Do not edit.
|
||||
|
||||
#ifndef __Srp_H__
|
||||
#define __Srp_H__
|
||||
|
||||
@import Foundation;
|
||||
#include "ref.h"
|
||||
#include "Universe.objc.h"
|
||||
|
||||
|
||||
@class SrpAuth;
|
||||
@class SrpProofs;
|
||||
@class SrpServer;
|
||||
|
||||
/**
|
||||
* Auth stores byte data for the calculation of SRP proofs.
|
||||
* Changed SrpAuto to Auth because the name will be used as srp.SrpAuto by other packages and as SrpSrpAuth on mobile
|
||||
* Also the data from the API called Auth. it could be match the meaning and reduce the confusion
|
||||
*/
|
||||
@interface SrpAuth : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
/**
|
||||
* NewAuth Creates new Auth from strings input. Salt and server ephemeral are in
|
||||
base64 format. Modulus is base64 with signature attached. The signature is
|
||||
verified against server key. The version controls password hash algorithm.
|
||||
|
||||
Parameters:
|
||||
- version int: The *x* component of the vector.
|
||||
- username string: The *y* component of the vector.
|
||||
- password []byte: The *z* component of the vector.
|
||||
- b64salt string: The std-base64 formatted salt
|
||||
Returns:
|
||||
- auth *Auth: the pre calculated auth information
|
||||
- err error: throw error
|
||||
Usage:
|
||||
|
||||
Warnings:
|
||||
- Be careful! Poos can hurt.
|
||||
*/
|
||||
- (nullable instancetype)init:(long)version username:(NSString* _Nullable)username password:(NSData* _Nullable)password b64salt:(NSString* _Nullable)b64salt signedModulus:(NSString* _Nullable)signedModulus serverEphemeral:(NSString* _Nullable)serverEphemeral;
|
||||
/**
|
||||
* NewAuthForVerifier Creates new Auth from strings input. Salt and server ephemeral are in
|
||||
base64 format. Modulus is base64 with signature attached. The signature is
|
||||
verified against server key. The version controls password hash algorithm.
|
||||
|
||||
Parameters:
|
||||
- version int: The *x* component of the vector.
|
||||
- username string: The *y* component of the vector.
|
||||
- password []byte: The *z* component of the vector.
|
||||
- salt string:
|
||||
Returns:
|
||||
- auth *Auth: the pre calculated auth information
|
||||
- err error: throw error
|
||||
Usage:
|
||||
|
||||
Warnings:
|
||||
- none.
|
||||
*/
|
||||
- (nullable instancetype)initForVerifier:(NSData* _Nullable)password signedModulus:(NSString* _Nullable)signedModulus rawSalt:(NSData* _Nullable)rawSalt;
|
||||
@property (nonatomic) NSData* _Nullable modulus;
|
||||
@property (nonatomic) NSData* _Nullable serverEphemeral;
|
||||
@property (nonatomic) NSData* _Nullable hashedPassword;
|
||||
@property (nonatomic) long version;
|
||||
/**
|
||||
* GenerateProofs calculates SPR proofs.
|
||||
*/
|
||||
- (SrpProofs* _Nullable)generateProofs:(long)bitLength error:(NSError* _Nullable* _Nullable)error;
|
||||
/**
|
||||
* GenerateVerifier verifier for update pwds and create accounts
|
||||
*/
|
||||
- (NSData* _Nullable)generateVerifier:(long)bitLength error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
/**
|
||||
* Proofs Srp Proofs object. Changed SrpProofs to Proofs because the name will be used as srp.SrpProofs by other packages and as SrpSrpProofs on mobile
|
||||
ClientProof []byte client proof
|
||||
ClientEphemeral []byte calculated from
|
||||
ExpectedServerProof []byte
|
||||
*/
|
||||
@interface SrpProofs : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) NSData* _Nullable clientProof;
|
||||
@property (nonatomic) NSData* _Nullable clientEphemeral;
|
||||
@property (nonatomic) NSData* _Nullable expectedServerProof;
|
||||
@end
|
||||
|
||||
/**
|
||||
* Server stores the internal state for the validation of SRP proofs.
|
||||
*/
|
||||
@interface SrpServer : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
/**
|
||||
* NewServer creates a new server instance from the raw binary data.
|
||||
*/
|
||||
- (nullable instancetype)init:(NSData* _Nullable)modulusBytes verifier:(NSData* _Nullable)verifier bitLength:(long)bitLength;
|
||||
/**
|
||||
* NewServerFromSigned creates a new server instance from the signed modulus and the binary verifier.
|
||||
*/
|
||||
- (nullable instancetype)initFromSigned:(NSString* _Nullable)signedModulus verifier:(NSData* _Nullable)verifier bitLength:(long)bitLength;
|
||||
/**
|
||||
* NewServerWithSecret creates a new server instance without generating a random secret from the raw binary data.
|
||||
Use with caution as the secret should not be reused.
|
||||
*/
|
||||
- (nullable instancetype)initWithSecret:(NSData* _Nullable)modulusBytes verifier:(NSData* _Nullable)verifier secretBytes:(NSData* _Nullable)secretBytes bitLength:(long)bitLength;
|
||||
/**
|
||||
* GenerateChallenge is the first step for SRP exchange, and generates a valid challenge for the provided verifier.
|
||||
*/
|
||||
- (NSData* _Nullable)generateChallenge:(NSError* _Nullable* _Nullable)error;
|
||||
/**
|
||||
* GetSharedSession returns the shared secret as byte if the session has concluded in valid state.
|
||||
*/
|
||||
- (NSData* _Nullable)getSharedSession:(NSError* _Nullable* _Nullable)error;
|
||||
/**
|
||||
* IsCompleted returns true if the exchange has been concluded in valid state.
|
||||
*/
|
||||
- (BOOL)isCompleted;
|
||||
/**
|
||||
* VerifyProofs Verifies the client proof and - if valid - generates the shared secret and returnd the server proof.
|
||||
It concludes the exchange in valid state if successful.
|
||||
*/
|
||||
- (NSData* _Nullable)verifyProofs:(NSData* _Nullable)clientEphemeralBytes clientProofBytes:(NSData* _Nullable)clientProofBytes error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const SrpVersion;
|
||||
|
||||
@interface Srp : NSObject
|
||||
/**
|
||||
* Implementation following the "context" package
|
||||
*/
|
||||
+ (NSError* _Nullable) deadlineExceeded;
|
||||
+ (void) setDeadlineExceeded:(NSError* _Nullable)v;
|
||||
|
||||
/**
|
||||
* ErrDataAfterModulus found extra data after decode the modulus
|
||||
*/
|
||||
+ (NSError* _Nullable) errDataAfterModulus;
|
||||
+ (void) setErrDataAfterModulus:(NSError* _Nullable)v;
|
||||
|
||||
/**
|
||||
* ErrInvalidSignature invalid modulus signature
|
||||
*/
|
||||
+ (NSError* _Nullable) errInvalidSignature;
|
||||
+ (void) setErrInvalidSignature:(NSError* _Nullable)v;
|
||||
|
||||
// skipped variable RandReader with unsupported type: io.Reader
|
||||
|
||||
@end
|
||||
|
||||
/**
|
||||
* Argon2PreimageChallenge computes the base64 solution for a given Argon2 base64
|
||||
challenge within deadlineUnixMilli milliseconds, if any was found. Deadlines are measured
|
||||
on the wall clock, not the monotonic clock, due to unreliability on mobile devices.
|
||||
deadlineUnixMilli = -1 means unlimited time.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull SrpArgon2PreimageChallenge(NSString* _Nullable b64Challenge, int64_t deadlineUnixMilli, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* ECDLPChallenge computes the base64 solution for a given ECDLP base64 challenge
|
||||
within deadlineUnixMilli milliseconds, if any was found. Deadlines are measured on the
|
||||
wall clock, not the monotonic clock, due to unreliability on mobile devices.
|
||||
deadlineUnixMilli = -1 means unlimited time.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull SrpECDLPChallenge(NSString* _Nullable b64Challenge, int64_t deadlineUnixMilli, NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT NSString* _Nonnull SrpGetModulusKey(void);
|
||||
|
||||
/**
|
||||
* HashPassword returns the hash of password argument. Based on version number
|
||||
following arguments are used in addition to password:
|
||||
* 0, 1, 2: userName and modulus
|
||||
* 3, 4: salt and modulus
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable SrpHashPassword(long authVersion, NSData* _Nullable password, NSString* _Nullable userName, NSData* _Nullable salt, NSData* _Nullable modulus, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* MailboxPassword get mailbox password hash
|
||||
|
||||
Parameters:
|
||||
- password []byte: a mailbox password
|
||||
- salt []byte: a salt is random 128 bits data
|
||||
Returns:
|
||||
- hashed []byte: a hashed password
|
||||
- err error: throw error
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable SrpMailboxPassword(NSData* _Nullable password, NSData* _Nullable salt, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* NewAuth Creates new Auth from strings input. Salt and server ephemeral are in
|
||||
base64 format. Modulus is base64 with signature attached. The signature is
|
||||
verified against server key. The version controls password hash algorithm.
|
||||
|
||||
Parameters:
|
||||
- version int: The *x* component of the vector.
|
||||
- username string: The *y* component of the vector.
|
||||
- password []byte: The *z* component of the vector.
|
||||
- b64salt string: The std-base64 formatted salt
|
||||
Returns:
|
||||
- auth *Auth: the pre calculated auth information
|
||||
- err error: throw error
|
||||
Usage:
|
||||
|
||||
Warnings:
|
||||
- Be careful! Poos can hurt.
|
||||
*/
|
||||
FOUNDATION_EXPORT SrpAuth* _Nullable SrpNewAuth(long version, NSString* _Nullable username, NSData* _Nullable password, NSString* _Nullable b64salt, NSString* _Nullable signedModulus, NSString* _Nullable serverEphemeral, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* NewAuthForVerifier Creates new Auth from strings input. Salt and server ephemeral are in
|
||||
base64 format. Modulus is base64 with signature attached. The signature is
|
||||
verified against server key. The version controls password hash algorithm.
|
||||
|
||||
Parameters:
|
||||
- version int: The *x* component of the vector.
|
||||
- username string: The *y* component of the vector.
|
||||
- password []byte: The *z* component of the vector.
|
||||
- salt string:
|
||||
Returns:
|
||||
- auth *Auth: the pre calculated auth information
|
||||
- err error: throw error
|
||||
Usage:
|
||||
|
||||
Warnings:
|
||||
- none.
|
||||
*/
|
||||
FOUNDATION_EXPORT SrpAuth* _Nullable SrpNewAuthForVerifier(NSData* _Nullable password, NSString* _Nullable signedModulus, NSData* _Nullable rawSalt, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* NewServer creates a new server instance from the raw binary data.
|
||||
*/
|
||||
FOUNDATION_EXPORT SrpServer* _Nullable SrpNewServer(NSData* _Nullable modulusBytes, NSData* _Nullable verifier, long bitLength, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* NewServerFromSigned creates a new server instance from the signed modulus and the binary verifier.
|
||||
*/
|
||||
FOUNDATION_EXPORT SrpServer* _Nullable SrpNewServerFromSigned(NSString* _Nullable signedModulus, NSData* _Nullable verifier, long bitLength, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* NewServerWithSecret creates a new server instance without generating a random secret from the raw binary data.
|
||||
Use with caution as the secret should not be reused.
|
||||
*/
|
||||
FOUNDATION_EXPORT SrpServer* _Nullable SrpNewServerWithSecret(NSData* _Nullable modulusBytes, NSData* _Nullable verifier, NSData* _Nullable secretBytes, long bitLength, NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT NSData* _Nullable SrpRandomBits(long bits, NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT NSData* _Nullable SrpRandomBytes(long byes, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* VersionNumber get current library version
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull SrpVersionNumber(void);
|
||||
|
||||
#endif
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
// Objective-C API for talking to github.com/ProtonMail/gopenpgp/v2/subtle Go package.
|
||||
// gobind -lang=objc github.com/ProtonMail/gopenpgp/v2/subtle
|
||||
//
|
||||
// File is generated by gobind. Do not edit.
|
||||
|
||||
#ifndef __Subtle_H__
|
||||
#define __Subtle_H__
|
||||
|
||||
@import Foundation;
|
||||
#include "ref.h"
|
||||
#include "Universe.objc.h"
|
||||
|
||||
|
||||
/**
|
||||
* DecryptWithoutIntegrity decrypts data encrypted with AES-CTR.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable SubtleDecryptWithoutIntegrity(NSData* _Nullable key, NSData* _Nullable input, NSData* _Nullable iv, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DeriveKey derives a key from a password using scrypt. n should be set to the
|
||||
highest power of 2 you can derive within 100 milliseconds.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable SubtleDeriveKey(NSString* _Nullable password, NSData* _Nullable salt, long n, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptWithoutIntegrity encrypts data with AES-CTR. Note: this encryption
|
||||
mode is not secure when stored/sent on an untrusted medium.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable SubtleEncryptWithoutIntegrity(NSData* _Nullable key, NSData* _Nullable input, NSData* _Nullable iv, NSError* _Nullable* _Nullable error);
|
||||
|
||||
#endif
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
// Objective-C API for talking to Go package.
|
||||
// gobind -lang=objc
|
||||
//
|
||||
// File is generated by gobind. Do not edit.
|
||||
|
||||
#ifndef __Universe_H__
|
||||
#define __Universe_H__
|
||||
|
||||
@import Foundation;
|
||||
#include "ref.h"
|
||||
|
||||
@protocol Universeerror;
|
||||
@class Universeerror;
|
||||
|
||||
@protocol Universeerror <NSObject>
|
||||
- (NSString* _Nonnull)error;
|
||||
@end
|
||||
|
||||
@class Universeerror;
|
||||
|
||||
@interface Universeerror : NSError <goSeqRefInterface, Universeerror> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (NSString* _Nonnull)error;
|
||||
@end
|
||||
|
||||
#endif
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
// Copyright 2015 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
#ifndef __GO_REF_HDR__
|
||||
#define __GO_REF_HDR__
|
||||
|
||||
#include <Foundation/Foundation.h>
|
||||
|
||||
// GoSeqRef is an object tagged with an integer for passing back and
|
||||
// forth across the language boundary. A GoSeqRef may represent either
|
||||
// an instance of a Go object, or an Objective-C object passed to Go.
|
||||
// The explicit allocation of a GoSeqRef is used to pin a Go object
|
||||
// when it is passed to Objective-C. The Go seq package maintains a
|
||||
// reference to the Go object in a map keyed by the refnum along with
|
||||
// a reference count. When the reference count reaches zero, the Go
|
||||
// seq package will clear the corresponding entry in the map.
|
||||
@interface GoSeqRef : NSObject {
|
||||
}
|
||||
@property(readonly) int32_t refnum;
|
||||
@property(strong) id obj; // NULL when representing a Go object.
|
||||
|
||||
// new GoSeqRef object to proxy a Go object. The refnum must be
|
||||
// provided from Go side.
|
||||
- (instancetype)initWithRefnum:(int32_t)refnum obj:(id)obj;
|
||||
|
||||
- (int32_t)incNum;
|
||||
|
||||
@end
|
||||
|
||||
@protocol goSeqRefInterface
|
||||
-(GoSeqRef*) _ref;
|
||||
@end
|
||||
|
||||
#endif
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
framework module "GoLibs" {
|
||||
header "ref.h"
|
||||
header "Crypto.objc.h"
|
||||
header "Armor.objc.h"
|
||||
header "Constants.objc.h"
|
||||
header "Models.objc.h"
|
||||
header "Subtle.objc.h"
|
||||
header "Helper.objc.h"
|
||||
header "Srp.objc.h"
|
||||
header "Universe.objc.h"
|
||||
header "GoLibs.h"
|
||||
|
||||
export *
|
||||
}
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
<?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>CFBundleExecutable</key>
|
||||
<string>GoLibs</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>GoLibs</string>
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>100.0</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.0.1756305245</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>0.0.1756305245</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
@ -1 +0,0 @@
|
|||
A
|
||||
Binary file not shown.
|
|
@ -1,39 +0,0 @@
|
|||
// Objective-C API for talking to github.com/ProtonMail/gopenpgp/v2/armor Go package.
|
||||
// gobind -lang=objc github.com/ProtonMail/gopenpgp/v2/armor
|
||||
//
|
||||
// File is generated by gobind. Do not edit.
|
||||
|
||||
#ifndef __Armor_H__
|
||||
#define __Armor_H__
|
||||
|
||||
@import Foundation;
|
||||
#include "ref.h"
|
||||
#include "Universe.objc.h"
|
||||
|
||||
#include "Constants.objc.h"
|
||||
|
||||
/**
|
||||
* ArmorKey armors input as a public key.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull ArmorArmorKey(NSData* _Nullable input, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* ArmorWithType armors input with the given armorType.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull ArmorArmorWithType(NSData* _Nullable input, NSString* _Nullable armorType, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* ArmorWithTypeAndCustomHeaders armors input with the given armorType and
|
||||
headers.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull ArmorArmorWithTypeAndCustomHeaders(NSData* _Nullable input, NSString* _Nullable armorType, NSString* _Nullable version, NSString* _Nullable comment, NSError* _Nullable* _Nullable error);
|
||||
|
||||
// skipped function ArmorWithTypeBuffered with unsupported parameter or return types
|
||||
|
||||
|
||||
/**
|
||||
* Unarmor unarmors an armored input into a byte array.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable ArmorUnarmor(NSString* _Nullable input, NSError* _Nullable* _Nullable error);
|
||||
|
||||
#endif
|
||||
|
|
@ -1,72 +0,0 @@
|
|||
// Objective-C API for talking to github.com/ProtonMail/gopenpgp/v2/constants Go package.
|
||||
// gobind -lang=objc github.com/ProtonMail/gopenpgp/v2/constants
|
||||
//
|
||||
// File is generated by gobind. Do not edit.
|
||||
|
||||
#ifndef __Constants_H__
|
||||
#define __Constants_H__
|
||||
|
||||
@import Foundation;
|
||||
#include "ref.h"
|
||||
#include "Universe.objc.h"
|
||||
|
||||
|
||||
/**
|
||||
* Cipher suite names.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsAES128;
|
||||
/**
|
||||
* Cipher suite names.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsAES192;
|
||||
/**
|
||||
* Cipher suite names.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsAES256;
|
||||
/**
|
||||
* Constants for armored data.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsArmorHeaderComment;
|
||||
/**
|
||||
* Constants for armored data.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsArmorHeaderVersion;
|
||||
/**
|
||||
* Cipher suite names.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsCAST5;
|
||||
FOUNDATION_EXPORT const int64_t ConstantsDefaultCompression;
|
||||
FOUNDATION_EXPORT const int64_t ConstantsDefaultCompressionLevel;
|
||||
/**
|
||||
* Constants for armored data.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsPGPMessageHeader;
|
||||
/**
|
||||
* Constants for armored data.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsPGPSignatureHeader;
|
||||
/**
|
||||
* Constants for armored data.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsPrivateKeyHeader;
|
||||
/**
|
||||
* Constants for armored data.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsPublicKeyHeader;
|
||||
FOUNDATION_EXPORT const long ConstantsSIGNATURE_BAD_CONTEXT;
|
||||
FOUNDATION_EXPORT const long ConstantsSIGNATURE_FAILED;
|
||||
FOUNDATION_EXPORT const long ConstantsSIGNATURE_NOT_SIGNED;
|
||||
FOUNDATION_EXPORT const long ConstantsSIGNATURE_NO_VERIFIER;
|
||||
FOUNDATION_EXPORT const long ConstantsSIGNATURE_OK;
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsSignatureContextName;
|
||||
/**
|
||||
* Cipher suite names.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsThreeDES;
|
||||
/**
|
||||
* Cipher suite names.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsTripleDES;
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsVersion;
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,25 +0,0 @@
|
|||
|
||||
// Objective-C API for talking to the following Go packages
|
||||
//
|
||||
// github.com/ProtonMail/gopenpgp/v2/crypto
|
||||
// github.com/ProtonMail/gopenpgp/v2/armor
|
||||
// github.com/ProtonMail/gopenpgp/v2/constants
|
||||
// github.com/ProtonMail/gopenpgp/v2/models
|
||||
// github.com/ProtonMail/gopenpgp/v2/subtle
|
||||
// github.com/ProtonMail/gopenpgp/v2/helper
|
||||
// github.com/ProtonMail/go-srp
|
||||
//
|
||||
// File is generated by gomobile bind. Do not edit.
|
||||
#ifndef __GoLibs_FRAMEWORK_H__
|
||||
#define __GoLibs_FRAMEWORK_H__
|
||||
|
||||
#include "Crypto.objc.h"
|
||||
#include "Armor.objc.h"
|
||||
#include "Constants.objc.h"
|
||||
#include "Models.objc.h"
|
||||
#include "Subtle.objc.h"
|
||||
#include "Helper.objc.h"
|
||||
#include "Srp.objc.h"
|
||||
#include "Universe.objc.h"
|
||||
|
||||
#endif
|
||||
|
|
@ -1,481 +0,0 @@
|
|||
// Objective-C API for talking to github.com/ProtonMail/gopenpgp/v2/helper Go package.
|
||||
// gobind -lang=objc github.com/ProtonMail/gopenpgp/v2/helper
|
||||
//
|
||||
// File is generated by gobind. Do not edit.
|
||||
|
||||
#ifndef __Helper_H__
|
||||
#define __Helper_H__
|
||||
|
||||
@import Foundation;
|
||||
#include "ref.h"
|
||||
#include "Universe.objc.h"
|
||||
|
||||
#include "Crypto.objc.h"
|
||||
|
||||
@class HelperEncryptSignArmoredDetachedMobileResult;
|
||||
@class HelperEncryptSignBinaryDetachedMobileResult;
|
||||
@class HelperExplicitVerifyMessage;
|
||||
@class HelperGo2AndroidReader;
|
||||
@class HelperGo2IOSReader;
|
||||
@class HelperMobile2GoReader;
|
||||
@class HelperMobile2GoWriter;
|
||||
@class HelperMobile2GoWriterWithSHA256;
|
||||
@class HelperMobileReadResult;
|
||||
@protocol HelperMobileReader;
|
||||
@class HelperMobileReader;
|
||||
|
||||
@protocol HelperMobileReader <NSObject>
|
||||
- (HelperMobileReadResult* _Nullable)read:(long)max error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
@interface HelperEncryptSignArmoredDetachedMobileResult : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) NSString* _Nonnull ciphertextArmored;
|
||||
@property (nonatomic) NSString* _Nonnull encryptedSignatureArmored;
|
||||
@end
|
||||
|
||||
@interface HelperEncryptSignBinaryDetachedMobileResult : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) NSData* _Nullable encryptedData;
|
||||
@property (nonatomic) NSString* _Nonnull encryptedSignatureArmored;
|
||||
@end
|
||||
|
||||
@interface HelperExplicitVerifyMessage : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) CryptoPlainMessage* _Nullable message;
|
||||
@property (nonatomic) CryptoSignatureVerificationError* _Nullable signatureVerificationError;
|
||||
@end
|
||||
|
||||
/**
|
||||
* Go2AndroidReader is used to wrap a native golang Reader in the golang runtime,
|
||||
to be usable in the android app runtime (via gomobile).
|
||||
*/
|
||||
@interface HelperGo2AndroidReader : NSObject <goSeqRefInterface, CryptoReader> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
/**
|
||||
* NewGo2AndroidReader wraps a native golang Reader to be usable in the mobile app runtime (via gomobile).
|
||||
It doesn't follow the standard golang Reader behavior, and returns n = -1 on EOF.
|
||||
*/
|
||||
- (nullable instancetype)init:(id<CryptoReader> _Nullable)reader;
|
||||
/**
|
||||
* Read reads bytes into the provided buffer and returns the number of bytes read
|
||||
It doesn't follow the standard golang Reader behavior, and returns n = -1 on EOF.
|
||||
*/
|
||||
- (BOOL)read:(NSData* _Nullable)b n:(long* _Nullable)n error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
/**
|
||||
* Go2IOSReader is used to wrap a native golang Reader in the golang runtime,
|
||||
to be usable in the iOS app runtime (via gomobile) as a MobileReader.
|
||||
*/
|
||||
@interface HelperGo2IOSReader : NSObject <goSeqRefInterface, HelperMobileReader> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
/**
|
||||
* NewGo2IOSReader wraps a native golang Reader to be usable in the ios app runtime (via gomobile).
|
||||
*/
|
||||
- (nullable instancetype)init:(id<CryptoReader> _Nullable)reader;
|
||||
/**
|
||||
* Read reads at most <max> bytes from the wrapped Reader and returns the read data as a MobileReadResult.
|
||||
*/
|
||||
- (HelperMobileReadResult* _Nullable)read:(long)max error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
/**
|
||||
* Mobile2GoReader is used to wrap a MobileReader in the mobile app runtime,
|
||||
to be usable in the golang runtime (via gomobile) as a native Reader.
|
||||
*/
|
||||
@interface HelperMobile2GoReader : NSObject <goSeqRefInterface, CryptoReader> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
/**
|
||||
* NewMobile2GoReader wraps a MobileReader to be usable in the golang runtime (via gomobile).
|
||||
*/
|
||||
- (nullable instancetype)init:(id<HelperMobileReader> _Nullable)reader;
|
||||
/**
|
||||
* Read reads data from the wrapped MobileReader and copies the read data in the provided buffer.
|
||||
It also handles the conversion of EOF to an error.
|
||||
*/
|
||||
- (BOOL)read:(NSData* _Nullable)b n:(long* _Nullable)n error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
/**
|
||||
* Mobile2GoWriter is used to wrap a writer in the mobile app runtime,
|
||||
to be usable in the golang runtime (via gomobile).
|
||||
*/
|
||||
@interface HelperMobile2GoWriter : NSObject <goSeqRefInterface, CryptoWriter> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
/**
|
||||
* NewMobile2GoWriter wraps a writer to be usable in the golang runtime (via gomobile).
|
||||
*/
|
||||
- (nullable instancetype)init:(id<CryptoWriter> _Nullable)writer;
|
||||
/**
|
||||
* Write writes the data in the provided buffer in the wrapped writer.
|
||||
It clones the provided data to prevent errors with garbage collectors.
|
||||
*/
|
||||
- (BOOL)write:(NSData* _Nullable)b n:(long* _Nullable)n error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
/**
|
||||
* Mobile2GoWriterWithSHA256 is used to wrap a writer in the mobile app runtime,
|
||||
to be usable in the golang runtime (via gomobile).
|
||||
It also computes the SHA256 hash of the data being written on the fly.
|
||||
*/
|
||||
@interface HelperMobile2GoWriterWithSHA256 : NSObject <goSeqRefInterface, CryptoWriter> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
/**
|
||||
* NewMobile2GoWriterWithSHA256 wraps a writer to be usable in the golang runtime (via gomobile).
|
||||
The wrapper also computes the SHA256 hash of the data being written on the fly.
|
||||
*/
|
||||
- (nullable instancetype)init:(id<CryptoWriter> _Nullable)writer;
|
||||
/**
|
||||
* GetSHA256 returns the SHA256 hash of the data that's been written so far.
|
||||
*/
|
||||
- (NSData* _Nullable)getSHA256;
|
||||
/**
|
||||
* Write writes the data in the provided buffer in the wrapped writer.
|
||||
It clones the provided data to prevent errors with garbage collectors.
|
||||
It also computes the SHA256 hash of the data being written on the fly.
|
||||
*/
|
||||
- (BOOL)write:(NSData* _Nullable)b n:(long* _Nullable)n error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
/**
|
||||
* MobileReadResult is what needs to be returned by MobileReader.Read.
|
||||
The read data is passed as a return value rather than passed as an argument to the reader.
|
||||
This avoids problems introduced by gomobile that prevent the use of native golang readers.
|
||||
*/
|
||||
@interface HelperMobileReadResult : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
/**
|
||||
* NewMobileReadResult initialize a MobileReadResult with the correct values.
|
||||
It clones the data to avoid the garbage collector freeing the data too early.
|
||||
*/
|
||||
- (nullable instancetype)init:(long)n eof:(BOOL)eof data:(NSData* _Nullable)data;
|
||||
@property (nonatomic) long n;
|
||||
@property (nonatomic) BOOL isEOF;
|
||||
@property (nonatomic) NSData* _Nullable data;
|
||||
@end
|
||||
|
||||
FOUNDATION_EXPORT const int64_t HelperAES_BLOCK_SIZE;
|
||||
|
||||
/**
|
||||
* DecryptAttachment takes a keypacket and datpacket
|
||||
and returns a decrypted PlainMessage
|
||||
Specifically designed for attachments rather than text messages.
|
||||
*/
|
||||
FOUNDATION_EXPORT CryptoPlainMessage* _Nullable HelperDecryptAttachment(NSData* _Nullable keyPacket, NSData* _Nullable dataPacket, CryptoKeyRing* _Nullable keyRing, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptAttachmentWithKey decrypts a binary file
|
||||
Using a given armored private key and its passphrase.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable HelperDecryptAttachmentWithKey(NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSData* _Nullable keyPacket, NSData* _Nullable dataPacket, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptBinaryMessageArmored decrypts an armored PGP message given a private key
|
||||
and its passphrase.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable HelperDecryptBinaryMessageArmored(NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSString* _Nullable ciphertext, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptExplicitVerify decrypts a PGP message given a private keyring
|
||||
and a public keyring to verify the embedded signature. Returns the plain
|
||||
data and an error on signature verification failure.
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperExplicitVerifyMessage* _Nullable HelperDecryptExplicitVerify(CryptoPGPMessage* _Nullable pgpMessage, CryptoKeyRing* _Nullable privateKeyRing, CryptoKeyRing* _Nullable publicKeyRing, int64_t verifyTime, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptExplicitVerifyWithContext decrypts a PGP message given a private keyring
|
||||
and a public keyring to verify the embedded signature. Returns the plain
|
||||
data and an error on signature verification failure.
|
||||
The caller can provide a context that will be used to verify the signature.
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperExplicitVerifyMessage* _Nullable HelperDecryptExplicitVerifyWithContext(CryptoPGPMessage* _Nullable pgpMessage, CryptoKeyRing* _Nullable privateKeyRing, CryptoKeyRing* _Nullable publicKeyRing, int64_t verifyTime, CryptoVerificationContext* _Nullable verificationContext, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptMessageArmored decrypts an armored PGP message given a private key
|
||||
and its passphrase.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperDecryptMessageArmored(NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSString* _Nullable ciphertext, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptMessageWithPassword decrypts an armored message with a random token.
|
||||
The algorithm is derived from the armoring.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperDecryptMessageWithPassword(NSData* _Nullable password, NSString* _Nullable ciphertext, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptSessionKey decrypts a session key
|
||||
using a given armored private key
|
||||
and its passphrase.
|
||||
*/
|
||||
FOUNDATION_EXPORT CryptoSessionKey* _Nullable HelperDecryptSessionKey(NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSData* _Nullable encryptedSessionKey, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptSessionKeyExplicitVerify decrypts a PGP data packet given a session key
|
||||
and a public keyring to verify the embedded signature. Returns the plain data and
|
||||
an error on signature verification failure.
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperExplicitVerifyMessage* _Nullable HelperDecryptSessionKeyExplicitVerify(NSData* _Nullable dataPacket, CryptoSessionKey* _Nullable sessionKey, CryptoKeyRing* _Nullable publicKeyRing, int64_t verifyTime, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptSessionKeyExplicitVerifyWithContext decrypts a PGP data packet given a session key
|
||||
and a public keyring to verify the embedded signature. Returns the plain data and
|
||||
an error on signature verification failure.
|
||||
The caller can provide a context that will be used to verify the signature.
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperExplicitVerifyMessage* _Nullable HelperDecryptSessionKeyExplicitVerifyWithContext(NSData* _Nullable dataPacket, CryptoSessionKey* _Nullable sessionKey, CryptoKeyRing* _Nullable publicKeyRing, int64_t verifyTime, CryptoVerificationContext* _Nullable verificationContext, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptVerifyArmoredDetached decrypts an armored pgp message
|
||||
and verify a detached armored encrypted signature
|
||||
given a publicKey, and a privateKey with its passphrase.
|
||||
Returns the plain data or an error on
|
||||
signature verification failure.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable HelperDecryptVerifyArmoredDetached(NSString* _Nullable publicKey, NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSString* _Nullable ciphertextArmored, NSString* _Nullable encryptedSignatureArmored, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptVerifyAttachment decrypts and verifies an attachment split into the
|
||||
keyPacket, dataPacket and an armored (!) signature, given a publicKey, and a
|
||||
privateKey with its passphrase. Returns the plain data or an error on
|
||||
signature verification failure.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable HelperDecryptVerifyAttachment(NSString* _Nullable publicKey, NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSData* _Nullable keyPacket, NSData* _Nullable dataPacket, NSString* _Nullable armoredSignature, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptVerifyBinaryDetached decrypts binary encrypted data
|
||||
and verify a detached armored encrypted signature
|
||||
given a publicKey, and a privateKey with its passphrase.
|
||||
Returns the plain data or an error on
|
||||
signature verification failure.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable HelperDecryptVerifyBinaryDetached(NSString* _Nullable publicKey, NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSData* _Nullable encryptedData, NSString* _Nullable encryptedSignatureArmored, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptVerifyMessageArmored decrypts an armored PGP message given a private
|
||||
key and its passphrase and verifies the embedded signature. Returns the
|
||||
plain data or an error on signature verification failure.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperDecryptVerifyMessageArmored(NSString* _Nullable publicKey, NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSString* _Nullable ciphertext, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptAttachment encrypts a file given a plainData and a fileName.
|
||||
Returns a PGPSplitMessage containing a session key packet and symmetrically
|
||||
encrypted data. Specifically designed for attachments rather than text
|
||||
messages.
|
||||
*/
|
||||
FOUNDATION_EXPORT CryptoPGPSplitMessage* _Nullable HelperEncryptAttachment(NSData* _Nullable plainData, NSString* _Nullable filename, CryptoKeyRing* _Nullable keyRing, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptAttachmentWithKey encrypts a binary file
|
||||
Using a given armored public key.
|
||||
*/
|
||||
FOUNDATION_EXPORT CryptoPGPSplitMessage* _Nullable HelperEncryptAttachmentWithKey(NSString* _Nullable publicKey, NSString* _Nullable filename, NSData* _Nullable plainData, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptBinaryMessageArmored generates an armored PGP message given a binary data and
|
||||
an armored public key.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperEncryptBinaryMessageArmored(NSString* _Nullable key, NSData* _Nullable data, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptMessageArmored generates an armored PGP message given a plaintext and
|
||||
an armored public key.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperEncryptMessageArmored(NSString* _Nullable key, NSString* _Nullable plaintext, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptMessageWithPassword encrypts a string with a passphrase using AES256.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperEncryptMessageWithPassword(NSData* _Nullable password, NSString* _Nullable plaintext, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptPGPMessageToAdditionalKey decrypts the session key of the input PGPSplitMessage with a private key in keyRing
|
||||
and encrypts it towards the additionalKeys by adding the additional key packets to the input PGPSplitMessage.
|
||||
If successful, new key packets are added to message.
|
||||
* messageToModify : The encrypted pgp message that should be modified
|
||||
* keyRing : The private keys to decrypt the session key in the messageToModify.
|
||||
* additionalKey : The public keys the message should be additionally encrypted to.
|
||||
*/
|
||||
FOUNDATION_EXPORT BOOL HelperEncryptPGPMessageToAdditionalKey(CryptoPGPSplitMessage* _Nullable messageToModify, CryptoKeyRing* _Nullable keyRing, CryptoKeyRing* _Nullable additionalKey, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptSessionKey encrypts a session key
|
||||
using a given armored public key.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable HelperEncryptSessionKey(NSString* _Nullable publicKey, CryptoSessionKey* _Nullable sessionKey, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptSignArmoredDetachedMobile wraps the encryptSignArmoredDetached method
|
||||
to have only one return argument for mobile.
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperEncryptSignArmoredDetachedMobileResult* _Nullable HelperEncryptSignArmoredDetachedMobile(NSString* _Nullable publicKey, NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSData* _Nullable plainData, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptSignBinaryDetachedMobile wraps the encryptSignBinaryDetached method
|
||||
to have only one return argument for mobile.
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperEncryptSignBinaryDetachedMobileResult* _Nullable HelperEncryptSignBinaryDetachedMobile(NSString* _Nullable publicKey, NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSData* _Nullable plainData, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptSignMessageArmored generates an armored signed PGP message given a
|
||||
plaintext and an armored public key a private key and its passphrase.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperEncryptSignMessageArmored(NSString* _Nullable publicKey, NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSString* _Nullable plaintext, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* FreeOSMemory can be used to explicitly
|
||||
call the garbage collector and
|
||||
return the unused memory to the OS.
|
||||
*/
|
||||
FOUNDATION_EXPORT void HelperFreeOSMemory(void);
|
||||
|
||||
/**
|
||||
* GenerateKey generates a key of the given keyType ("rsa" or "x25519"), encrypts it, and returns an armored string.
|
||||
If keyType is "rsa", bits is the RSA bitsize of the key.
|
||||
If keyType is "x25519" bits is unused.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperGenerateKey(NSString* _Nullable name, NSString* _Nullable email, NSData* _Nullable passphrase, NSString* _Nullable keyType, long bits, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* GetJsonSHA256Fingerprints returns the SHA256 fingeprints of key and subkeys,
|
||||
encoded in JSON, since gomobile can not handle arrays.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable HelperGetJsonSHA256Fingerprints(NSString* _Nullable publicKey, NSError* _Nullable* _Nullable error);
|
||||
|
||||
// skipped function GetSHA256Fingerprints with unsupported parameter or return types
|
||||
|
||||
|
||||
/**
|
||||
* NewGo2AndroidReader wraps a native golang Reader to be usable in the mobile app runtime (via gomobile).
|
||||
It doesn't follow the standard golang Reader behavior, and returns n = -1 on EOF.
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperGo2AndroidReader* _Nullable HelperNewGo2AndroidReader(id<CryptoReader> _Nullable reader);
|
||||
|
||||
/**
|
||||
* NewGo2IOSReader wraps a native golang Reader to be usable in the ios app runtime (via gomobile).
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperGo2IOSReader* _Nullable HelperNewGo2IOSReader(id<CryptoReader> _Nullable reader);
|
||||
|
||||
/**
|
||||
* NewMobile2GoReader wraps a MobileReader to be usable in the golang runtime (via gomobile).
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperMobile2GoReader* _Nullable HelperNewMobile2GoReader(id<HelperMobileReader> _Nullable reader);
|
||||
|
||||
/**
|
||||
* NewMobile2GoWriter wraps a writer to be usable in the golang runtime (via gomobile).
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperMobile2GoWriter* _Nullable HelperNewMobile2GoWriter(id<CryptoWriter> _Nullable writer);
|
||||
|
||||
/**
|
||||
* NewMobile2GoWriterWithSHA256 wraps a writer to be usable in the golang runtime (via gomobile).
|
||||
The wrapper also computes the SHA256 hash of the data being written on the fly.
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperMobile2GoWriterWithSHA256* _Nullable HelperNewMobile2GoWriterWithSHA256(id<CryptoWriter> _Nullable writer);
|
||||
|
||||
/**
|
||||
* NewMobileReadResult initialize a MobileReadResult with the correct values.
|
||||
It clones the data to avoid the garbage collector freeing the data too early.
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperMobileReadResult* _Nullable HelperNewMobileReadResult(long n, BOOL eof, NSData* _Nullable data);
|
||||
|
||||
/**
|
||||
* QuickCheckDecrypt checks with high probability if the provided session key
|
||||
can decrypt the encrypted data packet given its 24 byte long prefix.
|
||||
The method only considers the first 24 bytes of the prefix slice (prefix[:24]).
|
||||
NOTE: Only works for SEIPDv1 packets with AES.
|
||||
*/
|
||||
FOUNDATION_EXPORT BOOL HelperQuickCheckDecrypt(CryptoSessionKey* _Nullable sessionKey, NSData* _Nullable prefix, BOOL* _Nullable ret0_, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* QuickCheckDecryptReader checks with high probability if the provided session key
|
||||
can decrypt a data packet given its 24 byte long prefix.
|
||||
The method reads up to but not exactly 24 bytes from the prefixReader.
|
||||
NOTE: Only works for SEIPDv1 packets with AES.
|
||||
*/
|
||||
FOUNDATION_EXPORT BOOL HelperQuickCheckDecryptReader(CryptoSessionKey* _Nullable sessionKey, id<CryptoReader> _Nullable prefixReader, BOOL* _Nullable ret0_, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* SignCleartextMessage signs text given a private keyring, canonicalizes and
|
||||
trims the newlines, and returns the PGP-compliant special armoring.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperSignCleartextMessage(CryptoKeyRing* _Nullable keyRing, NSString* _Nullable text, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* SignCleartextMessageArmored signs text given a private key and its
|
||||
passphrase, canonicalizes and trims the newlines, and returns the
|
||||
PGP-compliant special armoring.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperSignCleartextMessageArmored(NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSString* _Nullable text, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* UpdatePrivateKeyPassphrase decrypts the given armored privateKey with oldPassphrase,
|
||||
re-encrypts it with newPassphrase, and returns the new armored key.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperUpdatePrivateKeyPassphrase(NSString* _Nullable privateKey, NSData* _Nullable oldPassphrase, NSData* _Nullable newPassphrase, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* VerifyCleartextMessage verifies PGP-compliant armored signed plain text
|
||||
given the public keyring and returns the text or err if the verification
|
||||
fails.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperVerifyCleartextMessage(CryptoKeyRing* _Nullable keyRing, NSString* _Nullable armored, int64_t verifyTime, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* VerifyCleartextMessageArmored verifies PGP-compliant armored signed plain
|
||||
text given the public key and returns the text or err if the verification
|
||||
fails.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperVerifyCleartextMessageArmored(NSString* _Nullable publicKey, NSString* _Nullable armored, int64_t verifyTime, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* VerifySignatureExplicit calls the reader's VerifySignature()
|
||||
and tries to cast the returned error to a SignatureVerificationError.
|
||||
*/
|
||||
FOUNDATION_EXPORT CryptoSignatureVerificationError* _Nullable HelperVerifySignatureExplicit(CryptoPlainMessageReader* _Nullable reader, NSError* _Nullable* _Nullable error);
|
||||
|
||||
@class HelperMobileReader;
|
||||
|
||||
/**
|
||||
* MobileReader is the interface that readers in the mobile runtime must use and implement.
|
||||
This is a workaround to some of the gomobile limitations.
|
||||
*/
|
||||
@interface HelperMobileReader : NSObject <goSeqRefInterface, HelperMobileReader> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (HelperMobileReadResult* _Nullable)read:(long)max error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
#endif
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
// Objective-C API for talking to github.com/ProtonMail/gopenpgp/v2/models Go package.
|
||||
// gobind -lang=objc github.com/ProtonMail/gopenpgp/v2/models
|
||||
//
|
||||
// File is generated by gobind. Do not edit.
|
||||
|
||||
#ifndef __Models_H__
|
||||
#define __Models_H__
|
||||
|
||||
@import Foundation;
|
||||
#include "ref.h"
|
||||
#include "Universe.objc.h"
|
||||
|
||||
|
||||
@class ModelsEncryptedSigned;
|
||||
|
||||
/**
|
||||
* EncryptedSigned contains an encrypted message and signature.
|
||||
*/
|
||||
@interface ModelsEncryptedSigned : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) NSString* _Nonnull encrypted;
|
||||
@property (nonatomic) NSString* _Nonnull signature;
|
||||
@end
|
||||
|
||||
#endif
|
||||
|
|
@ -1,265 +0,0 @@
|
|||
// Objective-C API for talking to github.com/ProtonMail/go-srp Go package.
|
||||
// gobind -lang=objc github.com/ProtonMail/go-srp
|
||||
//
|
||||
// File is generated by gobind. Do not edit.
|
||||
|
||||
#ifndef __Srp_H__
|
||||
#define __Srp_H__
|
||||
|
||||
@import Foundation;
|
||||
#include "ref.h"
|
||||
#include "Universe.objc.h"
|
||||
|
||||
|
||||
@class SrpAuth;
|
||||
@class SrpProofs;
|
||||
@class SrpServer;
|
||||
|
||||
/**
|
||||
* Auth stores byte data for the calculation of SRP proofs.
|
||||
* Changed SrpAuto to Auth because the name will be used as srp.SrpAuto by other packages and as SrpSrpAuth on mobile
|
||||
* Also the data from the API called Auth. it could be match the meaning and reduce the confusion
|
||||
*/
|
||||
@interface SrpAuth : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
/**
|
||||
* NewAuth Creates new Auth from strings input. Salt and server ephemeral are in
|
||||
base64 format. Modulus is base64 with signature attached. The signature is
|
||||
verified against server key. The version controls password hash algorithm.
|
||||
|
||||
Parameters:
|
||||
- version int: The *x* component of the vector.
|
||||
- username string: The *y* component of the vector.
|
||||
- password []byte: The *z* component of the vector.
|
||||
- b64salt string: The std-base64 formatted salt
|
||||
Returns:
|
||||
- auth *Auth: the pre calculated auth information
|
||||
- err error: throw error
|
||||
Usage:
|
||||
|
||||
Warnings:
|
||||
- Be careful! Poos can hurt.
|
||||
*/
|
||||
- (nullable instancetype)init:(long)version username:(NSString* _Nullable)username password:(NSData* _Nullable)password b64salt:(NSString* _Nullable)b64salt signedModulus:(NSString* _Nullable)signedModulus serverEphemeral:(NSString* _Nullable)serverEphemeral;
|
||||
/**
|
||||
* NewAuthForVerifier Creates new Auth from strings input. Salt and server ephemeral are in
|
||||
base64 format. Modulus is base64 with signature attached. The signature is
|
||||
verified against server key. The version controls password hash algorithm.
|
||||
|
||||
Parameters:
|
||||
- version int: The *x* component of the vector.
|
||||
- username string: The *y* component of the vector.
|
||||
- password []byte: The *z* component of the vector.
|
||||
- salt string:
|
||||
Returns:
|
||||
- auth *Auth: the pre calculated auth information
|
||||
- err error: throw error
|
||||
Usage:
|
||||
|
||||
Warnings:
|
||||
- none.
|
||||
*/
|
||||
- (nullable instancetype)initForVerifier:(NSData* _Nullable)password signedModulus:(NSString* _Nullable)signedModulus rawSalt:(NSData* _Nullable)rawSalt;
|
||||
@property (nonatomic) NSData* _Nullable modulus;
|
||||
@property (nonatomic) NSData* _Nullable serverEphemeral;
|
||||
@property (nonatomic) NSData* _Nullable hashedPassword;
|
||||
@property (nonatomic) long version;
|
||||
/**
|
||||
* GenerateProofs calculates SPR proofs.
|
||||
*/
|
||||
- (SrpProofs* _Nullable)generateProofs:(long)bitLength error:(NSError* _Nullable* _Nullable)error;
|
||||
/**
|
||||
* GenerateVerifier verifier for update pwds and create accounts
|
||||
*/
|
||||
- (NSData* _Nullable)generateVerifier:(long)bitLength error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
/**
|
||||
* Proofs Srp Proofs object. Changed SrpProofs to Proofs because the name will be used as srp.SrpProofs by other packages and as SrpSrpProofs on mobile
|
||||
ClientProof []byte client proof
|
||||
ClientEphemeral []byte calculated from
|
||||
ExpectedServerProof []byte
|
||||
*/
|
||||
@interface SrpProofs : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) NSData* _Nullable clientProof;
|
||||
@property (nonatomic) NSData* _Nullable clientEphemeral;
|
||||
@property (nonatomic) NSData* _Nullable expectedServerProof;
|
||||
@end
|
||||
|
||||
/**
|
||||
* Server stores the internal state for the validation of SRP proofs.
|
||||
*/
|
||||
@interface SrpServer : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
/**
|
||||
* NewServer creates a new server instance from the raw binary data.
|
||||
*/
|
||||
- (nullable instancetype)init:(NSData* _Nullable)modulusBytes verifier:(NSData* _Nullable)verifier bitLength:(long)bitLength;
|
||||
/**
|
||||
* NewServerFromSigned creates a new server instance from the signed modulus and the binary verifier.
|
||||
*/
|
||||
- (nullable instancetype)initFromSigned:(NSString* _Nullable)signedModulus verifier:(NSData* _Nullable)verifier bitLength:(long)bitLength;
|
||||
/**
|
||||
* NewServerWithSecret creates a new server instance without generating a random secret from the raw binary data.
|
||||
Use with caution as the secret should not be reused.
|
||||
*/
|
||||
- (nullable instancetype)initWithSecret:(NSData* _Nullable)modulusBytes verifier:(NSData* _Nullable)verifier secretBytes:(NSData* _Nullable)secretBytes bitLength:(long)bitLength;
|
||||
/**
|
||||
* GenerateChallenge is the first step for SRP exchange, and generates a valid challenge for the provided verifier.
|
||||
*/
|
||||
- (NSData* _Nullable)generateChallenge:(NSError* _Nullable* _Nullable)error;
|
||||
/**
|
||||
* GetSharedSession returns the shared secret as byte if the session has concluded in valid state.
|
||||
*/
|
||||
- (NSData* _Nullable)getSharedSession:(NSError* _Nullable* _Nullable)error;
|
||||
/**
|
||||
* IsCompleted returns true if the exchange has been concluded in valid state.
|
||||
*/
|
||||
- (BOOL)isCompleted;
|
||||
/**
|
||||
* VerifyProofs Verifies the client proof and - if valid - generates the shared secret and returnd the server proof.
|
||||
It concludes the exchange in valid state if successful.
|
||||
*/
|
||||
- (NSData* _Nullable)verifyProofs:(NSData* _Nullable)clientEphemeralBytes clientProofBytes:(NSData* _Nullable)clientProofBytes error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const SrpVersion;
|
||||
|
||||
@interface Srp : NSObject
|
||||
/**
|
||||
* Implementation following the "context" package
|
||||
*/
|
||||
+ (NSError* _Nullable) deadlineExceeded;
|
||||
+ (void) setDeadlineExceeded:(NSError* _Nullable)v;
|
||||
|
||||
/**
|
||||
* ErrDataAfterModulus found extra data after decode the modulus
|
||||
*/
|
||||
+ (NSError* _Nullable) errDataAfterModulus;
|
||||
+ (void) setErrDataAfterModulus:(NSError* _Nullable)v;
|
||||
|
||||
/**
|
||||
* ErrInvalidSignature invalid modulus signature
|
||||
*/
|
||||
+ (NSError* _Nullable) errInvalidSignature;
|
||||
+ (void) setErrInvalidSignature:(NSError* _Nullable)v;
|
||||
|
||||
// skipped variable RandReader with unsupported type: io.Reader
|
||||
|
||||
@end
|
||||
|
||||
/**
|
||||
* Argon2PreimageChallenge computes the base64 solution for a given Argon2 base64
|
||||
challenge within deadlineUnixMilli milliseconds, if any was found. Deadlines are measured
|
||||
on the wall clock, not the monotonic clock, due to unreliability on mobile devices.
|
||||
deadlineUnixMilli = -1 means unlimited time.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull SrpArgon2PreimageChallenge(NSString* _Nullable b64Challenge, int64_t deadlineUnixMilli, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* ECDLPChallenge computes the base64 solution for a given ECDLP base64 challenge
|
||||
within deadlineUnixMilli milliseconds, if any was found. Deadlines are measured on the
|
||||
wall clock, not the monotonic clock, due to unreliability on mobile devices.
|
||||
deadlineUnixMilli = -1 means unlimited time.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull SrpECDLPChallenge(NSString* _Nullable b64Challenge, int64_t deadlineUnixMilli, NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT NSString* _Nonnull SrpGetModulusKey(void);
|
||||
|
||||
/**
|
||||
* HashPassword returns the hash of password argument. Based on version number
|
||||
following arguments are used in addition to password:
|
||||
* 0, 1, 2: userName and modulus
|
||||
* 3, 4: salt and modulus
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable SrpHashPassword(long authVersion, NSData* _Nullable password, NSString* _Nullable userName, NSData* _Nullable salt, NSData* _Nullable modulus, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* MailboxPassword get mailbox password hash
|
||||
|
||||
Parameters:
|
||||
- password []byte: a mailbox password
|
||||
- salt []byte: a salt is random 128 bits data
|
||||
Returns:
|
||||
- hashed []byte: a hashed password
|
||||
- err error: throw error
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable SrpMailboxPassword(NSData* _Nullable password, NSData* _Nullable salt, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* NewAuth Creates new Auth from strings input. Salt and server ephemeral are in
|
||||
base64 format. Modulus is base64 with signature attached. The signature is
|
||||
verified against server key. The version controls password hash algorithm.
|
||||
|
||||
Parameters:
|
||||
- version int: The *x* component of the vector.
|
||||
- username string: The *y* component of the vector.
|
||||
- password []byte: The *z* component of the vector.
|
||||
- b64salt string: The std-base64 formatted salt
|
||||
Returns:
|
||||
- auth *Auth: the pre calculated auth information
|
||||
- err error: throw error
|
||||
Usage:
|
||||
|
||||
Warnings:
|
||||
- Be careful! Poos can hurt.
|
||||
*/
|
||||
FOUNDATION_EXPORT SrpAuth* _Nullable SrpNewAuth(long version, NSString* _Nullable username, NSData* _Nullable password, NSString* _Nullable b64salt, NSString* _Nullable signedModulus, NSString* _Nullable serverEphemeral, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* NewAuthForVerifier Creates new Auth from strings input. Salt and server ephemeral are in
|
||||
base64 format. Modulus is base64 with signature attached. The signature is
|
||||
verified against server key. The version controls password hash algorithm.
|
||||
|
||||
Parameters:
|
||||
- version int: The *x* component of the vector.
|
||||
- username string: The *y* component of the vector.
|
||||
- password []byte: The *z* component of the vector.
|
||||
- salt string:
|
||||
Returns:
|
||||
- auth *Auth: the pre calculated auth information
|
||||
- err error: throw error
|
||||
Usage:
|
||||
|
||||
Warnings:
|
||||
- none.
|
||||
*/
|
||||
FOUNDATION_EXPORT SrpAuth* _Nullable SrpNewAuthForVerifier(NSData* _Nullable password, NSString* _Nullable signedModulus, NSData* _Nullable rawSalt, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* NewServer creates a new server instance from the raw binary data.
|
||||
*/
|
||||
FOUNDATION_EXPORT SrpServer* _Nullable SrpNewServer(NSData* _Nullable modulusBytes, NSData* _Nullable verifier, long bitLength, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* NewServerFromSigned creates a new server instance from the signed modulus and the binary verifier.
|
||||
*/
|
||||
FOUNDATION_EXPORT SrpServer* _Nullable SrpNewServerFromSigned(NSString* _Nullable signedModulus, NSData* _Nullable verifier, long bitLength, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* NewServerWithSecret creates a new server instance without generating a random secret from the raw binary data.
|
||||
Use with caution as the secret should not be reused.
|
||||
*/
|
||||
FOUNDATION_EXPORT SrpServer* _Nullable SrpNewServerWithSecret(NSData* _Nullable modulusBytes, NSData* _Nullable verifier, NSData* _Nullable secretBytes, long bitLength, NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT NSData* _Nullable SrpRandomBits(long bits, NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT NSData* _Nullable SrpRandomBytes(long byes, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* VersionNumber get current library version
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull SrpVersionNumber(void);
|
||||
|
||||
#endif
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
// Objective-C API for talking to github.com/ProtonMail/gopenpgp/v2/subtle Go package.
|
||||
// gobind -lang=objc github.com/ProtonMail/gopenpgp/v2/subtle
|
||||
//
|
||||
// File is generated by gobind. Do not edit.
|
||||
|
||||
#ifndef __Subtle_H__
|
||||
#define __Subtle_H__
|
||||
|
||||
@import Foundation;
|
||||
#include "ref.h"
|
||||
#include "Universe.objc.h"
|
||||
|
||||
|
||||
/**
|
||||
* DecryptWithoutIntegrity decrypts data encrypted with AES-CTR.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable SubtleDecryptWithoutIntegrity(NSData* _Nullable key, NSData* _Nullable input, NSData* _Nullable iv, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DeriveKey derives a key from a password using scrypt. n should be set to the
|
||||
highest power of 2 you can derive within 100 milliseconds.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable SubtleDeriveKey(NSString* _Nullable password, NSData* _Nullable salt, long n, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptWithoutIntegrity encrypts data with AES-CTR. Note: this encryption
|
||||
mode is not secure when stored/sent on an untrusted medium.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable SubtleEncryptWithoutIntegrity(NSData* _Nullable key, NSData* _Nullable input, NSData* _Nullable iv, NSError* _Nullable* _Nullable error);
|
||||
|
||||
#endif
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
// Objective-C API for talking to Go package.
|
||||
// gobind -lang=objc
|
||||
//
|
||||
// File is generated by gobind. Do not edit.
|
||||
|
||||
#ifndef __Universe_H__
|
||||
#define __Universe_H__
|
||||
|
||||
@import Foundation;
|
||||
#include "ref.h"
|
||||
|
||||
@protocol Universeerror;
|
||||
@class Universeerror;
|
||||
|
||||
@protocol Universeerror <NSObject>
|
||||
- (NSString* _Nonnull)error;
|
||||
@end
|
||||
|
||||
@class Universeerror;
|
||||
|
||||
@interface Universeerror : NSError <goSeqRefInterface, Universeerror> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (NSString* _Nonnull)error;
|
||||
@end
|
||||
|
||||
#endif
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
// Copyright 2015 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
#ifndef __GO_REF_HDR__
|
||||
#define __GO_REF_HDR__
|
||||
|
||||
#include <Foundation/Foundation.h>
|
||||
|
||||
// GoSeqRef is an object tagged with an integer for passing back and
|
||||
// forth across the language boundary. A GoSeqRef may represent either
|
||||
// an instance of a Go object, or an Objective-C object passed to Go.
|
||||
// The explicit allocation of a GoSeqRef is used to pin a Go object
|
||||
// when it is passed to Objective-C. The Go seq package maintains a
|
||||
// reference to the Go object in a map keyed by the refnum along with
|
||||
// a reference count. When the reference count reaches zero, the Go
|
||||
// seq package will clear the corresponding entry in the map.
|
||||
@interface GoSeqRef : NSObject {
|
||||
}
|
||||
@property(readonly) int32_t refnum;
|
||||
@property(strong) id obj; // NULL when representing a Go object.
|
||||
|
||||
// new GoSeqRef object to proxy a Go object. The refnum must be
|
||||
// provided from Go side.
|
||||
- (instancetype)initWithRefnum:(int32_t)refnum obj:(id)obj;
|
||||
|
||||
- (int32_t)incNum;
|
||||
|
||||
@end
|
||||
|
||||
@protocol goSeqRefInterface
|
||||
-(GoSeqRef*) _ref;
|
||||
@end
|
||||
|
||||
#endif
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
<?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>CFBundleExecutable</key>
|
||||
<string>GoLibs</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>GoLibs</string>
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>100.0</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.0.1756305244</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>0.0.1756305244</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
framework module "GoLibs" {
|
||||
header "ref.h"
|
||||
header "Crypto.objc.h"
|
||||
header "Armor.objc.h"
|
||||
header "Constants.objc.h"
|
||||
header "Models.objc.h"
|
||||
header "Subtle.objc.h"
|
||||
header "Helper.objc.h"
|
||||
header "Srp.objc.h"
|
||||
header "Universe.objc.h"
|
||||
header "GoLibs.h"
|
||||
|
||||
export *
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
Versions/Current/GoLibs
|
||||
|
|
@ -1 +0,0 @@
|
|||
Versions/Current/Headers
|
||||
|
|
@ -1 +0,0 @@
|
|||
Versions/Current/Modules
|
||||
|
|
@ -1 +0,0 @@
|
|||
Versions/Current/Resources
|
||||
Binary file not shown.
|
|
@ -1,39 +0,0 @@
|
|||
// Objective-C API for talking to github.com/ProtonMail/gopenpgp/v2/armor Go package.
|
||||
// gobind -lang=objc github.com/ProtonMail/gopenpgp/v2/armor
|
||||
//
|
||||
// File is generated by gobind. Do not edit.
|
||||
|
||||
#ifndef __Armor_H__
|
||||
#define __Armor_H__
|
||||
|
||||
@import Foundation;
|
||||
#include "ref.h"
|
||||
#include "Universe.objc.h"
|
||||
|
||||
#include "Constants.objc.h"
|
||||
|
||||
/**
|
||||
* ArmorKey armors input as a public key.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull ArmorArmorKey(NSData* _Nullable input, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* ArmorWithType armors input with the given armorType.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull ArmorArmorWithType(NSData* _Nullable input, NSString* _Nullable armorType, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* ArmorWithTypeAndCustomHeaders armors input with the given armorType and
|
||||
headers.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull ArmorArmorWithTypeAndCustomHeaders(NSData* _Nullable input, NSString* _Nullable armorType, NSString* _Nullable version, NSString* _Nullable comment, NSError* _Nullable* _Nullable error);
|
||||
|
||||
// skipped function ArmorWithTypeBuffered with unsupported parameter or return types
|
||||
|
||||
|
||||
/**
|
||||
* Unarmor unarmors an armored input into a byte array.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable ArmorUnarmor(NSString* _Nullable input, NSError* _Nullable* _Nullable error);
|
||||
|
||||
#endif
|
||||
|
|
@ -1,72 +0,0 @@
|
|||
// Objective-C API for talking to github.com/ProtonMail/gopenpgp/v2/constants Go package.
|
||||
// gobind -lang=objc github.com/ProtonMail/gopenpgp/v2/constants
|
||||
//
|
||||
// File is generated by gobind. Do not edit.
|
||||
|
||||
#ifndef __Constants_H__
|
||||
#define __Constants_H__
|
||||
|
||||
@import Foundation;
|
||||
#include "ref.h"
|
||||
#include "Universe.objc.h"
|
||||
|
||||
|
||||
/**
|
||||
* Cipher suite names.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsAES128;
|
||||
/**
|
||||
* Cipher suite names.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsAES192;
|
||||
/**
|
||||
* Cipher suite names.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsAES256;
|
||||
/**
|
||||
* Constants for armored data.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsArmorHeaderComment;
|
||||
/**
|
||||
* Constants for armored data.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsArmorHeaderVersion;
|
||||
/**
|
||||
* Cipher suite names.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsCAST5;
|
||||
FOUNDATION_EXPORT const int64_t ConstantsDefaultCompression;
|
||||
FOUNDATION_EXPORT const int64_t ConstantsDefaultCompressionLevel;
|
||||
/**
|
||||
* Constants for armored data.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsPGPMessageHeader;
|
||||
/**
|
||||
* Constants for armored data.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsPGPSignatureHeader;
|
||||
/**
|
||||
* Constants for armored data.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsPrivateKeyHeader;
|
||||
/**
|
||||
* Constants for armored data.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsPublicKeyHeader;
|
||||
FOUNDATION_EXPORT const long ConstantsSIGNATURE_BAD_CONTEXT;
|
||||
FOUNDATION_EXPORT const long ConstantsSIGNATURE_FAILED;
|
||||
FOUNDATION_EXPORT const long ConstantsSIGNATURE_NOT_SIGNED;
|
||||
FOUNDATION_EXPORT const long ConstantsSIGNATURE_NO_VERIFIER;
|
||||
FOUNDATION_EXPORT const long ConstantsSIGNATURE_OK;
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsSignatureContextName;
|
||||
/**
|
||||
* Cipher suite names.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsThreeDES;
|
||||
/**
|
||||
* Cipher suite names.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsTripleDES;
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsVersion;
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,25 +0,0 @@
|
|||
|
||||
// Objective-C API for talking to the following Go packages
|
||||
//
|
||||
// github.com/ProtonMail/gopenpgp/v2/crypto
|
||||
// github.com/ProtonMail/gopenpgp/v2/armor
|
||||
// github.com/ProtonMail/gopenpgp/v2/constants
|
||||
// github.com/ProtonMail/gopenpgp/v2/models
|
||||
// github.com/ProtonMail/gopenpgp/v2/subtle
|
||||
// github.com/ProtonMail/gopenpgp/v2/helper
|
||||
// github.com/ProtonMail/go-srp
|
||||
//
|
||||
// File is generated by gomobile bind. Do not edit.
|
||||
#ifndef __GoLibs_FRAMEWORK_H__
|
||||
#define __GoLibs_FRAMEWORK_H__
|
||||
|
||||
#include "Crypto.objc.h"
|
||||
#include "Armor.objc.h"
|
||||
#include "Constants.objc.h"
|
||||
#include "Models.objc.h"
|
||||
#include "Subtle.objc.h"
|
||||
#include "Helper.objc.h"
|
||||
#include "Srp.objc.h"
|
||||
#include "Universe.objc.h"
|
||||
|
||||
#endif
|
||||
|
|
@ -1,481 +0,0 @@
|
|||
// Objective-C API for talking to github.com/ProtonMail/gopenpgp/v2/helper Go package.
|
||||
// gobind -lang=objc github.com/ProtonMail/gopenpgp/v2/helper
|
||||
//
|
||||
// File is generated by gobind. Do not edit.
|
||||
|
||||
#ifndef __Helper_H__
|
||||
#define __Helper_H__
|
||||
|
||||
@import Foundation;
|
||||
#include "ref.h"
|
||||
#include "Universe.objc.h"
|
||||
|
||||
#include "Crypto.objc.h"
|
||||
|
||||
@class HelperEncryptSignArmoredDetachedMobileResult;
|
||||
@class HelperEncryptSignBinaryDetachedMobileResult;
|
||||
@class HelperExplicitVerifyMessage;
|
||||
@class HelperGo2AndroidReader;
|
||||
@class HelperGo2IOSReader;
|
||||
@class HelperMobile2GoReader;
|
||||
@class HelperMobile2GoWriter;
|
||||
@class HelperMobile2GoWriterWithSHA256;
|
||||
@class HelperMobileReadResult;
|
||||
@protocol HelperMobileReader;
|
||||
@class HelperMobileReader;
|
||||
|
||||
@protocol HelperMobileReader <NSObject>
|
||||
- (HelperMobileReadResult* _Nullable)read:(long)max error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
@interface HelperEncryptSignArmoredDetachedMobileResult : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) NSString* _Nonnull ciphertextArmored;
|
||||
@property (nonatomic) NSString* _Nonnull encryptedSignatureArmored;
|
||||
@end
|
||||
|
||||
@interface HelperEncryptSignBinaryDetachedMobileResult : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) NSData* _Nullable encryptedData;
|
||||
@property (nonatomic) NSString* _Nonnull encryptedSignatureArmored;
|
||||
@end
|
||||
|
||||
@interface HelperExplicitVerifyMessage : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) CryptoPlainMessage* _Nullable message;
|
||||
@property (nonatomic) CryptoSignatureVerificationError* _Nullable signatureVerificationError;
|
||||
@end
|
||||
|
||||
/**
|
||||
* Go2AndroidReader is used to wrap a native golang Reader in the golang runtime,
|
||||
to be usable in the android app runtime (via gomobile).
|
||||
*/
|
||||
@interface HelperGo2AndroidReader : NSObject <goSeqRefInterface, CryptoReader> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
/**
|
||||
* NewGo2AndroidReader wraps a native golang Reader to be usable in the mobile app runtime (via gomobile).
|
||||
It doesn't follow the standard golang Reader behavior, and returns n = -1 on EOF.
|
||||
*/
|
||||
- (nullable instancetype)init:(id<CryptoReader> _Nullable)reader;
|
||||
/**
|
||||
* Read reads bytes into the provided buffer and returns the number of bytes read
|
||||
It doesn't follow the standard golang Reader behavior, and returns n = -1 on EOF.
|
||||
*/
|
||||
- (BOOL)read:(NSData* _Nullable)b n:(long* _Nullable)n error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
/**
|
||||
* Go2IOSReader is used to wrap a native golang Reader in the golang runtime,
|
||||
to be usable in the iOS app runtime (via gomobile) as a MobileReader.
|
||||
*/
|
||||
@interface HelperGo2IOSReader : NSObject <goSeqRefInterface, HelperMobileReader> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
/**
|
||||
* NewGo2IOSReader wraps a native golang Reader to be usable in the ios app runtime (via gomobile).
|
||||
*/
|
||||
- (nullable instancetype)init:(id<CryptoReader> _Nullable)reader;
|
||||
/**
|
||||
* Read reads at most <max> bytes from the wrapped Reader and returns the read data as a MobileReadResult.
|
||||
*/
|
||||
- (HelperMobileReadResult* _Nullable)read:(long)max error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
/**
|
||||
* Mobile2GoReader is used to wrap a MobileReader in the mobile app runtime,
|
||||
to be usable in the golang runtime (via gomobile) as a native Reader.
|
||||
*/
|
||||
@interface HelperMobile2GoReader : NSObject <goSeqRefInterface, CryptoReader> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
/**
|
||||
* NewMobile2GoReader wraps a MobileReader to be usable in the golang runtime (via gomobile).
|
||||
*/
|
||||
- (nullable instancetype)init:(id<HelperMobileReader> _Nullable)reader;
|
||||
/**
|
||||
* Read reads data from the wrapped MobileReader and copies the read data in the provided buffer.
|
||||
It also handles the conversion of EOF to an error.
|
||||
*/
|
||||
- (BOOL)read:(NSData* _Nullable)b n:(long* _Nullable)n error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
/**
|
||||
* Mobile2GoWriter is used to wrap a writer in the mobile app runtime,
|
||||
to be usable in the golang runtime (via gomobile).
|
||||
*/
|
||||
@interface HelperMobile2GoWriter : NSObject <goSeqRefInterface, CryptoWriter> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
/**
|
||||
* NewMobile2GoWriter wraps a writer to be usable in the golang runtime (via gomobile).
|
||||
*/
|
||||
- (nullable instancetype)init:(id<CryptoWriter> _Nullable)writer;
|
||||
/**
|
||||
* Write writes the data in the provided buffer in the wrapped writer.
|
||||
It clones the provided data to prevent errors with garbage collectors.
|
||||
*/
|
||||
- (BOOL)write:(NSData* _Nullable)b n:(long* _Nullable)n error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
/**
|
||||
* Mobile2GoWriterWithSHA256 is used to wrap a writer in the mobile app runtime,
|
||||
to be usable in the golang runtime (via gomobile).
|
||||
It also computes the SHA256 hash of the data being written on the fly.
|
||||
*/
|
||||
@interface HelperMobile2GoWriterWithSHA256 : NSObject <goSeqRefInterface, CryptoWriter> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
/**
|
||||
* NewMobile2GoWriterWithSHA256 wraps a writer to be usable in the golang runtime (via gomobile).
|
||||
The wrapper also computes the SHA256 hash of the data being written on the fly.
|
||||
*/
|
||||
- (nullable instancetype)init:(id<CryptoWriter> _Nullable)writer;
|
||||
/**
|
||||
* GetSHA256 returns the SHA256 hash of the data that's been written so far.
|
||||
*/
|
||||
- (NSData* _Nullable)getSHA256;
|
||||
/**
|
||||
* Write writes the data in the provided buffer in the wrapped writer.
|
||||
It clones the provided data to prevent errors with garbage collectors.
|
||||
It also computes the SHA256 hash of the data being written on the fly.
|
||||
*/
|
||||
- (BOOL)write:(NSData* _Nullable)b n:(long* _Nullable)n error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
/**
|
||||
* MobileReadResult is what needs to be returned by MobileReader.Read.
|
||||
The read data is passed as a return value rather than passed as an argument to the reader.
|
||||
This avoids problems introduced by gomobile that prevent the use of native golang readers.
|
||||
*/
|
||||
@interface HelperMobileReadResult : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
/**
|
||||
* NewMobileReadResult initialize a MobileReadResult with the correct values.
|
||||
It clones the data to avoid the garbage collector freeing the data too early.
|
||||
*/
|
||||
- (nullable instancetype)init:(long)n eof:(BOOL)eof data:(NSData* _Nullable)data;
|
||||
@property (nonatomic) long n;
|
||||
@property (nonatomic) BOOL isEOF;
|
||||
@property (nonatomic) NSData* _Nullable data;
|
||||
@end
|
||||
|
||||
FOUNDATION_EXPORT const int64_t HelperAES_BLOCK_SIZE;
|
||||
|
||||
/**
|
||||
* DecryptAttachment takes a keypacket and datpacket
|
||||
and returns a decrypted PlainMessage
|
||||
Specifically designed for attachments rather than text messages.
|
||||
*/
|
||||
FOUNDATION_EXPORT CryptoPlainMessage* _Nullable HelperDecryptAttachment(NSData* _Nullable keyPacket, NSData* _Nullable dataPacket, CryptoKeyRing* _Nullable keyRing, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptAttachmentWithKey decrypts a binary file
|
||||
Using a given armored private key and its passphrase.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable HelperDecryptAttachmentWithKey(NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSData* _Nullable keyPacket, NSData* _Nullable dataPacket, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptBinaryMessageArmored decrypts an armored PGP message given a private key
|
||||
and its passphrase.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable HelperDecryptBinaryMessageArmored(NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSString* _Nullable ciphertext, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptExplicitVerify decrypts a PGP message given a private keyring
|
||||
and a public keyring to verify the embedded signature. Returns the plain
|
||||
data and an error on signature verification failure.
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperExplicitVerifyMessage* _Nullable HelperDecryptExplicitVerify(CryptoPGPMessage* _Nullable pgpMessage, CryptoKeyRing* _Nullable privateKeyRing, CryptoKeyRing* _Nullable publicKeyRing, int64_t verifyTime, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptExplicitVerifyWithContext decrypts a PGP message given a private keyring
|
||||
and a public keyring to verify the embedded signature. Returns the plain
|
||||
data and an error on signature verification failure.
|
||||
The caller can provide a context that will be used to verify the signature.
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperExplicitVerifyMessage* _Nullable HelperDecryptExplicitVerifyWithContext(CryptoPGPMessage* _Nullable pgpMessage, CryptoKeyRing* _Nullable privateKeyRing, CryptoKeyRing* _Nullable publicKeyRing, int64_t verifyTime, CryptoVerificationContext* _Nullable verificationContext, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptMessageArmored decrypts an armored PGP message given a private key
|
||||
and its passphrase.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperDecryptMessageArmored(NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSString* _Nullable ciphertext, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptMessageWithPassword decrypts an armored message with a random token.
|
||||
The algorithm is derived from the armoring.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperDecryptMessageWithPassword(NSData* _Nullable password, NSString* _Nullable ciphertext, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptSessionKey decrypts a session key
|
||||
using a given armored private key
|
||||
and its passphrase.
|
||||
*/
|
||||
FOUNDATION_EXPORT CryptoSessionKey* _Nullable HelperDecryptSessionKey(NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSData* _Nullable encryptedSessionKey, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptSessionKeyExplicitVerify decrypts a PGP data packet given a session key
|
||||
and a public keyring to verify the embedded signature. Returns the plain data and
|
||||
an error on signature verification failure.
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperExplicitVerifyMessage* _Nullable HelperDecryptSessionKeyExplicitVerify(NSData* _Nullable dataPacket, CryptoSessionKey* _Nullable sessionKey, CryptoKeyRing* _Nullable publicKeyRing, int64_t verifyTime, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptSessionKeyExplicitVerifyWithContext decrypts a PGP data packet given a session key
|
||||
and a public keyring to verify the embedded signature. Returns the plain data and
|
||||
an error on signature verification failure.
|
||||
The caller can provide a context that will be used to verify the signature.
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperExplicitVerifyMessage* _Nullable HelperDecryptSessionKeyExplicitVerifyWithContext(NSData* _Nullable dataPacket, CryptoSessionKey* _Nullable sessionKey, CryptoKeyRing* _Nullable publicKeyRing, int64_t verifyTime, CryptoVerificationContext* _Nullable verificationContext, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptVerifyArmoredDetached decrypts an armored pgp message
|
||||
and verify a detached armored encrypted signature
|
||||
given a publicKey, and a privateKey with its passphrase.
|
||||
Returns the plain data or an error on
|
||||
signature verification failure.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable HelperDecryptVerifyArmoredDetached(NSString* _Nullable publicKey, NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSString* _Nullable ciphertextArmored, NSString* _Nullable encryptedSignatureArmored, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptVerifyAttachment decrypts and verifies an attachment split into the
|
||||
keyPacket, dataPacket and an armored (!) signature, given a publicKey, and a
|
||||
privateKey with its passphrase. Returns the plain data or an error on
|
||||
signature verification failure.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable HelperDecryptVerifyAttachment(NSString* _Nullable publicKey, NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSData* _Nullable keyPacket, NSData* _Nullable dataPacket, NSString* _Nullable armoredSignature, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptVerifyBinaryDetached decrypts binary encrypted data
|
||||
and verify a detached armored encrypted signature
|
||||
given a publicKey, and a privateKey with its passphrase.
|
||||
Returns the plain data or an error on
|
||||
signature verification failure.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable HelperDecryptVerifyBinaryDetached(NSString* _Nullable publicKey, NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSData* _Nullable encryptedData, NSString* _Nullable encryptedSignatureArmored, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptVerifyMessageArmored decrypts an armored PGP message given a private
|
||||
key and its passphrase and verifies the embedded signature. Returns the
|
||||
plain data or an error on signature verification failure.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperDecryptVerifyMessageArmored(NSString* _Nullable publicKey, NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSString* _Nullable ciphertext, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptAttachment encrypts a file given a plainData and a fileName.
|
||||
Returns a PGPSplitMessage containing a session key packet and symmetrically
|
||||
encrypted data. Specifically designed for attachments rather than text
|
||||
messages.
|
||||
*/
|
||||
FOUNDATION_EXPORT CryptoPGPSplitMessage* _Nullable HelperEncryptAttachment(NSData* _Nullable plainData, NSString* _Nullable filename, CryptoKeyRing* _Nullable keyRing, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptAttachmentWithKey encrypts a binary file
|
||||
Using a given armored public key.
|
||||
*/
|
||||
FOUNDATION_EXPORT CryptoPGPSplitMessage* _Nullable HelperEncryptAttachmentWithKey(NSString* _Nullable publicKey, NSString* _Nullable filename, NSData* _Nullable plainData, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptBinaryMessageArmored generates an armored PGP message given a binary data and
|
||||
an armored public key.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperEncryptBinaryMessageArmored(NSString* _Nullable key, NSData* _Nullable data, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptMessageArmored generates an armored PGP message given a plaintext and
|
||||
an armored public key.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperEncryptMessageArmored(NSString* _Nullable key, NSString* _Nullable plaintext, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptMessageWithPassword encrypts a string with a passphrase using AES256.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperEncryptMessageWithPassword(NSData* _Nullable password, NSString* _Nullable plaintext, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptPGPMessageToAdditionalKey decrypts the session key of the input PGPSplitMessage with a private key in keyRing
|
||||
and encrypts it towards the additionalKeys by adding the additional key packets to the input PGPSplitMessage.
|
||||
If successful, new key packets are added to message.
|
||||
* messageToModify : The encrypted pgp message that should be modified
|
||||
* keyRing : The private keys to decrypt the session key in the messageToModify.
|
||||
* additionalKey : The public keys the message should be additionally encrypted to.
|
||||
*/
|
||||
FOUNDATION_EXPORT BOOL HelperEncryptPGPMessageToAdditionalKey(CryptoPGPSplitMessage* _Nullable messageToModify, CryptoKeyRing* _Nullable keyRing, CryptoKeyRing* _Nullable additionalKey, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptSessionKey encrypts a session key
|
||||
using a given armored public key.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable HelperEncryptSessionKey(NSString* _Nullable publicKey, CryptoSessionKey* _Nullable sessionKey, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptSignArmoredDetachedMobile wraps the encryptSignArmoredDetached method
|
||||
to have only one return argument for mobile.
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperEncryptSignArmoredDetachedMobileResult* _Nullable HelperEncryptSignArmoredDetachedMobile(NSString* _Nullable publicKey, NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSData* _Nullable plainData, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptSignBinaryDetachedMobile wraps the encryptSignBinaryDetached method
|
||||
to have only one return argument for mobile.
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperEncryptSignBinaryDetachedMobileResult* _Nullable HelperEncryptSignBinaryDetachedMobile(NSString* _Nullable publicKey, NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSData* _Nullable plainData, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptSignMessageArmored generates an armored signed PGP message given a
|
||||
plaintext and an armored public key a private key and its passphrase.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperEncryptSignMessageArmored(NSString* _Nullable publicKey, NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSString* _Nullable plaintext, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* FreeOSMemory can be used to explicitly
|
||||
call the garbage collector and
|
||||
return the unused memory to the OS.
|
||||
*/
|
||||
FOUNDATION_EXPORT void HelperFreeOSMemory(void);
|
||||
|
||||
/**
|
||||
* GenerateKey generates a key of the given keyType ("rsa" or "x25519"), encrypts it, and returns an armored string.
|
||||
If keyType is "rsa", bits is the RSA bitsize of the key.
|
||||
If keyType is "x25519" bits is unused.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperGenerateKey(NSString* _Nullable name, NSString* _Nullable email, NSData* _Nullable passphrase, NSString* _Nullable keyType, long bits, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* GetJsonSHA256Fingerprints returns the SHA256 fingeprints of key and subkeys,
|
||||
encoded in JSON, since gomobile can not handle arrays.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable HelperGetJsonSHA256Fingerprints(NSString* _Nullable publicKey, NSError* _Nullable* _Nullable error);
|
||||
|
||||
// skipped function GetSHA256Fingerprints with unsupported parameter or return types
|
||||
|
||||
|
||||
/**
|
||||
* NewGo2AndroidReader wraps a native golang Reader to be usable in the mobile app runtime (via gomobile).
|
||||
It doesn't follow the standard golang Reader behavior, and returns n = -1 on EOF.
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperGo2AndroidReader* _Nullable HelperNewGo2AndroidReader(id<CryptoReader> _Nullable reader);
|
||||
|
||||
/**
|
||||
* NewGo2IOSReader wraps a native golang Reader to be usable in the ios app runtime (via gomobile).
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperGo2IOSReader* _Nullable HelperNewGo2IOSReader(id<CryptoReader> _Nullable reader);
|
||||
|
||||
/**
|
||||
* NewMobile2GoReader wraps a MobileReader to be usable in the golang runtime (via gomobile).
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperMobile2GoReader* _Nullable HelperNewMobile2GoReader(id<HelperMobileReader> _Nullable reader);
|
||||
|
||||
/**
|
||||
* NewMobile2GoWriter wraps a writer to be usable in the golang runtime (via gomobile).
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperMobile2GoWriter* _Nullable HelperNewMobile2GoWriter(id<CryptoWriter> _Nullable writer);
|
||||
|
||||
/**
|
||||
* NewMobile2GoWriterWithSHA256 wraps a writer to be usable in the golang runtime (via gomobile).
|
||||
The wrapper also computes the SHA256 hash of the data being written on the fly.
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperMobile2GoWriterWithSHA256* _Nullable HelperNewMobile2GoWriterWithSHA256(id<CryptoWriter> _Nullable writer);
|
||||
|
||||
/**
|
||||
* NewMobileReadResult initialize a MobileReadResult with the correct values.
|
||||
It clones the data to avoid the garbage collector freeing the data too early.
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperMobileReadResult* _Nullable HelperNewMobileReadResult(long n, BOOL eof, NSData* _Nullable data);
|
||||
|
||||
/**
|
||||
* QuickCheckDecrypt checks with high probability if the provided session key
|
||||
can decrypt the encrypted data packet given its 24 byte long prefix.
|
||||
The method only considers the first 24 bytes of the prefix slice (prefix[:24]).
|
||||
NOTE: Only works for SEIPDv1 packets with AES.
|
||||
*/
|
||||
FOUNDATION_EXPORT BOOL HelperQuickCheckDecrypt(CryptoSessionKey* _Nullable sessionKey, NSData* _Nullable prefix, BOOL* _Nullable ret0_, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* QuickCheckDecryptReader checks with high probability if the provided session key
|
||||
can decrypt a data packet given its 24 byte long prefix.
|
||||
The method reads up to but not exactly 24 bytes from the prefixReader.
|
||||
NOTE: Only works for SEIPDv1 packets with AES.
|
||||
*/
|
||||
FOUNDATION_EXPORT BOOL HelperQuickCheckDecryptReader(CryptoSessionKey* _Nullable sessionKey, id<CryptoReader> _Nullable prefixReader, BOOL* _Nullable ret0_, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* SignCleartextMessage signs text given a private keyring, canonicalizes and
|
||||
trims the newlines, and returns the PGP-compliant special armoring.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperSignCleartextMessage(CryptoKeyRing* _Nullable keyRing, NSString* _Nullable text, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* SignCleartextMessageArmored signs text given a private key and its
|
||||
passphrase, canonicalizes and trims the newlines, and returns the
|
||||
PGP-compliant special armoring.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperSignCleartextMessageArmored(NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSString* _Nullable text, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* UpdatePrivateKeyPassphrase decrypts the given armored privateKey with oldPassphrase,
|
||||
re-encrypts it with newPassphrase, and returns the new armored key.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperUpdatePrivateKeyPassphrase(NSString* _Nullable privateKey, NSData* _Nullable oldPassphrase, NSData* _Nullable newPassphrase, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* VerifyCleartextMessage verifies PGP-compliant armored signed plain text
|
||||
given the public keyring and returns the text or err if the verification
|
||||
fails.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperVerifyCleartextMessage(CryptoKeyRing* _Nullable keyRing, NSString* _Nullable armored, int64_t verifyTime, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* VerifyCleartextMessageArmored verifies PGP-compliant armored signed plain
|
||||
text given the public key and returns the text or err if the verification
|
||||
fails.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperVerifyCleartextMessageArmored(NSString* _Nullable publicKey, NSString* _Nullable armored, int64_t verifyTime, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* VerifySignatureExplicit calls the reader's VerifySignature()
|
||||
and tries to cast the returned error to a SignatureVerificationError.
|
||||
*/
|
||||
FOUNDATION_EXPORT CryptoSignatureVerificationError* _Nullable HelperVerifySignatureExplicit(CryptoPlainMessageReader* _Nullable reader, NSError* _Nullable* _Nullable error);
|
||||
|
||||
@class HelperMobileReader;
|
||||
|
||||
/**
|
||||
* MobileReader is the interface that readers in the mobile runtime must use and implement.
|
||||
This is a workaround to some of the gomobile limitations.
|
||||
*/
|
||||
@interface HelperMobileReader : NSObject <goSeqRefInterface, HelperMobileReader> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (HelperMobileReadResult* _Nullable)read:(long)max error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
#endif
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
// Objective-C API for talking to github.com/ProtonMail/gopenpgp/v2/models Go package.
|
||||
// gobind -lang=objc github.com/ProtonMail/gopenpgp/v2/models
|
||||
//
|
||||
// File is generated by gobind. Do not edit.
|
||||
|
||||
#ifndef __Models_H__
|
||||
#define __Models_H__
|
||||
|
||||
@import Foundation;
|
||||
#include "ref.h"
|
||||
#include "Universe.objc.h"
|
||||
|
||||
|
||||
@class ModelsEncryptedSigned;
|
||||
|
||||
/**
|
||||
* EncryptedSigned contains an encrypted message and signature.
|
||||
*/
|
||||
@interface ModelsEncryptedSigned : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) NSString* _Nonnull encrypted;
|
||||
@property (nonatomic) NSString* _Nonnull signature;
|
||||
@end
|
||||
|
||||
#endif
|
||||
|
|
@ -1,265 +0,0 @@
|
|||
// Objective-C API for talking to github.com/ProtonMail/go-srp Go package.
|
||||
// gobind -lang=objc github.com/ProtonMail/go-srp
|
||||
//
|
||||
// File is generated by gobind. Do not edit.
|
||||
|
||||
#ifndef __Srp_H__
|
||||
#define __Srp_H__
|
||||
|
||||
@import Foundation;
|
||||
#include "ref.h"
|
||||
#include "Universe.objc.h"
|
||||
|
||||
|
||||
@class SrpAuth;
|
||||
@class SrpProofs;
|
||||
@class SrpServer;
|
||||
|
||||
/**
|
||||
* Auth stores byte data for the calculation of SRP proofs.
|
||||
* Changed SrpAuto to Auth because the name will be used as srp.SrpAuto by other packages and as SrpSrpAuth on mobile
|
||||
* Also the data from the API called Auth. it could be match the meaning and reduce the confusion
|
||||
*/
|
||||
@interface SrpAuth : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
/**
|
||||
* NewAuth Creates new Auth from strings input. Salt and server ephemeral are in
|
||||
base64 format. Modulus is base64 with signature attached. The signature is
|
||||
verified against server key. The version controls password hash algorithm.
|
||||
|
||||
Parameters:
|
||||
- version int: The *x* component of the vector.
|
||||
- username string: The *y* component of the vector.
|
||||
- password []byte: The *z* component of the vector.
|
||||
- b64salt string: The std-base64 formatted salt
|
||||
Returns:
|
||||
- auth *Auth: the pre calculated auth information
|
||||
- err error: throw error
|
||||
Usage:
|
||||
|
||||
Warnings:
|
||||
- Be careful! Poos can hurt.
|
||||
*/
|
||||
- (nullable instancetype)init:(long)version username:(NSString* _Nullable)username password:(NSData* _Nullable)password b64salt:(NSString* _Nullable)b64salt signedModulus:(NSString* _Nullable)signedModulus serverEphemeral:(NSString* _Nullable)serverEphemeral;
|
||||
/**
|
||||
* NewAuthForVerifier Creates new Auth from strings input. Salt and server ephemeral are in
|
||||
base64 format. Modulus is base64 with signature attached. The signature is
|
||||
verified against server key. The version controls password hash algorithm.
|
||||
|
||||
Parameters:
|
||||
- version int: The *x* component of the vector.
|
||||
- username string: The *y* component of the vector.
|
||||
- password []byte: The *z* component of the vector.
|
||||
- salt string:
|
||||
Returns:
|
||||
- auth *Auth: the pre calculated auth information
|
||||
- err error: throw error
|
||||
Usage:
|
||||
|
||||
Warnings:
|
||||
- none.
|
||||
*/
|
||||
- (nullable instancetype)initForVerifier:(NSData* _Nullable)password signedModulus:(NSString* _Nullable)signedModulus rawSalt:(NSData* _Nullable)rawSalt;
|
||||
@property (nonatomic) NSData* _Nullable modulus;
|
||||
@property (nonatomic) NSData* _Nullable serverEphemeral;
|
||||
@property (nonatomic) NSData* _Nullable hashedPassword;
|
||||
@property (nonatomic) long version;
|
||||
/**
|
||||
* GenerateProofs calculates SPR proofs.
|
||||
*/
|
||||
- (SrpProofs* _Nullable)generateProofs:(long)bitLength error:(NSError* _Nullable* _Nullable)error;
|
||||
/**
|
||||
* GenerateVerifier verifier for update pwds and create accounts
|
||||
*/
|
||||
- (NSData* _Nullable)generateVerifier:(long)bitLength error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
/**
|
||||
* Proofs Srp Proofs object. Changed SrpProofs to Proofs because the name will be used as srp.SrpProofs by other packages and as SrpSrpProofs on mobile
|
||||
ClientProof []byte client proof
|
||||
ClientEphemeral []byte calculated from
|
||||
ExpectedServerProof []byte
|
||||
*/
|
||||
@interface SrpProofs : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) NSData* _Nullable clientProof;
|
||||
@property (nonatomic) NSData* _Nullable clientEphemeral;
|
||||
@property (nonatomic) NSData* _Nullable expectedServerProof;
|
||||
@end
|
||||
|
||||
/**
|
||||
* Server stores the internal state for the validation of SRP proofs.
|
||||
*/
|
||||
@interface SrpServer : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
/**
|
||||
* NewServer creates a new server instance from the raw binary data.
|
||||
*/
|
||||
- (nullable instancetype)init:(NSData* _Nullable)modulusBytes verifier:(NSData* _Nullable)verifier bitLength:(long)bitLength;
|
||||
/**
|
||||
* NewServerFromSigned creates a new server instance from the signed modulus and the binary verifier.
|
||||
*/
|
||||
- (nullable instancetype)initFromSigned:(NSString* _Nullable)signedModulus verifier:(NSData* _Nullable)verifier bitLength:(long)bitLength;
|
||||
/**
|
||||
* NewServerWithSecret creates a new server instance without generating a random secret from the raw binary data.
|
||||
Use with caution as the secret should not be reused.
|
||||
*/
|
||||
- (nullable instancetype)initWithSecret:(NSData* _Nullable)modulusBytes verifier:(NSData* _Nullable)verifier secretBytes:(NSData* _Nullable)secretBytes bitLength:(long)bitLength;
|
||||
/**
|
||||
* GenerateChallenge is the first step for SRP exchange, and generates a valid challenge for the provided verifier.
|
||||
*/
|
||||
- (NSData* _Nullable)generateChallenge:(NSError* _Nullable* _Nullable)error;
|
||||
/**
|
||||
* GetSharedSession returns the shared secret as byte if the session has concluded in valid state.
|
||||
*/
|
||||
- (NSData* _Nullable)getSharedSession:(NSError* _Nullable* _Nullable)error;
|
||||
/**
|
||||
* IsCompleted returns true if the exchange has been concluded in valid state.
|
||||
*/
|
||||
- (BOOL)isCompleted;
|
||||
/**
|
||||
* VerifyProofs Verifies the client proof and - if valid - generates the shared secret and returnd the server proof.
|
||||
It concludes the exchange in valid state if successful.
|
||||
*/
|
||||
- (NSData* _Nullable)verifyProofs:(NSData* _Nullable)clientEphemeralBytes clientProofBytes:(NSData* _Nullable)clientProofBytes error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const SrpVersion;
|
||||
|
||||
@interface Srp : NSObject
|
||||
/**
|
||||
* Implementation following the "context" package
|
||||
*/
|
||||
+ (NSError* _Nullable) deadlineExceeded;
|
||||
+ (void) setDeadlineExceeded:(NSError* _Nullable)v;
|
||||
|
||||
/**
|
||||
* ErrDataAfterModulus found extra data after decode the modulus
|
||||
*/
|
||||
+ (NSError* _Nullable) errDataAfterModulus;
|
||||
+ (void) setErrDataAfterModulus:(NSError* _Nullable)v;
|
||||
|
||||
/**
|
||||
* ErrInvalidSignature invalid modulus signature
|
||||
*/
|
||||
+ (NSError* _Nullable) errInvalidSignature;
|
||||
+ (void) setErrInvalidSignature:(NSError* _Nullable)v;
|
||||
|
||||
// skipped variable RandReader with unsupported type: io.Reader
|
||||
|
||||
@end
|
||||
|
||||
/**
|
||||
* Argon2PreimageChallenge computes the base64 solution for a given Argon2 base64
|
||||
challenge within deadlineUnixMilli milliseconds, if any was found. Deadlines are measured
|
||||
on the wall clock, not the monotonic clock, due to unreliability on mobile devices.
|
||||
deadlineUnixMilli = -1 means unlimited time.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull SrpArgon2PreimageChallenge(NSString* _Nullable b64Challenge, int64_t deadlineUnixMilli, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* ECDLPChallenge computes the base64 solution for a given ECDLP base64 challenge
|
||||
within deadlineUnixMilli milliseconds, if any was found. Deadlines are measured on the
|
||||
wall clock, not the monotonic clock, due to unreliability on mobile devices.
|
||||
deadlineUnixMilli = -1 means unlimited time.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull SrpECDLPChallenge(NSString* _Nullable b64Challenge, int64_t deadlineUnixMilli, NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT NSString* _Nonnull SrpGetModulusKey(void);
|
||||
|
||||
/**
|
||||
* HashPassword returns the hash of password argument. Based on version number
|
||||
following arguments are used in addition to password:
|
||||
* 0, 1, 2: userName and modulus
|
||||
* 3, 4: salt and modulus
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable SrpHashPassword(long authVersion, NSData* _Nullable password, NSString* _Nullable userName, NSData* _Nullable salt, NSData* _Nullable modulus, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* MailboxPassword get mailbox password hash
|
||||
|
||||
Parameters:
|
||||
- password []byte: a mailbox password
|
||||
- salt []byte: a salt is random 128 bits data
|
||||
Returns:
|
||||
- hashed []byte: a hashed password
|
||||
- err error: throw error
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable SrpMailboxPassword(NSData* _Nullable password, NSData* _Nullable salt, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* NewAuth Creates new Auth from strings input. Salt and server ephemeral are in
|
||||
base64 format. Modulus is base64 with signature attached. The signature is
|
||||
verified against server key. The version controls password hash algorithm.
|
||||
|
||||
Parameters:
|
||||
- version int: The *x* component of the vector.
|
||||
- username string: The *y* component of the vector.
|
||||
- password []byte: The *z* component of the vector.
|
||||
- b64salt string: The std-base64 formatted salt
|
||||
Returns:
|
||||
- auth *Auth: the pre calculated auth information
|
||||
- err error: throw error
|
||||
Usage:
|
||||
|
||||
Warnings:
|
||||
- Be careful! Poos can hurt.
|
||||
*/
|
||||
FOUNDATION_EXPORT SrpAuth* _Nullable SrpNewAuth(long version, NSString* _Nullable username, NSData* _Nullable password, NSString* _Nullable b64salt, NSString* _Nullable signedModulus, NSString* _Nullable serverEphemeral, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* NewAuthForVerifier Creates new Auth from strings input. Salt and server ephemeral are in
|
||||
base64 format. Modulus is base64 with signature attached. The signature is
|
||||
verified against server key. The version controls password hash algorithm.
|
||||
|
||||
Parameters:
|
||||
- version int: The *x* component of the vector.
|
||||
- username string: The *y* component of the vector.
|
||||
- password []byte: The *z* component of the vector.
|
||||
- salt string:
|
||||
Returns:
|
||||
- auth *Auth: the pre calculated auth information
|
||||
- err error: throw error
|
||||
Usage:
|
||||
|
||||
Warnings:
|
||||
- none.
|
||||
*/
|
||||
FOUNDATION_EXPORT SrpAuth* _Nullable SrpNewAuthForVerifier(NSData* _Nullable password, NSString* _Nullable signedModulus, NSData* _Nullable rawSalt, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* NewServer creates a new server instance from the raw binary data.
|
||||
*/
|
||||
FOUNDATION_EXPORT SrpServer* _Nullable SrpNewServer(NSData* _Nullable modulusBytes, NSData* _Nullable verifier, long bitLength, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* NewServerFromSigned creates a new server instance from the signed modulus and the binary verifier.
|
||||
*/
|
||||
FOUNDATION_EXPORT SrpServer* _Nullable SrpNewServerFromSigned(NSString* _Nullable signedModulus, NSData* _Nullable verifier, long bitLength, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* NewServerWithSecret creates a new server instance without generating a random secret from the raw binary data.
|
||||
Use with caution as the secret should not be reused.
|
||||
*/
|
||||
FOUNDATION_EXPORT SrpServer* _Nullable SrpNewServerWithSecret(NSData* _Nullable modulusBytes, NSData* _Nullable verifier, NSData* _Nullable secretBytes, long bitLength, NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT NSData* _Nullable SrpRandomBits(long bits, NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT NSData* _Nullable SrpRandomBytes(long byes, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* VersionNumber get current library version
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull SrpVersionNumber(void);
|
||||
|
||||
#endif
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
// Objective-C API for talking to github.com/ProtonMail/gopenpgp/v2/subtle Go package.
|
||||
// gobind -lang=objc github.com/ProtonMail/gopenpgp/v2/subtle
|
||||
//
|
||||
// File is generated by gobind. Do not edit.
|
||||
|
||||
#ifndef __Subtle_H__
|
||||
#define __Subtle_H__
|
||||
|
||||
@import Foundation;
|
||||
#include "ref.h"
|
||||
#include "Universe.objc.h"
|
||||
|
||||
|
||||
/**
|
||||
* DecryptWithoutIntegrity decrypts data encrypted with AES-CTR.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable SubtleDecryptWithoutIntegrity(NSData* _Nullable key, NSData* _Nullable input, NSData* _Nullable iv, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DeriveKey derives a key from a password using scrypt. n should be set to the
|
||||
highest power of 2 you can derive within 100 milliseconds.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable SubtleDeriveKey(NSString* _Nullable password, NSData* _Nullable salt, long n, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptWithoutIntegrity encrypts data with AES-CTR. Note: this encryption
|
||||
mode is not secure when stored/sent on an untrusted medium.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable SubtleEncryptWithoutIntegrity(NSData* _Nullable key, NSData* _Nullable input, NSData* _Nullable iv, NSError* _Nullable* _Nullable error);
|
||||
|
||||
#endif
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
// Objective-C API for talking to Go package.
|
||||
// gobind -lang=objc
|
||||
//
|
||||
// File is generated by gobind. Do not edit.
|
||||
|
||||
#ifndef __Universe_H__
|
||||
#define __Universe_H__
|
||||
|
||||
@import Foundation;
|
||||
#include "ref.h"
|
||||
|
||||
@protocol Universeerror;
|
||||
@class Universeerror;
|
||||
|
||||
@protocol Universeerror <NSObject>
|
||||
- (NSString* _Nonnull)error;
|
||||
@end
|
||||
|
||||
@class Universeerror;
|
||||
|
||||
@interface Universeerror : NSError <goSeqRefInterface, Universeerror> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (NSString* _Nonnull)error;
|
||||
@end
|
||||
|
||||
#endif
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
// Copyright 2015 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
#ifndef __GO_REF_HDR__
|
||||
#define __GO_REF_HDR__
|
||||
|
||||
#include <Foundation/Foundation.h>
|
||||
|
||||
// GoSeqRef is an object tagged with an integer for passing back and
|
||||
// forth across the language boundary. A GoSeqRef may represent either
|
||||
// an instance of a Go object, or an Objective-C object passed to Go.
|
||||
// The explicit allocation of a GoSeqRef is used to pin a Go object
|
||||
// when it is passed to Objective-C. The Go seq package maintains a
|
||||
// reference to the Go object in a map keyed by the refnum along with
|
||||
// a reference count. When the reference count reaches zero, the Go
|
||||
// seq package will clear the corresponding entry in the map.
|
||||
@interface GoSeqRef : NSObject {
|
||||
}
|
||||
@property(readonly) int32_t refnum;
|
||||
@property(strong) id obj; // NULL when representing a Go object.
|
||||
|
||||
// new GoSeqRef object to proxy a Go object. The refnum must be
|
||||
// provided from Go side.
|
||||
- (instancetype)initWithRefnum:(int32_t)refnum obj:(id)obj;
|
||||
|
||||
- (int32_t)incNum;
|
||||
|
||||
@end
|
||||
|
||||
@protocol goSeqRefInterface
|
||||
-(GoSeqRef*) _ref;
|
||||
@end
|
||||
|
||||
#endif
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
framework module "GoLibs" {
|
||||
header "ref.h"
|
||||
header "Crypto.objc.h"
|
||||
header "Armor.objc.h"
|
||||
header "Constants.objc.h"
|
||||
header "Models.objc.h"
|
||||
header "Subtle.objc.h"
|
||||
header "Helper.objc.h"
|
||||
header "Srp.objc.h"
|
||||
header "Universe.objc.h"
|
||||
header "GoLibs.h"
|
||||
|
||||
export *
|
||||
}
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
<?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>CFBundleExecutable</key>
|
||||
<string>GoLibs</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>GoLibs</string>
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>100.0</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.0.1756305245</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>0.0.1756305245</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
@ -1 +0,0 @@
|
|||
A
|
||||
48
vendor/Crypto+multiversion-Go/build-config.json
vendored
48
vendor/Crypto+multiversion-Go/build-config.json
vendored
|
|
@ -1,48 +0,0 @@
|
|||
{
|
||||
"go_version":"1.24.1",
|
||||
"go_fork_branch":"fork/go1.24.1",
|
||||
"build_dir":"build",
|
||||
"out_dir":"out",
|
||||
"go_mobile_dir":"mobile",
|
||||
"go_mobile_flags":[
|
||||
"-x",
|
||||
"-ldflags=\"-s -w\"",
|
||||
"-trimpath"
|
||||
],
|
||||
"build_name":"GoLibs",
|
||||
"commit_message":"Crypto build",
|
||||
"upload_branch":"feature/crypto-update/mobile",
|
||||
"destination_folder":"vendor/Crypto-Go",
|
||||
"targets":[
|
||||
"apple"
|
||||
],
|
||||
"min_ios_version":"14.0",
|
||||
"min_macos_version":"12.0",
|
||||
"requirements":[
|
||||
{
|
||||
"module":{
|
||||
"path":"github.com/ProtonMail/gopenpgp/v2",
|
||||
"version":"v2.9.0-proton"
|
||||
},
|
||||
"packages":[
|
||||
"crypto",
|
||||
"armor",
|
||||
"constants",
|
||||
"models",
|
||||
"subtle",
|
||||
"helper"
|
||||
]
|
||||
},
|
||||
{
|
||||
"module":{
|
||||
"path":"github.com/ProtonMail/go-srp",
|
||||
"version":"v0.0.7"
|
||||
}
|
||||
}
|
||||
],
|
||||
"cgo_api":{
|
||||
"path":"github.com/ProtonMail/v3-api",
|
||||
"version":"v0.0.0",
|
||||
"local_path": "../v3-api"
|
||||
}
|
||||
}
|
||||
|
|
@ -1,76 +0,0 @@
|
|||
<?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>AvailableLibraries</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>BinaryPath</key>
|
||||
<string>GoLibs.framework/GoLibs</string>
|
||||
<key>LibraryIdentifier</key>
|
||||
<string>ios-arm64_x86_64-simulator</string>
|
||||
<key>LibraryPath</key>
|
||||
<string>GoLibs.framework</string>
|
||||
<key>SupportedArchitectures</key>
|
||||
<array>
|
||||
<string>arm64</string>
|
||||
<string>x86_64</string>
|
||||
</array>
|
||||
<key>SupportedPlatform</key>
|
||||
<string>ios</string>
|
||||
<key>SupportedPlatformVariant</key>
|
||||
<string>simulator</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>BinaryPath</key>
|
||||
<string>GoLibs.framework/Versions/A/GoLibs</string>
|
||||
<key>LibraryIdentifier</key>
|
||||
<string>macos-arm64_x86_64</string>
|
||||
<key>LibraryPath</key>
|
||||
<string>GoLibs.framework</string>
|
||||
<key>SupportedArchitectures</key>
|
||||
<array>
|
||||
<string>arm64</string>
|
||||
<string>x86_64</string>
|
||||
</array>
|
||||
<key>SupportedPlatform</key>
|
||||
<string>macos</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>BinaryPath</key>
|
||||
<string>GoLibs.framework/Versions/A/GoLibs</string>
|
||||
<key>LibraryIdentifier</key>
|
||||
<string>ios-arm64_x86_64-maccatalyst</string>
|
||||
<key>LibraryPath</key>
|
||||
<string>GoLibs.framework</string>
|
||||
<key>SupportedArchitectures</key>
|
||||
<array>
|
||||
<string>arm64</string>
|
||||
<string>x86_64</string>
|
||||
</array>
|
||||
<key>SupportedPlatform</key>
|
||||
<string>ios</string>
|
||||
<key>SupportedPlatformVariant</key>
|
||||
<string>maccatalyst</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>BinaryPath</key>
|
||||
<string>GoLibs.framework/GoLibs</string>
|
||||
<key>LibraryIdentifier</key>
|
||||
<string>ios-arm64</string>
|
||||
<key>LibraryPath</key>
|
||||
<string>GoLibs.framework</string>
|
||||
<key>SupportedArchitectures</key>
|
||||
<array>
|
||||
<string>arm64</string>
|
||||
</array>
|
||||
<key>SupportedPlatform</key>
|
||||
<string>ios</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>XFWK</string>
|
||||
<key>XCFrameworkFormatVersion</key>
|
||||
<string>1.0</string>
|
||||
</dict>
|
||||
</plist>
|
||||
Binary file not shown.
|
|
@ -1,39 +0,0 @@
|
|||
// Objective-C API for talking to github.com/ProtonMail/gopenpgp/v2/armor Go package.
|
||||
// gobind -lang=objc github.com/ProtonMail/gopenpgp/v2/armor
|
||||
//
|
||||
// File is generated by gobind. Do not edit.
|
||||
|
||||
#ifndef __Armor_H__
|
||||
#define __Armor_H__
|
||||
|
||||
@import Foundation;
|
||||
#include "ref.h"
|
||||
#include "Universe.objc.h"
|
||||
|
||||
#include "Constants.objc.h"
|
||||
|
||||
/**
|
||||
* ArmorKey armors input as a public key.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull ArmorArmorKey(NSData* _Nullable input, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* ArmorWithType armors input with the given armorType.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull ArmorArmorWithType(NSData* _Nullable input, NSString* _Nullable armorType, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* ArmorWithTypeAndCustomHeaders armors input with the given armorType and
|
||||
headers.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull ArmorArmorWithTypeAndCustomHeaders(NSData* _Nullable input, NSString* _Nullable armorType, NSString* _Nullable version, NSString* _Nullable comment, NSError* _Nullable* _Nullable error);
|
||||
|
||||
// skipped function ArmorWithTypeBuffered with unsupported parameter or return types
|
||||
|
||||
|
||||
/**
|
||||
* Unarmor unarmors an armored input into a byte array.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable ArmorUnarmor(NSString* _Nullable input, NSError* _Nullable* _Nullable error);
|
||||
|
||||
#endif
|
||||
|
|
@ -1,72 +0,0 @@
|
|||
// Objective-C API for talking to github.com/ProtonMail/gopenpgp/v2/constants Go package.
|
||||
// gobind -lang=objc github.com/ProtonMail/gopenpgp/v2/constants
|
||||
//
|
||||
// File is generated by gobind. Do not edit.
|
||||
|
||||
#ifndef __Constants_H__
|
||||
#define __Constants_H__
|
||||
|
||||
@import Foundation;
|
||||
#include "ref.h"
|
||||
#include "Universe.objc.h"
|
||||
|
||||
|
||||
/**
|
||||
* Cipher suite names.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsAES128;
|
||||
/**
|
||||
* Cipher suite names.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsAES192;
|
||||
/**
|
||||
* Cipher suite names.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsAES256;
|
||||
/**
|
||||
* Constants for armored data.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsArmorHeaderComment;
|
||||
/**
|
||||
* Constants for armored data.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsArmorHeaderVersion;
|
||||
/**
|
||||
* Cipher suite names.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsCAST5;
|
||||
FOUNDATION_EXPORT const int64_t ConstantsDefaultCompression;
|
||||
FOUNDATION_EXPORT const int64_t ConstantsDefaultCompressionLevel;
|
||||
/**
|
||||
* Constants for armored data.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsPGPMessageHeader;
|
||||
/**
|
||||
* Constants for armored data.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsPGPSignatureHeader;
|
||||
/**
|
||||
* Constants for armored data.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsPrivateKeyHeader;
|
||||
/**
|
||||
* Constants for armored data.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsPublicKeyHeader;
|
||||
FOUNDATION_EXPORT const long ConstantsSIGNATURE_BAD_CONTEXT;
|
||||
FOUNDATION_EXPORT const long ConstantsSIGNATURE_FAILED;
|
||||
FOUNDATION_EXPORT const long ConstantsSIGNATURE_NOT_SIGNED;
|
||||
FOUNDATION_EXPORT const long ConstantsSIGNATURE_NO_VERIFIER;
|
||||
FOUNDATION_EXPORT const long ConstantsSIGNATURE_OK;
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsSignatureContextName;
|
||||
/**
|
||||
* Cipher suite names.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsThreeDES;
|
||||
/**
|
||||
* Cipher suite names.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsTripleDES;
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsVersion;
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,25 +0,0 @@
|
|||
|
||||
// Objective-C API for talking to the following Go packages
|
||||
//
|
||||
// github.com/ProtonMail/gopenpgp/v2/crypto
|
||||
// github.com/ProtonMail/gopenpgp/v2/armor
|
||||
// github.com/ProtonMail/gopenpgp/v2/constants
|
||||
// github.com/ProtonMail/gopenpgp/v2/models
|
||||
// github.com/ProtonMail/gopenpgp/v2/subtle
|
||||
// github.com/ProtonMail/gopenpgp/v2/helper
|
||||
// github.com/ProtonMail/go-srp
|
||||
//
|
||||
// File is generated by gomobile bind. Do not edit.
|
||||
#ifndef __GoLibs_FRAMEWORK_H__
|
||||
#define __GoLibs_FRAMEWORK_H__
|
||||
|
||||
#include "Crypto.objc.h"
|
||||
#include "Armor.objc.h"
|
||||
#include "Constants.objc.h"
|
||||
#include "Models.objc.h"
|
||||
#include "Subtle.objc.h"
|
||||
#include "Helper.objc.h"
|
||||
#include "Srp.objc.h"
|
||||
#include "Universe.objc.h"
|
||||
|
||||
#endif
|
||||
|
|
@ -1,481 +0,0 @@
|
|||
// Objective-C API for talking to github.com/ProtonMail/gopenpgp/v2/helper Go package.
|
||||
// gobind -lang=objc github.com/ProtonMail/gopenpgp/v2/helper
|
||||
//
|
||||
// File is generated by gobind. Do not edit.
|
||||
|
||||
#ifndef __Helper_H__
|
||||
#define __Helper_H__
|
||||
|
||||
@import Foundation;
|
||||
#include "ref.h"
|
||||
#include "Universe.objc.h"
|
||||
|
||||
#include "Crypto.objc.h"
|
||||
|
||||
@class HelperEncryptSignArmoredDetachedMobileResult;
|
||||
@class HelperEncryptSignBinaryDetachedMobileResult;
|
||||
@class HelperExplicitVerifyMessage;
|
||||
@class HelperGo2AndroidReader;
|
||||
@class HelperGo2IOSReader;
|
||||
@class HelperMobile2GoReader;
|
||||
@class HelperMobile2GoWriter;
|
||||
@class HelperMobile2GoWriterWithSHA256;
|
||||
@class HelperMobileReadResult;
|
||||
@protocol HelperMobileReader;
|
||||
@class HelperMobileReader;
|
||||
|
||||
@protocol HelperMobileReader <NSObject>
|
||||
- (HelperMobileReadResult* _Nullable)read:(long)max error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
@interface HelperEncryptSignArmoredDetachedMobileResult : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) NSString* _Nonnull ciphertextArmored;
|
||||
@property (nonatomic) NSString* _Nonnull encryptedSignatureArmored;
|
||||
@end
|
||||
|
||||
@interface HelperEncryptSignBinaryDetachedMobileResult : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) NSData* _Nullable encryptedData;
|
||||
@property (nonatomic) NSString* _Nonnull encryptedSignatureArmored;
|
||||
@end
|
||||
|
||||
@interface HelperExplicitVerifyMessage : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) CryptoPlainMessage* _Nullable message;
|
||||
@property (nonatomic) CryptoSignatureVerificationError* _Nullable signatureVerificationError;
|
||||
@end
|
||||
|
||||
/**
|
||||
* Go2AndroidReader is used to wrap a native golang Reader in the golang runtime,
|
||||
to be usable in the android app runtime (via gomobile).
|
||||
*/
|
||||
@interface HelperGo2AndroidReader : NSObject <goSeqRefInterface, CryptoReader> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
/**
|
||||
* NewGo2AndroidReader wraps a native golang Reader to be usable in the mobile app runtime (via gomobile).
|
||||
It doesn't follow the standard golang Reader behavior, and returns n = -1 on EOF.
|
||||
*/
|
||||
- (nullable instancetype)init:(id<CryptoReader> _Nullable)reader;
|
||||
/**
|
||||
* Read reads bytes into the provided buffer and returns the number of bytes read
|
||||
It doesn't follow the standard golang Reader behavior, and returns n = -1 on EOF.
|
||||
*/
|
||||
- (BOOL)read:(NSData* _Nullable)b n:(long* _Nullable)n error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
/**
|
||||
* Go2IOSReader is used to wrap a native golang Reader in the golang runtime,
|
||||
to be usable in the iOS app runtime (via gomobile) as a MobileReader.
|
||||
*/
|
||||
@interface HelperGo2IOSReader : NSObject <goSeqRefInterface, HelperMobileReader> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
/**
|
||||
* NewGo2IOSReader wraps a native golang Reader to be usable in the ios app runtime (via gomobile).
|
||||
*/
|
||||
- (nullable instancetype)init:(id<CryptoReader> _Nullable)reader;
|
||||
/**
|
||||
* Read reads at most <max> bytes from the wrapped Reader and returns the read data as a MobileReadResult.
|
||||
*/
|
||||
- (HelperMobileReadResult* _Nullable)read:(long)max error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
/**
|
||||
* Mobile2GoReader is used to wrap a MobileReader in the mobile app runtime,
|
||||
to be usable in the golang runtime (via gomobile) as a native Reader.
|
||||
*/
|
||||
@interface HelperMobile2GoReader : NSObject <goSeqRefInterface, CryptoReader> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
/**
|
||||
* NewMobile2GoReader wraps a MobileReader to be usable in the golang runtime (via gomobile).
|
||||
*/
|
||||
- (nullable instancetype)init:(id<HelperMobileReader> _Nullable)reader;
|
||||
/**
|
||||
* Read reads data from the wrapped MobileReader and copies the read data in the provided buffer.
|
||||
It also handles the conversion of EOF to an error.
|
||||
*/
|
||||
- (BOOL)read:(NSData* _Nullable)b n:(long* _Nullable)n error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
/**
|
||||
* Mobile2GoWriter is used to wrap a writer in the mobile app runtime,
|
||||
to be usable in the golang runtime (via gomobile).
|
||||
*/
|
||||
@interface HelperMobile2GoWriter : NSObject <goSeqRefInterface, CryptoWriter> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
/**
|
||||
* NewMobile2GoWriter wraps a writer to be usable in the golang runtime (via gomobile).
|
||||
*/
|
||||
- (nullable instancetype)init:(id<CryptoWriter> _Nullable)writer;
|
||||
/**
|
||||
* Write writes the data in the provided buffer in the wrapped writer.
|
||||
It clones the provided data to prevent errors with garbage collectors.
|
||||
*/
|
||||
- (BOOL)write:(NSData* _Nullable)b n:(long* _Nullable)n error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
/**
|
||||
* Mobile2GoWriterWithSHA256 is used to wrap a writer in the mobile app runtime,
|
||||
to be usable in the golang runtime (via gomobile).
|
||||
It also computes the SHA256 hash of the data being written on the fly.
|
||||
*/
|
||||
@interface HelperMobile2GoWriterWithSHA256 : NSObject <goSeqRefInterface, CryptoWriter> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
/**
|
||||
* NewMobile2GoWriterWithSHA256 wraps a writer to be usable in the golang runtime (via gomobile).
|
||||
The wrapper also computes the SHA256 hash of the data being written on the fly.
|
||||
*/
|
||||
- (nullable instancetype)init:(id<CryptoWriter> _Nullable)writer;
|
||||
/**
|
||||
* GetSHA256 returns the SHA256 hash of the data that's been written so far.
|
||||
*/
|
||||
- (NSData* _Nullable)getSHA256;
|
||||
/**
|
||||
* Write writes the data in the provided buffer in the wrapped writer.
|
||||
It clones the provided data to prevent errors with garbage collectors.
|
||||
It also computes the SHA256 hash of the data being written on the fly.
|
||||
*/
|
||||
- (BOOL)write:(NSData* _Nullable)b n:(long* _Nullable)n error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
/**
|
||||
* MobileReadResult is what needs to be returned by MobileReader.Read.
|
||||
The read data is passed as a return value rather than passed as an argument to the reader.
|
||||
This avoids problems introduced by gomobile that prevent the use of native golang readers.
|
||||
*/
|
||||
@interface HelperMobileReadResult : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
/**
|
||||
* NewMobileReadResult initialize a MobileReadResult with the correct values.
|
||||
It clones the data to avoid the garbage collector freeing the data too early.
|
||||
*/
|
||||
- (nullable instancetype)init:(long)n eof:(BOOL)eof data:(NSData* _Nullable)data;
|
||||
@property (nonatomic) long n;
|
||||
@property (nonatomic) BOOL isEOF;
|
||||
@property (nonatomic) NSData* _Nullable data;
|
||||
@end
|
||||
|
||||
FOUNDATION_EXPORT const int64_t HelperAES_BLOCK_SIZE;
|
||||
|
||||
/**
|
||||
* DecryptAttachment takes a keypacket and datpacket
|
||||
and returns a decrypted PlainMessage
|
||||
Specifically designed for attachments rather than text messages.
|
||||
*/
|
||||
FOUNDATION_EXPORT CryptoPlainMessage* _Nullable HelperDecryptAttachment(NSData* _Nullable keyPacket, NSData* _Nullable dataPacket, CryptoKeyRing* _Nullable keyRing, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptAttachmentWithKey decrypts a binary file
|
||||
Using a given armored private key and its passphrase.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable HelperDecryptAttachmentWithKey(NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSData* _Nullable keyPacket, NSData* _Nullable dataPacket, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptBinaryMessageArmored decrypts an armored PGP message given a private key
|
||||
and its passphrase.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable HelperDecryptBinaryMessageArmored(NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSString* _Nullable ciphertext, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptExplicitVerify decrypts a PGP message given a private keyring
|
||||
and a public keyring to verify the embedded signature. Returns the plain
|
||||
data and an error on signature verification failure.
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperExplicitVerifyMessage* _Nullable HelperDecryptExplicitVerify(CryptoPGPMessage* _Nullable pgpMessage, CryptoKeyRing* _Nullable privateKeyRing, CryptoKeyRing* _Nullable publicKeyRing, int64_t verifyTime, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptExplicitVerifyWithContext decrypts a PGP message given a private keyring
|
||||
and a public keyring to verify the embedded signature. Returns the plain
|
||||
data and an error on signature verification failure.
|
||||
The caller can provide a context that will be used to verify the signature.
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperExplicitVerifyMessage* _Nullable HelperDecryptExplicitVerifyWithContext(CryptoPGPMessage* _Nullable pgpMessage, CryptoKeyRing* _Nullable privateKeyRing, CryptoKeyRing* _Nullable publicKeyRing, int64_t verifyTime, CryptoVerificationContext* _Nullable verificationContext, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptMessageArmored decrypts an armored PGP message given a private key
|
||||
and its passphrase.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperDecryptMessageArmored(NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSString* _Nullable ciphertext, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptMessageWithPassword decrypts an armored message with a random token.
|
||||
The algorithm is derived from the armoring.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperDecryptMessageWithPassword(NSData* _Nullable password, NSString* _Nullable ciphertext, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptSessionKey decrypts a session key
|
||||
using a given armored private key
|
||||
and its passphrase.
|
||||
*/
|
||||
FOUNDATION_EXPORT CryptoSessionKey* _Nullable HelperDecryptSessionKey(NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSData* _Nullable encryptedSessionKey, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptSessionKeyExplicitVerify decrypts a PGP data packet given a session key
|
||||
and a public keyring to verify the embedded signature. Returns the plain data and
|
||||
an error on signature verification failure.
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperExplicitVerifyMessage* _Nullable HelperDecryptSessionKeyExplicitVerify(NSData* _Nullable dataPacket, CryptoSessionKey* _Nullable sessionKey, CryptoKeyRing* _Nullable publicKeyRing, int64_t verifyTime, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptSessionKeyExplicitVerifyWithContext decrypts a PGP data packet given a session key
|
||||
and a public keyring to verify the embedded signature. Returns the plain data and
|
||||
an error on signature verification failure.
|
||||
The caller can provide a context that will be used to verify the signature.
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperExplicitVerifyMessage* _Nullable HelperDecryptSessionKeyExplicitVerifyWithContext(NSData* _Nullable dataPacket, CryptoSessionKey* _Nullable sessionKey, CryptoKeyRing* _Nullable publicKeyRing, int64_t verifyTime, CryptoVerificationContext* _Nullable verificationContext, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptVerifyArmoredDetached decrypts an armored pgp message
|
||||
and verify a detached armored encrypted signature
|
||||
given a publicKey, and a privateKey with its passphrase.
|
||||
Returns the plain data or an error on
|
||||
signature verification failure.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable HelperDecryptVerifyArmoredDetached(NSString* _Nullable publicKey, NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSString* _Nullable ciphertextArmored, NSString* _Nullable encryptedSignatureArmored, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptVerifyAttachment decrypts and verifies an attachment split into the
|
||||
keyPacket, dataPacket and an armored (!) signature, given a publicKey, and a
|
||||
privateKey with its passphrase. Returns the plain data or an error on
|
||||
signature verification failure.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable HelperDecryptVerifyAttachment(NSString* _Nullable publicKey, NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSData* _Nullable keyPacket, NSData* _Nullable dataPacket, NSString* _Nullable armoredSignature, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptVerifyBinaryDetached decrypts binary encrypted data
|
||||
and verify a detached armored encrypted signature
|
||||
given a publicKey, and a privateKey with its passphrase.
|
||||
Returns the plain data or an error on
|
||||
signature verification failure.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable HelperDecryptVerifyBinaryDetached(NSString* _Nullable publicKey, NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSData* _Nullable encryptedData, NSString* _Nullable encryptedSignatureArmored, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptVerifyMessageArmored decrypts an armored PGP message given a private
|
||||
key and its passphrase and verifies the embedded signature. Returns the
|
||||
plain data or an error on signature verification failure.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperDecryptVerifyMessageArmored(NSString* _Nullable publicKey, NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSString* _Nullable ciphertext, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptAttachment encrypts a file given a plainData and a fileName.
|
||||
Returns a PGPSplitMessage containing a session key packet and symmetrically
|
||||
encrypted data. Specifically designed for attachments rather than text
|
||||
messages.
|
||||
*/
|
||||
FOUNDATION_EXPORT CryptoPGPSplitMessage* _Nullable HelperEncryptAttachment(NSData* _Nullable plainData, NSString* _Nullable filename, CryptoKeyRing* _Nullable keyRing, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptAttachmentWithKey encrypts a binary file
|
||||
Using a given armored public key.
|
||||
*/
|
||||
FOUNDATION_EXPORT CryptoPGPSplitMessage* _Nullable HelperEncryptAttachmentWithKey(NSString* _Nullable publicKey, NSString* _Nullable filename, NSData* _Nullable plainData, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptBinaryMessageArmored generates an armored PGP message given a binary data and
|
||||
an armored public key.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperEncryptBinaryMessageArmored(NSString* _Nullable key, NSData* _Nullable data, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptMessageArmored generates an armored PGP message given a plaintext and
|
||||
an armored public key.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperEncryptMessageArmored(NSString* _Nullable key, NSString* _Nullable plaintext, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptMessageWithPassword encrypts a string with a passphrase using AES256.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperEncryptMessageWithPassword(NSData* _Nullable password, NSString* _Nullable plaintext, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptPGPMessageToAdditionalKey decrypts the session key of the input PGPSplitMessage with a private key in keyRing
|
||||
and encrypts it towards the additionalKeys by adding the additional key packets to the input PGPSplitMessage.
|
||||
If successful, new key packets are added to message.
|
||||
* messageToModify : The encrypted pgp message that should be modified
|
||||
* keyRing : The private keys to decrypt the session key in the messageToModify.
|
||||
* additionalKey : The public keys the message should be additionally encrypted to.
|
||||
*/
|
||||
FOUNDATION_EXPORT BOOL HelperEncryptPGPMessageToAdditionalKey(CryptoPGPSplitMessage* _Nullable messageToModify, CryptoKeyRing* _Nullable keyRing, CryptoKeyRing* _Nullable additionalKey, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptSessionKey encrypts a session key
|
||||
using a given armored public key.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable HelperEncryptSessionKey(NSString* _Nullable publicKey, CryptoSessionKey* _Nullable sessionKey, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptSignArmoredDetachedMobile wraps the encryptSignArmoredDetached method
|
||||
to have only one return argument for mobile.
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperEncryptSignArmoredDetachedMobileResult* _Nullable HelperEncryptSignArmoredDetachedMobile(NSString* _Nullable publicKey, NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSData* _Nullable plainData, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptSignBinaryDetachedMobile wraps the encryptSignBinaryDetached method
|
||||
to have only one return argument for mobile.
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperEncryptSignBinaryDetachedMobileResult* _Nullable HelperEncryptSignBinaryDetachedMobile(NSString* _Nullable publicKey, NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSData* _Nullable plainData, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptSignMessageArmored generates an armored signed PGP message given a
|
||||
plaintext and an armored public key a private key and its passphrase.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperEncryptSignMessageArmored(NSString* _Nullable publicKey, NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSString* _Nullable plaintext, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* FreeOSMemory can be used to explicitly
|
||||
call the garbage collector and
|
||||
return the unused memory to the OS.
|
||||
*/
|
||||
FOUNDATION_EXPORT void HelperFreeOSMemory(void);
|
||||
|
||||
/**
|
||||
* GenerateKey generates a key of the given keyType ("rsa" or "x25519"), encrypts it, and returns an armored string.
|
||||
If keyType is "rsa", bits is the RSA bitsize of the key.
|
||||
If keyType is "x25519" bits is unused.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperGenerateKey(NSString* _Nullable name, NSString* _Nullable email, NSData* _Nullable passphrase, NSString* _Nullable keyType, long bits, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* GetJsonSHA256Fingerprints returns the SHA256 fingeprints of key and subkeys,
|
||||
encoded in JSON, since gomobile can not handle arrays.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable HelperGetJsonSHA256Fingerprints(NSString* _Nullable publicKey, NSError* _Nullable* _Nullable error);
|
||||
|
||||
// skipped function GetSHA256Fingerprints with unsupported parameter or return types
|
||||
|
||||
|
||||
/**
|
||||
* NewGo2AndroidReader wraps a native golang Reader to be usable in the mobile app runtime (via gomobile).
|
||||
It doesn't follow the standard golang Reader behavior, and returns n = -1 on EOF.
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperGo2AndroidReader* _Nullable HelperNewGo2AndroidReader(id<CryptoReader> _Nullable reader);
|
||||
|
||||
/**
|
||||
* NewGo2IOSReader wraps a native golang Reader to be usable in the ios app runtime (via gomobile).
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperGo2IOSReader* _Nullable HelperNewGo2IOSReader(id<CryptoReader> _Nullable reader);
|
||||
|
||||
/**
|
||||
* NewMobile2GoReader wraps a MobileReader to be usable in the golang runtime (via gomobile).
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperMobile2GoReader* _Nullable HelperNewMobile2GoReader(id<HelperMobileReader> _Nullable reader);
|
||||
|
||||
/**
|
||||
* NewMobile2GoWriter wraps a writer to be usable in the golang runtime (via gomobile).
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperMobile2GoWriter* _Nullable HelperNewMobile2GoWriter(id<CryptoWriter> _Nullable writer);
|
||||
|
||||
/**
|
||||
* NewMobile2GoWriterWithSHA256 wraps a writer to be usable in the golang runtime (via gomobile).
|
||||
The wrapper also computes the SHA256 hash of the data being written on the fly.
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperMobile2GoWriterWithSHA256* _Nullable HelperNewMobile2GoWriterWithSHA256(id<CryptoWriter> _Nullable writer);
|
||||
|
||||
/**
|
||||
* NewMobileReadResult initialize a MobileReadResult with the correct values.
|
||||
It clones the data to avoid the garbage collector freeing the data too early.
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperMobileReadResult* _Nullable HelperNewMobileReadResult(long n, BOOL eof, NSData* _Nullable data);
|
||||
|
||||
/**
|
||||
* QuickCheckDecrypt checks with high probability if the provided session key
|
||||
can decrypt the encrypted data packet given its 24 byte long prefix.
|
||||
The method only considers the first 24 bytes of the prefix slice (prefix[:24]).
|
||||
NOTE: Only works for SEIPDv1 packets with AES.
|
||||
*/
|
||||
FOUNDATION_EXPORT BOOL HelperQuickCheckDecrypt(CryptoSessionKey* _Nullable sessionKey, NSData* _Nullable prefix, BOOL* _Nullable ret0_, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* QuickCheckDecryptReader checks with high probability if the provided session key
|
||||
can decrypt a data packet given its 24 byte long prefix.
|
||||
The method reads up to but not exactly 24 bytes from the prefixReader.
|
||||
NOTE: Only works for SEIPDv1 packets with AES.
|
||||
*/
|
||||
FOUNDATION_EXPORT BOOL HelperQuickCheckDecryptReader(CryptoSessionKey* _Nullable sessionKey, id<CryptoReader> _Nullable prefixReader, BOOL* _Nullable ret0_, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* SignCleartextMessage signs text given a private keyring, canonicalizes and
|
||||
trims the newlines, and returns the PGP-compliant special armoring.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperSignCleartextMessage(CryptoKeyRing* _Nullable keyRing, NSString* _Nullable text, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* SignCleartextMessageArmored signs text given a private key and its
|
||||
passphrase, canonicalizes and trims the newlines, and returns the
|
||||
PGP-compliant special armoring.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperSignCleartextMessageArmored(NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSString* _Nullable text, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* UpdatePrivateKeyPassphrase decrypts the given armored privateKey with oldPassphrase,
|
||||
re-encrypts it with newPassphrase, and returns the new armored key.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperUpdatePrivateKeyPassphrase(NSString* _Nullable privateKey, NSData* _Nullable oldPassphrase, NSData* _Nullable newPassphrase, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* VerifyCleartextMessage verifies PGP-compliant armored signed plain text
|
||||
given the public keyring and returns the text or err if the verification
|
||||
fails.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperVerifyCleartextMessage(CryptoKeyRing* _Nullable keyRing, NSString* _Nullable armored, int64_t verifyTime, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* VerifyCleartextMessageArmored verifies PGP-compliant armored signed plain
|
||||
text given the public key and returns the text or err if the verification
|
||||
fails.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperVerifyCleartextMessageArmored(NSString* _Nullable publicKey, NSString* _Nullable armored, int64_t verifyTime, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* VerifySignatureExplicit calls the reader's VerifySignature()
|
||||
and tries to cast the returned error to a SignatureVerificationError.
|
||||
*/
|
||||
FOUNDATION_EXPORT CryptoSignatureVerificationError* _Nullable HelperVerifySignatureExplicit(CryptoPlainMessageReader* _Nullable reader, NSError* _Nullable* _Nullable error);
|
||||
|
||||
@class HelperMobileReader;
|
||||
|
||||
/**
|
||||
* MobileReader is the interface that readers in the mobile runtime must use and implement.
|
||||
This is a workaround to some of the gomobile limitations.
|
||||
*/
|
||||
@interface HelperMobileReader : NSObject <goSeqRefInterface, HelperMobileReader> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (HelperMobileReadResult* _Nullable)read:(long)max error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
#endif
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
// Objective-C API for talking to github.com/ProtonMail/gopenpgp/v2/models Go package.
|
||||
// gobind -lang=objc github.com/ProtonMail/gopenpgp/v2/models
|
||||
//
|
||||
// File is generated by gobind. Do not edit.
|
||||
|
||||
#ifndef __Models_H__
|
||||
#define __Models_H__
|
||||
|
||||
@import Foundation;
|
||||
#include "ref.h"
|
||||
#include "Universe.objc.h"
|
||||
|
||||
|
||||
@class ModelsEncryptedSigned;
|
||||
|
||||
/**
|
||||
* EncryptedSigned contains an encrypted message and signature.
|
||||
*/
|
||||
@interface ModelsEncryptedSigned : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) NSString* _Nonnull encrypted;
|
||||
@property (nonatomic) NSString* _Nonnull signature;
|
||||
@end
|
||||
|
||||
#endif
|
||||
|
|
@ -1,265 +0,0 @@
|
|||
// Objective-C API for talking to github.com/ProtonMail/go-srp Go package.
|
||||
// gobind -lang=objc github.com/ProtonMail/go-srp
|
||||
//
|
||||
// File is generated by gobind. Do not edit.
|
||||
|
||||
#ifndef __Srp_H__
|
||||
#define __Srp_H__
|
||||
|
||||
@import Foundation;
|
||||
#include "ref.h"
|
||||
#include "Universe.objc.h"
|
||||
|
||||
|
||||
@class SrpAuth;
|
||||
@class SrpProofs;
|
||||
@class SrpServer;
|
||||
|
||||
/**
|
||||
* Auth stores byte data for the calculation of SRP proofs.
|
||||
* Changed SrpAuto to Auth because the name will be used as srp.SrpAuto by other packages and as SrpSrpAuth on mobile
|
||||
* Also the data from the API called Auth. it could be match the meaning and reduce the confusion
|
||||
*/
|
||||
@interface SrpAuth : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
/**
|
||||
* NewAuth Creates new Auth from strings input. Salt and server ephemeral are in
|
||||
base64 format. Modulus is base64 with signature attached. The signature is
|
||||
verified against server key. The version controls password hash algorithm.
|
||||
|
||||
Parameters:
|
||||
- version int: The *x* component of the vector.
|
||||
- username string: The *y* component of the vector.
|
||||
- password []byte: The *z* component of the vector.
|
||||
- b64salt string: The std-base64 formatted salt
|
||||
Returns:
|
||||
- auth *Auth: the pre calculated auth information
|
||||
- err error: throw error
|
||||
Usage:
|
||||
|
||||
Warnings:
|
||||
- Be careful! Poos can hurt.
|
||||
*/
|
||||
- (nullable instancetype)init:(long)version username:(NSString* _Nullable)username password:(NSData* _Nullable)password b64salt:(NSString* _Nullable)b64salt signedModulus:(NSString* _Nullable)signedModulus serverEphemeral:(NSString* _Nullable)serverEphemeral;
|
||||
/**
|
||||
* NewAuthForVerifier Creates new Auth from strings input. Salt and server ephemeral are in
|
||||
base64 format. Modulus is base64 with signature attached. The signature is
|
||||
verified against server key. The version controls password hash algorithm.
|
||||
|
||||
Parameters:
|
||||
- version int: The *x* component of the vector.
|
||||
- username string: The *y* component of the vector.
|
||||
- password []byte: The *z* component of the vector.
|
||||
- salt string:
|
||||
Returns:
|
||||
- auth *Auth: the pre calculated auth information
|
||||
- err error: throw error
|
||||
Usage:
|
||||
|
||||
Warnings:
|
||||
- none.
|
||||
*/
|
||||
- (nullable instancetype)initForVerifier:(NSData* _Nullable)password signedModulus:(NSString* _Nullable)signedModulus rawSalt:(NSData* _Nullable)rawSalt;
|
||||
@property (nonatomic) NSData* _Nullable modulus;
|
||||
@property (nonatomic) NSData* _Nullable serverEphemeral;
|
||||
@property (nonatomic) NSData* _Nullable hashedPassword;
|
||||
@property (nonatomic) long version;
|
||||
/**
|
||||
* GenerateProofs calculates SPR proofs.
|
||||
*/
|
||||
- (SrpProofs* _Nullable)generateProofs:(long)bitLength error:(NSError* _Nullable* _Nullable)error;
|
||||
/**
|
||||
* GenerateVerifier verifier for update pwds and create accounts
|
||||
*/
|
||||
- (NSData* _Nullable)generateVerifier:(long)bitLength error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
/**
|
||||
* Proofs Srp Proofs object. Changed SrpProofs to Proofs because the name will be used as srp.SrpProofs by other packages and as SrpSrpProofs on mobile
|
||||
ClientProof []byte client proof
|
||||
ClientEphemeral []byte calculated from
|
||||
ExpectedServerProof []byte
|
||||
*/
|
||||
@interface SrpProofs : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) NSData* _Nullable clientProof;
|
||||
@property (nonatomic) NSData* _Nullable clientEphemeral;
|
||||
@property (nonatomic) NSData* _Nullable expectedServerProof;
|
||||
@end
|
||||
|
||||
/**
|
||||
* Server stores the internal state for the validation of SRP proofs.
|
||||
*/
|
||||
@interface SrpServer : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
/**
|
||||
* NewServer creates a new server instance from the raw binary data.
|
||||
*/
|
||||
- (nullable instancetype)init:(NSData* _Nullable)modulusBytes verifier:(NSData* _Nullable)verifier bitLength:(long)bitLength;
|
||||
/**
|
||||
* NewServerFromSigned creates a new server instance from the signed modulus and the binary verifier.
|
||||
*/
|
||||
- (nullable instancetype)initFromSigned:(NSString* _Nullable)signedModulus verifier:(NSData* _Nullable)verifier bitLength:(long)bitLength;
|
||||
/**
|
||||
* NewServerWithSecret creates a new server instance without generating a random secret from the raw binary data.
|
||||
Use with caution as the secret should not be reused.
|
||||
*/
|
||||
- (nullable instancetype)initWithSecret:(NSData* _Nullable)modulusBytes verifier:(NSData* _Nullable)verifier secretBytes:(NSData* _Nullable)secretBytes bitLength:(long)bitLength;
|
||||
/**
|
||||
* GenerateChallenge is the first step for SRP exchange, and generates a valid challenge for the provided verifier.
|
||||
*/
|
||||
- (NSData* _Nullable)generateChallenge:(NSError* _Nullable* _Nullable)error;
|
||||
/**
|
||||
* GetSharedSession returns the shared secret as byte if the session has concluded in valid state.
|
||||
*/
|
||||
- (NSData* _Nullable)getSharedSession:(NSError* _Nullable* _Nullable)error;
|
||||
/**
|
||||
* IsCompleted returns true if the exchange has been concluded in valid state.
|
||||
*/
|
||||
- (BOOL)isCompleted;
|
||||
/**
|
||||
* VerifyProofs Verifies the client proof and - if valid - generates the shared secret and returnd the server proof.
|
||||
It concludes the exchange in valid state if successful.
|
||||
*/
|
||||
- (NSData* _Nullable)verifyProofs:(NSData* _Nullable)clientEphemeralBytes clientProofBytes:(NSData* _Nullable)clientProofBytes error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const SrpVersion;
|
||||
|
||||
@interface Srp : NSObject
|
||||
/**
|
||||
* Implementation following the "context" package
|
||||
*/
|
||||
+ (NSError* _Nullable) deadlineExceeded;
|
||||
+ (void) setDeadlineExceeded:(NSError* _Nullable)v;
|
||||
|
||||
/**
|
||||
* ErrDataAfterModulus found extra data after decode the modulus
|
||||
*/
|
||||
+ (NSError* _Nullable) errDataAfterModulus;
|
||||
+ (void) setErrDataAfterModulus:(NSError* _Nullable)v;
|
||||
|
||||
/**
|
||||
* ErrInvalidSignature invalid modulus signature
|
||||
*/
|
||||
+ (NSError* _Nullable) errInvalidSignature;
|
||||
+ (void) setErrInvalidSignature:(NSError* _Nullable)v;
|
||||
|
||||
// skipped variable RandReader with unsupported type: io.Reader
|
||||
|
||||
@end
|
||||
|
||||
/**
|
||||
* Argon2PreimageChallenge computes the base64 solution for a given Argon2 base64
|
||||
challenge within deadlineUnixMilli milliseconds, if any was found. Deadlines are measured
|
||||
on the wall clock, not the monotonic clock, due to unreliability on mobile devices.
|
||||
deadlineUnixMilli = -1 means unlimited time.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull SrpArgon2PreimageChallenge(NSString* _Nullable b64Challenge, int64_t deadlineUnixMilli, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* ECDLPChallenge computes the base64 solution for a given ECDLP base64 challenge
|
||||
within deadlineUnixMilli milliseconds, if any was found. Deadlines are measured on the
|
||||
wall clock, not the monotonic clock, due to unreliability on mobile devices.
|
||||
deadlineUnixMilli = -1 means unlimited time.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull SrpECDLPChallenge(NSString* _Nullable b64Challenge, int64_t deadlineUnixMilli, NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT NSString* _Nonnull SrpGetModulusKey(void);
|
||||
|
||||
/**
|
||||
* HashPassword returns the hash of password argument. Based on version number
|
||||
following arguments are used in addition to password:
|
||||
* 0, 1, 2: userName and modulus
|
||||
* 3, 4: salt and modulus
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable SrpHashPassword(long authVersion, NSData* _Nullable password, NSString* _Nullable userName, NSData* _Nullable salt, NSData* _Nullable modulus, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* MailboxPassword get mailbox password hash
|
||||
|
||||
Parameters:
|
||||
- password []byte: a mailbox password
|
||||
- salt []byte: a salt is random 128 bits data
|
||||
Returns:
|
||||
- hashed []byte: a hashed password
|
||||
- err error: throw error
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable SrpMailboxPassword(NSData* _Nullable password, NSData* _Nullable salt, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* NewAuth Creates new Auth from strings input. Salt and server ephemeral are in
|
||||
base64 format. Modulus is base64 with signature attached. The signature is
|
||||
verified against server key. The version controls password hash algorithm.
|
||||
|
||||
Parameters:
|
||||
- version int: The *x* component of the vector.
|
||||
- username string: The *y* component of the vector.
|
||||
- password []byte: The *z* component of the vector.
|
||||
- b64salt string: The std-base64 formatted salt
|
||||
Returns:
|
||||
- auth *Auth: the pre calculated auth information
|
||||
- err error: throw error
|
||||
Usage:
|
||||
|
||||
Warnings:
|
||||
- Be careful! Poos can hurt.
|
||||
*/
|
||||
FOUNDATION_EXPORT SrpAuth* _Nullable SrpNewAuth(long version, NSString* _Nullable username, NSData* _Nullable password, NSString* _Nullable b64salt, NSString* _Nullable signedModulus, NSString* _Nullable serverEphemeral, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* NewAuthForVerifier Creates new Auth from strings input. Salt and server ephemeral are in
|
||||
base64 format. Modulus is base64 with signature attached. The signature is
|
||||
verified against server key. The version controls password hash algorithm.
|
||||
|
||||
Parameters:
|
||||
- version int: The *x* component of the vector.
|
||||
- username string: The *y* component of the vector.
|
||||
- password []byte: The *z* component of the vector.
|
||||
- salt string:
|
||||
Returns:
|
||||
- auth *Auth: the pre calculated auth information
|
||||
- err error: throw error
|
||||
Usage:
|
||||
|
||||
Warnings:
|
||||
- none.
|
||||
*/
|
||||
FOUNDATION_EXPORT SrpAuth* _Nullable SrpNewAuthForVerifier(NSData* _Nullable password, NSString* _Nullable signedModulus, NSData* _Nullable rawSalt, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* NewServer creates a new server instance from the raw binary data.
|
||||
*/
|
||||
FOUNDATION_EXPORT SrpServer* _Nullable SrpNewServer(NSData* _Nullable modulusBytes, NSData* _Nullable verifier, long bitLength, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* NewServerFromSigned creates a new server instance from the signed modulus and the binary verifier.
|
||||
*/
|
||||
FOUNDATION_EXPORT SrpServer* _Nullable SrpNewServerFromSigned(NSString* _Nullable signedModulus, NSData* _Nullable verifier, long bitLength, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* NewServerWithSecret creates a new server instance without generating a random secret from the raw binary data.
|
||||
Use with caution as the secret should not be reused.
|
||||
*/
|
||||
FOUNDATION_EXPORT SrpServer* _Nullable SrpNewServerWithSecret(NSData* _Nullable modulusBytes, NSData* _Nullable verifier, NSData* _Nullable secretBytes, long bitLength, NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT NSData* _Nullable SrpRandomBits(long bits, NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT NSData* _Nullable SrpRandomBytes(long byes, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* VersionNumber get current library version
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull SrpVersionNumber(void);
|
||||
|
||||
#endif
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
// Objective-C API for talking to github.com/ProtonMail/gopenpgp/v2/subtle Go package.
|
||||
// gobind -lang=objc github.com/ProtonMail/gopenpgp/v2/subtle
|
||||
//
|
||||
// File is generated by gobind. Do not edit.
|
||||
|
||||
#ifndef __Subtle_H__
|
||||
#define __Subtle_H__
|
||||
|
||||
@import Foundation;
|
||||
#include "ref.h"
|
||||
#include "Universe.objc.h"
|
||||
|
||||
|
||||
/**
|
||||
* DecryptWithoutIntegrity decrypts data encrypted with AES-CTR.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable SubtleDecryptWithoutIntegrity(NSData* _Nullable key, NSData* _Nullable input, NSData* _Nullable iv, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DeriveKey derives a key from a password using scrypt. n should be set to the
|
||||
highest power of 2 you can derive within 100 milliseconds.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable SubtleDeriveKey(NSString* _Nullable password, NSData* _Nullable salt, long n, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptWithoutIntegrity encrypts data with AES-CTR. Note: this encryption
|
||||
mode is not secure when stored/sent on an untrusted medium.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable SubtleEncryptWithoutIntegrity(NSData* _Nullable key, NSData* _Nullable input, NSData* _Nullable iv, NSError* _Nullable* _Nullable error);
|
||||
|
||||
#endif
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
// Objective-C API for talking to Go package.
|
||||
// gobind -lang=objc
|
||||
//
|
||||
// File is generated by gobind. Do not edit.
|
||||
|
||||
#ifndef __Universe_H__
|
||||
#define __Universe_H__
|
||||
|
||||
@import Foundation;
|
||||
#include "ref.h"
|
||||
|
||||
@protocol Universeerror;
|
||||
@class Universeerror;
|
||||
|
||||
@protocol Universeerror <NSObject>
|
||||
- (NSString* _Nonnull)error;
|
||||
@end
|
||||
|
||||
@class Universeerror;
|
||||
|
||||
@interface Universeerror : NSError <goSeqRefInterface, Universeerror> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (NSString* _Nonnull)error;
|
||||
@end
|
||||
|
||||
#endif
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
// Copyright 2015 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
#ifndef __GO_REF_HDR__
|
||||
#define __GO_REF_HDR__
|
||||
|
||||
#include <Foundation/Foundation.h>
|
||||
|
||||
// GoSeqRef is an object tagged with an integer for passing back and
|
||||
// forth across the language boundary. A GoSeqRef may represent either
|
||||
// an instance of a Go object, or an Objective-C object passed to Go.
|
||||
// The explicit allocation of a GoSeqRef is used to pin a Go object
|
||||
// when it is passed to Objective-C. The Go seq package maintains a
|
||||
// reference to the Go object in a map keyed by the refnum along with
|
||||
// a reference count. When the reference count reaches zero, the Go
|
||||
// seq package will clear the corresponding entry in the map.
|
||||
@interface GoSeqRef : NSObject {
|
||||
}
|
||||
@property(readonly) int32_t refnum;
|
||||
@property(strong) id obj; // NULL when representing a Go object.
|
||||
|
||||
// new GoSeqRef object to proxy a Go object. The refnum must be
|
||||
// provided from Go side.
|
||||
- (instancetype)initWithRefnum:(int32_t)refnum obj:(id)obj;
|
||||
|
||||
- (int32_t)incNum;
|
||||
|
||||
@end
|
||||
|
||||
@protocol goSeqRefInterface
|
||||
-(GoSeqRef*) _ref;
|
||||
@end
|
||||
|
||||
#endif
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
<?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>CFBundleExecutable</key>
|
||||
<string>GoLibs</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>GoLibs</string>
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>100.0</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.0.1758208789</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>0.0.1758208789</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
framework module "GoLibs" {
|
||||
header "ref.h"
|
||||
header "Crypto.objc.h"
|
||||
header "Armor.objc.h"
|
||||
header "Constants.objc.h"
|
||||
header "Models.objc.h"
|
||||
header "Subtle.objc.h"
|
||||
header "Helper.objc.h"
|
||||
header "Srp.objc.h"
|
||||
header "Universe.objc.h"
|
||||
header "GoLibs.h"
|
||||
|
||||
export *
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
Versions/Current/GoLibs
|
||||
|
|
@ -1 +0,0 @@
|
|||
Versions/Current/Headers
|
||||
|
|
@ -1 +0,0 @@
|
|||
Versions/Current/Modules
|
||||
|
|
@ -1 +0,0 @@
|
|||
Versions/Current/Resources
|
||||
Binary file not shown.
|
|
@ -1,39 +0,0 @@
|
|||
// Objective-C API for talking to github.com/ProtonMail/gopenpgp/v2/armor Go package.
|
||||
// gobind -lang=objc github.com/ProtonMail/gopenpgp/v2/armor
|
||||
//
|
||||
// File is generated by gobind. Do not edit.
|
||||
|
||||
#ifndef __Armor_H__
|
||||
#define __Armor_H__
|
||||
|
||||
@import Foundation;
|
||||
#include "ref.h"
|
||||
#include "Universe.objc.h"
|
||||
|
||||
#include "Constants.objc.h"
|
||||
|
||||
/**
|
||||
* ArmorKey armors input as a public key.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull ArmorArmorKey(NSData* _Nullable input, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* ArmorWithType armors input with the given armorType.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull ArmorArmorWithType(NSData* _Nullable input, NSString* _Nullable armorType, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* ArmorWithTypeAndCustomHeaders armors input with the given armorType and
|
||||
headers.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull ArmorArmorWithTypeAndCustomHeaders(NSData* _Nullable input, NSString* _Nullable armorType, NSString* _Nullable version, NSString* _Nullable comment, NSError* _Nullable* _Nullable error);
|
||||
|
||||
// skipped function ArmorWithTypeBuffered with unsupported parameter or return types
|
||||
|
||||
|
||||
/**
|
||||
* Unarmor unarmors an armored input into a byte array.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable ArmorUnarmor(NSString* _Nullable input, NSError* _Nullable* _Nullable error);
|
||||
|
||||
#endif
|
||||
|
|
@ -1,72 +0,0 @@
|
|||
// Objective-C API for talking to github.com/ProtonMail/gopenpgp/v2/constants Go package.
|
||||
// gobind -lang=objc github.com/ProtonMail/gopenpgp/v2/constants
|
||||
//
|
||||
// File is generated by gobind. Do not edit.
|
||||
|
||||
#ifndef __Constants_H__
|
||||
#define __Constants_H__
|
||||
|
||||
@import Foundation;
|
||||
#include "ref.h"
|
||||
#include "Universe.objc.h"
|
||||
|
||||
|
||||
/**
|
||||
* Cipher suite names.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsAES128;
|
||||
/**
|
||||
* Cipher suite names.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsAES192;
|
||||
/**
|
||||
* Cipher suite names.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsAES256;
|
||||
/**
|
||||
* Constants for armored data.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsArmorHeaderComment;
|
||||
/**
|
||||
* Constants for armored data.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsArmorHeaderVersion;
|
||||
/**
|
||||
* Cipher suite names.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsCAST5;
|
||||
FOUNDATION_EXPORT const int64_t ConstantsDefaultCompression;
|
||||
FOUNDATION_EXPORT const int64_t ConstantsDefaultCompressionLevel;
|
||||
/**
|
||||
* Constants for armored data.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsPGPMessageHeader;
|
||||
/**
|
||||
* Constants for armored data.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsPGPSignatureHeader;
|
||||
/**
|
||||
* Constants for armored data.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsPrivateKeyHeader;
|
||||
/**
|
||||
* Constants for armored data.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsPublicKeyHeader;
|
||||
FOUNDATION_EXPORT const long ConstantsSIGNATURE_BAD_CONTEXT;
|
||||
FOUNDATION_EXPORT const long ConstantsSIGNATURE_FAILED;
|
||||
FOUNDATION_EXPORT const long ConstantsSIGNATURE_NOT_SIGNED;
|
||||
FOUNDATION_EXPORT const long ConstantsSIGNATURE_NO_VERIFIER;
|
||||
FOUNDATION_EXPORT const long ConstantsSIGNATURE_OK;
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsSignatureContextName;
|
||||
/**
|
||||
* Cipher suite names.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsThreeDES;
|
||||
/**
|
||||
* Cipher suite names.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsTripleDES;
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const ConstantsVersion;
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,25 +0,0 @@
|
|||
|
||||
// Objective-C API for talking to the following Go packages
|
||||
//
|
||||
// github.com/ProtonMail/gopenpgp/v2/crypto
|
||||
// github.com/ProtonMail/gopenpgp/v2/armor
|
||||
// github.com/ProtonMail/gopenpgp/v2/constants
|
||||
// github.com/ProtonMail/gopenpgp/v2/models
|
||||
// github.com/ProtonMail/gopenpgp/v2/subtle
|
||||
// github.com/ProtonMail/gopenpgp/v2/helper
|
||||
// github.com/ProtonMail/go-srp
|
||||
//
|
||||
// File is generated by gomobile bind. Do not edit.
|
||||
#ifndef __GoLibs_FRAMEWORK_H__
|
||||
#define __GoLibs_FRAMEWORK_H__
|
||||
|
||||
#include "Crypto.objc.h"
|
||||
#include "Armor.objc.h"
|
||||
#include "Constants.objc.h"
|
||||
#include "Models.objc.h"
|
||||
#include "Subtle.objc.h"
|
||||
#include "Helper.objc.h"
|
||||
#include "Srp.objc.h"
|
||||
#include "Universe.objc.h"
|
||||
|
||||
#endif
|
||||
|
|
@ -1,481 +0,0 @@
|
|||
// Objective-C API for talking to github.com/ProtonMail/gopenpgp/v2/helper Go package.
|
||||
// gobind -lang=objc github.com/ProtonMail/gopenpgp/v2/helper
|
||||
//
|
||||
// File is generated by gobind. Do not edit.
|
||||
|
||||
#ifndef __Helper_H__
|
||||
#define __Helper_H__
|
||||
|
||||
@import Foundation;
|
||||
#include "ref.h"
|
||||
#include "Universe.objc.h"
|
||||
|
||||
#include "Crypto.objc.h"
|
||||
|
||||
@class HelperEncryptSignArmoredDetachedMobileResult;
|
||||
@class HelperEncryptSignBinaryDetachedMobileResult;
|
||||
@class HelperExplicitVerifyMessage;
|
||||
@class HelperGo2AndroidReader;
|
||||
@class HelperGo2IOSReader;
|
||||
@class HelperMobile2GoReader;
|
||||
@class HelperMobile2GoWriter;
|
||||
@class HelperMobile2GoWriterWithSHA256;
|
||||
@class HelperMobileReadResult;
|
||||
@protocol HelperMobileReader;
|
||||
@class HelperMobileReader;
|
||||
|
||||
@protocol HelperMobileReader <NSObject>
|
||||
- (HelperMobileReadResult* _Nullable)read:(long)max error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
@interface HelperEncryptSignArmoredDetachedMobileResult : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) NSString* _Nonnull ciphertextArmored;
|
||||
@property (nonatomic) NSString* _Nonnull encryptedSignatureArmored;
|
||||
@end
|
||||
|
||||
@interface HelperEncryptSignBinaryDetachedMobileResult : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) NSData* _Nullable encryptedData;
|
||||
@property (nonatomic) NSString* _Nonnull encryptedSignatureArmored;
|
||||
@end
|
||||
|
||||
@interface HelperExplicitVerifyMessage : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) CryptoPlainMessage* _Nullable message;
|
||||
@property (nonatomic) CryptoSignatureVerificationError* _Nullable signatureVerificationError;
|
||||
@end
|
||||
|
||||
/**
|
||||
* Go2AndroidReader is used to wrap a native golang Reader in the golang runtime,
|
||||
to be usable in the android app runtime (via gomobile).
|
||||
*/
|
||||
@interface HelperGo2AndroidReader : NSObject <goSeqRefInterface, CryptoReader> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
/**
|
||||
* NewGo2AndroidReader wraps a native golang Reader to be usable in the mobile app runtime (via gomobile).
|
||||
It doesn't follow the standard golang Reader behavior, and returns n = -1 on EOF.
|
||||
*/
|
||||
- (nullable instancetype)init:(id<CryptoReader> _Nullable)reader;
|
||||
/**
|
||||
* Read reads bytes into the provided buffer and returns the number of bytes read
|
||||
It doesn't follow the standard golang Reader behavior, and returns n = -1 on EOF.
|
||||
*/
|
||||
- (BOOL)read:(NSData* _Nullable)b n:(long* _Nullable)n error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
/**
|
||||
* Go2IOSReader is used to wrap a native golang Reader in the golang runtime,
|
||||
to be usable in the iOS app runtime (via gomobile) as a MobileReader.
|
||||
*/
|
||||
@interface HelperGo2IOSReader : NSObject <goSeqRefInterface, HelperMobileReader> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
/**
|
||||
* NewGo2IOSReader wraps a native golang Reader to be usable in the ios app runtime (via gomobile).
|
||||
*/
|
||||
- (nullable instancetype)init:(id<CryptoReader> _Nullable)reader;
|
||||
/**
|
||||
* Read reads at most <max> bytes from the wrapped Reader and returns the read data as a MobileReadResult.
|
||||
*/
|
||||
- (HelperMobileReadResult* _Nullable)read:(long)max error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
/**
|
||||
* Mobile2GoReader is used to wrap a MobileReader in the mobile app runtime,
|
||||
to be usable in the golang runtime (via gomobile) as a native Reader.
|
||||
*/
|
||||
@interface HelperMobile2GoReader : NSObject <goSeqRefInterface, CryptoReader> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
/**
|
||||
* NewMobile2GoReader wraps a MobileReader to be usable in the golang runtime (via gomobile).
|
||||
*/
|
||||
- (nullable instancetype)init:(id<HelperMobileReader> _Nullable)reader;
|
||||
/**
|
||||
* Read reads data from the wrapped MobileReader and copies the read data in the provided buffer.
|
||||
It also handles the conversion of EOF to an error.
|
||||
*/
|
||||
- (BOOL)read:(NSData* _Nullable)b n:(long* _Nullable)n error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
/**
|
||||
* Mobile2GoWriter is used to wrap a writer in the mobile app runtime,
|
||||
to be usable in the golang runtime (via gomobile).
|
||||
*/
|
||||
@interface HelperMobile2GoWriter : NSObject <goSeqRefInterface, CryptoWriter> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
/**
|
||||
* NewMobile2GoWriter wraps a writer to be usable in the golang runtime (via gomobile).
|
||||
*/
|
||||
- (nullable instancetype)init:(id<CryptoWriter> _Nullable)writer;
|
||||
/**
|
||||
* Write writes the data in the provided buffer in the wrapped writer.
|
||||
It clones the provided data to prevent errors with garbage collectors.
|
||||
*/
|
||||
- (BOOL)write:(NSData* _Nullable)b n:(long* _Nullable)n error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
/**
|
||||
* Mobile2GoWriterWithSHA256 is used to wrap a writer in the mobile app runtime,
|
||||
to be usable in the golang runtime (via gomobile).
|
||||
It also computes the SHA256 hash of the data being written on the fly.
|
||||
*/
|
||||
@interface HelperMobile2GoWriterWithSHA256 : NSObject <goSeqRefInterface, CryptoWriter> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
/**
|
||||
* NewMobile2GoWriterWithSHA256 wraps a writer to be usable in the golang runtime (via gomobile).
|
||||
The wrapper also computes the SHA256 hash of the data being written on the fly.
|
||||
*/
|
||||
- (nullable instancetype)init:(id<CryptoWriter> _Nullable)writer;
|
||||
/**
|
||||
* GetSHA256 returns the SHA256 hash of the data that's been written so far.
|
||||
*/
|
||||
- (NSData* _Nullable)getSHA256;
|
||||
/**
|
||||
* Write writes the data in the provided buffer in the wrapped writer.
|
||||
It clones the provided data to prevent errors with garbage collectors.
|
||||
It also computes the SHA256 hash of the data being written on the fly.
|
||||
*/
|
||||
- (BOOL)write:(NSData* _Nullable)b n:(long* _Nullable)n error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
/**
|
||||
* MobileReadResult is what needs to be returned by MobileReader.Read.
|
||||
The read data is passed as a return value rather than passed as an argument to the reader.
|
||||
This avoids problems introduced by gomobile that prevent the use of native golang readers.
|
||||
*/
|
||||
@interface HelperMobileReadResult : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
/**
|
||||
* NewMobileReadResult initialize a MobileReadResult with the correct values.
|
||||
It clones the data to avoid the garbage collector freeing the data too early.
|
||||
*/
|
||||
- (nullable instancetype)init:(long)n eof:(BOOL)eof data:(NSData* _Nullable)data;
|
||||
@property (nonatomic) long n;
|
||||
@property (nonatomic) BOOL isEOF;
|
||||
@property (nonatomic) NSData* _Nullable data;
|
||||
@end
|
||||
|
||||
FOUNDATION_EXPORT const int64_t HelperAES_BLOCK_SIZE;
|
||||
|
||||
/**
|
||||
* DecryptAttachment takes a keypacket and datpacket
|
||||
and returns a decrypted PlainMessage
|
||||
Specifically designed for attachments rather than text messages.
|
||||
*/
|
||||
FOUNDATION_EXPORT CryptoPlainMessage* _Nullable HelperDecryptAttachment(NSData* _Nullable keyPacket, NSData* _Nullable dataPacket, CryptoKeyRing* _Nullable keyRing, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptAttachmentWithKey decrypts a binary file
|
||||
Using a given armored private key and its passphrase.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable HelperDecryptAttachmentWithKey(NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSData* _Nullable keyPacket, NSData* _Nullable dataPacket, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptBinaryMessageArmored decrypts an armored PGP message given a private key
|
||||
and its passphrase.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable HelperDecryptBinaryMessageArmored(NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSString* _Nullable ciphertext, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptExplicitVerify decrypts a PGP message given a private keyring
|
||||
and a public keyring to verify the embedded signature. Returns the plain
|
||||
data and an error on signature verification failure.
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperExplicitVerifyMessage* _Nullable HelperDecryptExplicitVerify(CryptoPGPMessage* _Nullable pgpMessage, CryptoKeyRing* _Nullable privateKeyRing, CryptoKeyRing* _Nullable publicKeyRing, int64_t verifyTime, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptExplicitVerifyWithContext decrypts a PGP message given a private keyring
|
||||
and a public keyring to verify the embedded signature. Returns the plain
|
||||
data and an error on signature verification failure.
|
||||
The caller can provide a context that will be used to verify the signature.
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperExplicitVerifyMessage* _Nullable HelperDecryptExplicitVerifyWithContext(CryptoPGPMessage* _Nullable pgpMessage, CryptoKeyRing* _Nullable privateKeyRing, CryptoKeyRing* _Nullable publicKeyRing, int64_t verifyTime, CryptoVerificationContext* _Nullable verificationContext, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptMessageArmored decrypts an armored PGP message given a private key
|
||||
and its passphrase.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperDecryptMessageArmored(NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSString* _Nullable ciphertext, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptMessageWithPassword decrypts an armored message with a random token.
|
||||
The algorithm is derived from the armoring.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperDecryptMessageWithPassword(NSData* _Nullable password, NSString* _Nullable ciphertext, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptSessionKey decrypts a session key
|
||||
using a given armored private key
|
||||
and its passphrase.
|
||||
*/
|
||||
FOUNDATION_EXPORT CryptoSessionKey* _Nullable HelperDecryptSessionKey(NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSData* _Nullable encryptedSessionKey, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptSessionKeyExplicitVerify decrypts a PGP data packet given a session key
|
||||
and a public keyring to verify the embedded signature. Returns the plain data and
|
||||
an error on signature verification failure.
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperExplicitVerifyMessage* _Nullable HelperDecryptSessionKeyExplicitVerify(NSData* _Nullable dataPacket, CryptoSessionKey* _Nullable sessionKey, CryptoKeyRing* _Nullable publicKeyRing, int64_t verifyTime, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptSessionKeyExplicitVerifyWithContext decrypts a PGP data packet given a session key
|
||||
and a public keyring to verify the embedded signature. Returns the plain data and
|
||||
an error on signature verification failure.
|
||||
The caller can provide a context that will be used to verify the signature.
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperExplicitVerifyMessage* _Nullable HelperDecryptSessionKeyExplicitVerifyWithContext(NSData* _Nullable dataPacket, CryptoSessionKey* _Nullable sessionKey, CryptoKeyRing* _Nullable publicKeyRing, int64_t verifyTime, CryptoVerificationContext* _Nullable verificationContext, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptVerifyArmoredDetached decrypts an armored pgp message
|
||||
and verify a detached armored encrypted signature
|
||||
given a publicKey, and a privateKey with its passphrase.
|
||||
Returns the plain data or an error on
|
||||
signature verification failure.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable HelperDecryptVerifyArmoredDetached(NSString* _Nullable publicKey, NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSString* _Nullable ciphertextArmored, NSString* _Nullable encryptedSignatureArmored, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptVerifyAttachment decrypts and verifies an attachment split into the
|
||||
keyPacket, dataPacket and an armored (!) signature, given a publicKey, and a
|
||||
privateKey with its passphrase. Returns the plain data or an error on
|
||||
signature verification failure.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable HelperDecryptVerifyAttachment(NSString* _Nullable publicKey, NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSData* _Nullable keyPacket, NSData* _Nullable dataPacket, NSString* _Nullable armoredSignature, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptVerifyBinaryDetached decrypts binary encrypted data
|
||||
and verify a detached armored encrypted signature
|
||||
given a publicKey, and a privateKey with its passphrase.
|
||||
Returns the plain data or an error on
|
||||
signature verification failure.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable HelperDecryptVerifyBinaryDetached(NSString* _Nullable publicKey, NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSData* _Nullable encryptedData, NSString* _Nullable encryptedSignatureArmored, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DecryptVerifyMessageArmored decrypts an armored PGP message given a private
|
||||
key and its passphrase and verifies the embedded signature. Returns the
|
||||
plain data or an error on signature verification failure.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperDecryptVerifyMessageArmored(NSString* _Nullable publicKey, NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSString* _Nullable ciphertext, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptAttachment encrypts a file given a plainData and a fileName.
|
||||
Returns a PGPSplitMessage containing a session key packet and symmetrically
|
||||
encrypted data. Specifically designed for attachments rather than text
|
||||
messages.
|
||||
*/
|
||||
FOUNDATION_EXPORT CryptoPGPSplitMessage* _Nullable HelperEncryptAttachment(NSData* _Nullable plainData, NSString* _Nullable filename, CryptoKeyRing* _Nullable keyRing, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptAttachmentWithKey encrypts a binary file
|
||||
Using a given armored public key.
|
||||
*/
|
||||
FOUNDATION_EXPORT CryptoPGPSplitMessage* _Nullable HelperEncryptAttachmentWithKey(NSString* _Nullable publicKey, NSString* _Nullable filename, NSData* _Nullable plainData, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptBinaryMessageArmored generates an armored PGP message given a binary data and
|
||||
an armored public key.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperEncryptBinaryMessageArmored(NSString* _Nullable key, NSData* _Nullable data, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptMessageArmored generates an armored PGP message given a plaintext and
|
||||
an armored public key.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperEncryptMessageArmored(NSString* _Nullable key, NSString* _Nullable plaintext, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptMessageWithPassword encrypts a string with a passphrase using AES256.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperEncryptMessageWithPassword(NSData* _Nullable password, NSString* _Nullable plaintext, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptPGPMessageToAdditionalKey decrypts the session key of the input PGPSplitMessage with a private key in keyRing
|
||||
and encrypts it towards the additionalKeys by adding the additional key packets to the input PGPSplitMessage.
|
||||
If successful, new key packets are added to message.
|
||||
* messageToModify : The encrypted pgp message that should be modified
|
||||
* keyRing : The private keys to decrypt the session key in the messageToModify.
|
||||
* additionalKey : The public keys the message should be additionally encrypted to.
|
||||
*/
|
||||
FOUNDATION_EXPORT BOOL HelperEncryptPGPMessageToAdditionalKey(CryptoPGPSplitMessage* _Nullable messageToModify, CryptoKeyRing* _Nullable keyRing, CryptoKeyRing* _Nullable additionalKey, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptSessionKey encrypts a session key
|
||||
using a given armored public key.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable HelperEncryptSessionKey(NSString* _Nullable publicKey, CryptoSessionKey* _Nullable sessionKey, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptSignArmoredDetachedMobile wraps the encryptSignArmoredDetached method
|
||||
to have only one return argument for mobile.
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperEncryptSignArmoredDetachedMobileResult* _Nullable HelperEncryptSignArmoredDetachedMobile(NSString* _Nullable publicKey, NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSData* _Nullable plainData, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptSignBinaryDetachedMobile wraps the encryptSignBinaryDetached method
|
||||
to have only one return argument for mobile.
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperEncryptSignBinaryDetachedMobileResult* _Nullable HelperEncryptSignBinaryDetachedMobile(NSString* _Nullable publicKey, NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSData* _Nullable plainData, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptSignMessageArmored generates an armored signed PGP message given a
|
||||
plaintext and an armored public key a private key and its passphrase.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperEncryptSignMessageArmored(NSString* _Nullable publicKey, NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSString* _Nullable plaintext, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* FreeOSMemory can be used to explicitly
|
||||
call the garbage collector and
|
||||
return the unused memory to the OS.
|
||||
*/
|
||||
FOUNDATION_EXPORT void HelperFreeOSMemory(void);
|
||||
|
||||
/**
|
||||
* GenerateKey generates a key of the given keyType ("rsa" or "x25519"), encrypts it, and returns an armored string.
|
||||
If keyType is "rsa", bits is the RSA bitsize of the key.
|
||||
If keyType is "x25519" bits is unused.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperGenerateKey(NSString* _Nullable name, NSString* _Nullable email, NSData* _Nullable passphrase, NSString* _Nullable keyType, long bits, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* GetJsonSHA256Fingerprints returns the SHA256 fingeprints of key and subkeys,
|
||||
encoded in JSON, since gomobile can not handle arrays.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable HelperGetJsonSHA256Fingerprints(NSString* _Nullable publicKey, NSError* _Nullable* _Nullable error);
|
||||
|
||||
// skipped function GetSHA256Fingerprints with unsupported parameter or return types
|
||||
|
||||
|
||||
/**
|
||||
* NewGo2AndroidReader wraps a native golang Reader to be usable in the mobile app runtime (via gomobile).
|
||||
It doesn't follow the standard golang Reader behavior, and returns n = -1 on EOF.
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperGo2AndroidReader* _Nullable HelperNewGo2AndroidReader(id<CryptoReader> _Nullable reader);
|
||||
|
||||
/**
|
||||
* NewGo2IOSReader wraps a native golang Reader to be usable in the ios app runtime (via gomobile).
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperGo2IOSReader* _Nullable HelperNewGo2IOSReader(id<CryptoReader> _Nullable reader);
|
||||
|
||||
/**
|
||||
* NewMobile2GoReader wraps a MobileReader to be usable in the golang runtime (via gomobile).
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperMobile2GoReader* _Nullable HelperNewMobile2GoReader(id<HelperMobileReader> _Nullable reader);
|
||||
|
||||
/**
|
||||
* NewMobile2GoWriter wraps a writer to be usable in the golang runtime (via gomobile).
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperMobile2GoWriter* _Nullable HelperNewMobile2GoWriter(id<CryptoWriter> _Nullable writer);
|
||||
|
||||
/**
|
||||
* NewMobile2GoWriterWithSHA256 wraps a writer to be usable in the golang runtime (via gomobile).
|
||||
The wrapper also computes the SHA256 hash of the data being written on the fly.
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperMobile2GoWriterWithSHA256* _Nullable HelperNewMobile2GoWriterWithSHA256(id<CryptoWriter> _Nullable writer);
|
||||
|
||||
/**
|
||||
* NewMobileReadResult initialize a MobileReadResult with the correct values.
|
||||
It clones the data to avoid the garbage collector freeing the data too early.
|
||||
*/
|
||||
FOUNDATION_EXPORT HelperMobileReadResult* _Nullable HelperNewMobileReadResult(long n, BOOL eof, NSData* _Nullable data);
|
||||
|
||||
/**
|
||||
* QuickCheckDecrypt checks with high probability if the provided session key
|
||||
can decrypt the encrypted data packet given its 24 byte long prefix.
|
||||
The method only considers the first 24 bytes of the prefix slice (prefix[:24]).
|
||||
NOTE: Only works for SEIPDv1 packets with AES.
|
||||
*/
|
||||
FOUNDATION_EXPORT BOOL HelperQuickCheckDecrypt(CryptoSessionKey* _Nullable sessionKey, NSData* _Nullable prefix, BOOL* _Nullable ret0_, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* QuickCheckDecryptReader checks with high probability if the provided session key
|
||||
can decrypt a data packet given its 24 byte long prefix.
|
||||
The method reads up to but not exactly 24 bytes from the prefixReader.
|
||||
NOTE: Only works for SEIPDv1 packets with AES.
|
||||
*/
|
||||
FOUNDATION_EXPORT BOOL HelperQuickCheckDecryptReader(CryptoSessionKey* _Nullable sessionKey, id<CryptoReader> _Nullable prefixReader, BOOL* _Nullable ret0_, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* SignCleartextMessage signs text given a private keyring, canonicalizes and
|
||||
trims the newlines, and returns the PGP-compliant special armoring.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperSignCleartextMessage(CryptoKeyRing* _Nullable keyRing, NSString* _Nullable text, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* SignCleartextMessageArmored signs text given a private key and its
|
||||
passphrase, canonicalizes and trims the newlines, and returns the
|
||||
PGP-compliant special armoring.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperSignCleartextMessageArmored(NSString* _Nullable privateKey, NSData* _Nullable passphrase, NSString* _Nullable text, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* UpdatePrivateKeyPassphrase decrypts the given armored privateKey with oldPassphrase,
|
||||
re-encrypts it with newPassphrase, and returns the new armored key.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperUpdatePrivateKeyPassphrase(NSString* _Nullable privateKey, NSData* _Nullable oldPassphrase, NSData* _Nullable newPassphrase, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* VerifyCleartextMessage verifies PGP-compliant armored signed plain text
|
||||
given the public keyring and returns the text or err if the verification
|
||||
fails.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperVerifyCleartextMessage(CryptoKeyRing* _Nullable keyRing, NSString* _Nullable armored, int64_t verifyTime, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* VerifyCleartextMessageArmored verifies PGP-compliant armored signed plain
|
||||
text given the public key and returns the text or err if the verification
|
||||
fails.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull HelperVerifyCleartextMessageArmored(NSString* _Nullable publicKey, NSString* _Nullable armored, int64_t verifyTime, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* VerifySignatureExplicit calls the reader's VerifySignature()
|
||||
and tries to cast the returned error to a SignatureVerificationError.
|
||||
*/
|
||||
FOUNDATION_EXPORT CryptoSignatureVerificationError* _Nullable HelperVerifySignatureExplicit(CryptoPlainMessageReader* _Nullable reader, NSError* _Nullable* _Nullable error);
|
||||
|
||||
@class HelperMobileReader;
|
||||
|
||||
/**
|
||||
* MobileReader is the interface that readers in the mobile runtime must use and implement.
|
||||
This is a workaround to some of the gomobile limitations.
|
||||
*/
|
||||
@interface HelperMobileReader : NSObject <goSeqRefInterface, HelperMobileReader> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (HelperMobileReadResult* _Nullable)read:(long)max error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
#endif
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
// Objective-C API for talking to github.com/ProtonMail/gopenpgp/v2/models Go package.
|
||||
// gobind -lang=objc github.com/ProtonMail/gopenpgp/v2/models
|
||||
//
|
||||
// File is generated by gobind. Do not edit.
|
||||
|
||||
#ifndef __Models_H__
|
||||
#define __Models_H__
|
||||
|
||||
@import Foundation;
|
||||
#include "ref.h"
|
||||
#include "Universe.objc.h"
|
||||
|
||||
|
||||
@class ModelsEncryptedSigned;
|
||||
|
||||
/**
|
||||
* EncryptedSigned contains an encrypted message and signature.
|
||||
*/
|
||||
@interface ModelsEncryptedSigned : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) NSString* _Nonnull encrypted;
|
||||
@property (nonatomic) NSString* _Nonnull signature;
|
||||
@end
|
||||
|
||||
#endif
|
||||
|
|
@ -1,265 +0,0 @@
|
|||
// Objective-C API for talking to github.com/ProtonMail/go-srp Go package.
|
||||
// gobind -lang=objc github.com/ProtonMail/go-srp
|
||||
//
|
||||
// File is generated by gobind. Do not edit.
|
||||
|
||||
#ifndef __Srp_H__
|
||||
#define __Srp_H__
|
||||
|
||||
@import Foundation;
|
||||
#include "ref.h"
|
||||
#include "Universe.objc.h"
|
||||
|
||||
|
||||
@class SrpAuth;
|
||||
@class SrpProofs;
|
||||
@class SrpServer;
|
||||
|
||||
/**
|
||||
* Auth stores byte data for the calculation of SRP proofs.
|
||||
* Changed SrpAuto to Auth because the name will be used as srp.SrpAuto by other packages and as SrpSrpAuth on mobile
|
||||
* Also the data from the API called Auth. it could be match the meaning and reduce the confusion
|
||||
*/
|
||||
@interface SrpAuth : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
/**
|
||||
* NewAuth Creates new Auth from strings input. Salt and server ephemeral are in
|
||||
base64 format. Modulus is base64 with signature attached. The signature is
|
||||
verified against server key. The version controls password hash algorithm.
|
||||
|
||||
Parameters:
|
||||
- version int: The *x* component of the vector.
|
||||
- username string: The *y* component of the vector.
|
||||
- password []byte: The *z* component of the vector.
|
||||
- b64salt string: The std-base64 formatted salt
|
||||
Returns:
|
||||
- auth *Auth: the pre calculated auth information
|
||||
- err error: throw error
|
||||
Usage:
|
||||
|
||||
Warnings:
|
||||
- Be careful! Poos can hurt.
|
||||
*/
|
||||
- (nullable instancetype)init:(long)version username:(NSString* _Nullable)username password:(NSData* _Nullable)password b64salt:(NSString* _Nullable)b64salt signedModulus:(NSString* _Nullable)signedModulus serverEphemeral:(NSString* _Nullable)serverEphemeral;
|
||||
/**
|
||||
* NewAuthForVerifier Creates new Auth from strings input. Salt and server ephemeral are in
|
||||
base64 format. Modulus is base64 with signature attached. The signature is
|
||||
verified against server key. The version controls password hash algorithm.
|
||||
|
||||
Parameters:
|
||||
- version int: The *x* component of the vector.
|
||||
- username string: The *y* component of the vector.
|
||||
- password []byte: The *z* component of the vector.
|
||||
- salt string:
|
||||
Returns:
|
||||
- auth *Auth: the pre calculated auth information
|
||||
- err error: throw error
|
||||
Usage:
|
||||
|
||||
Warnings:
|
||||
- none.
|
||||
*/
|
||||
- (nullable instancetype)initForVerifier:(NSData* _Nullable)password signedModulus:(NSString* _Nullable)signedModulus rawSalt:(NSData* _Nullable)rawSalt;
|
||||
@property (nonatomic) NSData* _Nullable modulus;
|
||||
@property (nonatomic) NSData* _Nullable serverEphemeral;
|
||||
@property (nonatomic) NSData* _Nullable hashedPassword;
|
||||
@property (nonatomic) long version;
|
||||
/**
|
||||
* GenerateProofs calculates SPR proofs.
|
||||
*/
|
||||
- (SrpProofs* _Nullable)generateProofs:(long)bitLength error:(NSError* _Nullable* _Nullable)error;
|
||||
/**
|
||||
* GenerateVerifier verifier for update pwds and create accounts
|
||||
*/
|
||||
- (NSData* _Nullable)generateVerifier:(long)bitLength error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
/**
|
||||
* Proofs Srp Proofs object. Changed SrpProofs to Proofs because the name will be used as srp.SrpProofs by other packages and as SrpSrpProofs on mobile
|
||||
ClientProof []byte client proof
|
||||
ClientEphemeral []byte calculated from
|
||||
ExpectedServerProof []byte
|
||||
*/
|
||||
@interface SrpProofs : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (nonnull instancetype)init;
|
||||
@property (nonatomic) NSData* _Nullable clientProof;
|
||||
@property (nonatomic) NSData* _Nullable clientEphemeral;
|
||||
@property (nonatomic) NSData* _Nullable expectedServerProof;
|
||||
@end
|
||||
|
||||
/**
|
||||
* Server stores the internal state for the validation of SRP proofs.
|
||||
*/
|
||||
@interface SrpServer : NSObject <goSeqRefInterface> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
/**
|
||||
* NewServer creates a new server instance from the raw binary data.
|
||||
*/
|
||||
- (nullable instancetype)init:(NSData* _Nullable)modulusBytes verifier:(NSData* _Nullable)verifier bitLength:(long)bitLength;
|
||||
/**
|
||||
* NewServerFromSigned creates a new server instance from the signed modulus and the binary verifier.
|
||||
*/
|
||||
- (nullable instancetype)initFromSigned:(NSString* _Nullable)signedModulus verifier:(NSData* _Nullable)verifier bitLength:(long)bitLength;
|
||||
/**
|
||||
* NewServerWithSecret creates a new server instance without generating a random secret from the raw binary data.
|
||||
Use with caution as the secret should not be reused.
|
||||
*/
|
||||
- (nullable instancetype)initWithSecret:(NSData* _Nullable)modulusBytes verifier:(NSData* _Nullable)verifier secretBytes:(NSData* _Nullable)secretBytes bitLength:(long)bitLength;
|
||||
/**
|
||||
* GenerateChallenge is the first step for SRP exchange, and generates a valid challenge for the provided verifier.
|
||||
*/
|
||||
- (NSData* _Nullable)generateChallenge:(NSError* _Nullable* _Nullable)error;
|
||||
/**
|
||||
* GetSharedSession returns the shared secret as byte if the session has concluded in valid state.
|
||||
*/
|
||||
- (NSData* _Nullable)getSharedSession:(NSError* _Nullable* _Nullable)error;
|
||||
/**
|
||||
* IsCompleted returns true if the exchange has been concluded in valid state.
|
||||
*/
|
||||
- (BOOL)isCompleted;
|
||||
/**
|
||||
* VerifyProofs Verifies the client proof and - if valid - generates the shared secret and returnd the server proof.
|
||||
It concludes the exchange in valid state if successful.
|
||||
*/
|
||||
- (NSData* _Nullable)verifyProofs:(NSData* _Nullable)clientEphemeralBytes clientProofBytes:(NSData* _Nullable)clientProofBytes error:(NSError* _Nullable* _Nullable)error;
|
||||
@end
|
||||
|
||||
FOUNDATION_EXPORT NSString* _Nonnull const SrpVersion;
|
||||
|
||||
@interface Srp : NSObject
|
||||
/**
|
||||
* Implementation following the "context" package
|
||||
*/
|
||||
+ (NSError* _Nullable) deadlineExceeded;
|
||||
+ (void) setDeadlineExceeded:(NSError* _Nullable)v;
|
||||
|
||||
/**
|
||||
* ErrDataAfterModulus found extra data after decode the modulus
|
||||
*/
|
||||
+ (NSError* _Nullable) errDataAfterModulus;
|
||||
+ (void) setErrDataAfterModulus:(NSError* _Nullable)v;
|
||||
|
||||
/**
|
||||
* ErrInvalidSignature invalid modulus signature
|
||||
*/
|
||||
+ (NSError* _Nullable) errInvalidSignature;
|
||||
+ (void) setErrInvalidSignature:(NSError* _Nullable)v;
|
||||
|
||||
// skipped variable RandReader with unsupported type: io.Reader
|
||||
|
||||
@end
|
||||
|
||||
/**
|
||||
* Argon2PreimageChallenge computes the base64 solution for a given Argon2 base64
|
||||
challenge within deadlineUnixMilli milliseconds, if any was found. Deadlines are measured
|
||||
on the wall clock, not the monotonic clock, due to unreliability on mobile devices.
|
||||
deadlineUnixMilli = -1 means unlimited time.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull SrpArgon2PreimageChallenge(NSString* _Nullable b64Challenge, int64_t deadlineUnixMilli, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* ECDLPChallenge computes the base64 solution for a given ECDLP base64 challenge
|
||||
within deadlineUnixMilli milliseconds, if any was found. Deadlines are measured on the
|
||||
wall clock, not the monotonic clock, due to unreliability on mobile devices.
|
||||
deadlineUnixMilli = -1 means unlimited time.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull SrpECDLPChallenge(NSString* _Nullable b64Challenge, int64_t deadlineUnixMilli, NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT NSString* _Nonnull SrpGetModulusKey(void);
|
||||
|
||||
/**
|
||||
* HashPassword returns the hash of password argument. Based on version number
|
||||
following arguments are used in addition to password:
|
||||
* 0, 1, 2: userName and modulus
|
||||
* 3, 4: salt and modulus
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable SrpHashPassword(long authVersion, NSData* _Nullable password, NSString* _Nullable userName, NSData* _Nullable salt, NSData* _Nullable modulus, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* MailboxPassword get mailbox password hash
|
||||
|
||||
Parameters:
|
||||
- password []byte: a mailbox password
|
||||
- salt []byte: a salt is random 128 bits data
|
||||
Returns:
|
||||
- hashed []byte: a hashed password
|
||||
- err error: throw error
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable SrpMailboxPassword(NSData* _Nullable password, NSData* _Nullable salt, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* NewAuth Creates new Auth from strings input. Salt and server ephemeral are in
|
||||
base64 format. Modulus is base64 with signature attached. The signature is
|
||||
verified against server key. The version controls password hash algorithm.
|
||||
|
||||
Parameters:
|
||||
- version int: The *x* component of the vector.
|
||||
- username string: The *y* component of the vector.
|
||||
- password []byte: The *z* component of the vector.
|
||||
- b64salt string: The std-base64 formatted salt
|
||||
Returns:
|
||||
- auth *Auth: the pre calculated auth information
|
||||
- err error: throw error
|
||||
Usage:
|
||||
|
||||
Warnings:
|
||||
- Be careful! Poos can hurt.
|
||||
*/
|
||||
FOUNDATION_EXPORT SrpAuth* _Nullable SrpNewAuth(long version, NSString* _Nullable username, NSData* _Nullable password, NSString* _Nullable b64salt, NSString* _Nullable signedModulus, NSString* _Nullable serverEphemeral, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* NewAuthForVerifier Creates new Auth from strings input. Salt and server ephemeral are in
|
||||
base64 format. Modulus is base64 with signature attached. The signature is
|
||||
verified against server key. The version controls password hash algorithm.
|
||||
|
||||
Parameters:
|
||||
- version int: The *x* component of the vector.
|
||||
- username string: The *y* component of the vector.
|
||||
- password []byte: The *z* component of the vector.
|
||||
- salt string:
|
||||
Returns:
|
||||
- auth *Auth: the pre calculated auth information
|
||||
- err error: throw error
|
||||
Usage:
|
||||
|
||||
Warnings:
|
||||
- none.
|
||||
*/
|
||||
FOUNDATION_EXPORT SrpAuth* _Nullable SrpNewAuthForVerifier(NSData* _Nullable password, NSString* _Nullable signedModulus, NSData* _Nullable rawSalt, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* NewServer creates a new server instance from the raw binary data.
|
||||
*/
|
||||
FOUNDATION_EXPORT SrpServer* _Nullable SrpNewServer(NSData* _Nullable modulusBytes, NSData* _Nullable verifier, long bitLength, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* NewServerFromSigned creates a new server instance from the signed modulus and the binary verifier.
|
||||
*/
|
||||
FOUNDATION_EXPORT SrpServer* _Nullable SrpNewServerFromSigned(NSString* _Nullable signedModulus, NSData* _Nullable verifier, long bitLength, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* NewServerWithSecret creates a new server instance without generating a random secret from the raw binary data.
|
||||
Use with caution as the secret should not be reused.
|
||||
*/
|
||||
FOUNDATION_EXPORT SrpServer* _Nullable SrpNewServerWithSecret(NSData* _Nullable modulusBytes, NSData* _Nullable verifier, NSData* _Nullable secretBytes, long bitLength, NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT NSData* _Nullable SrpRandomBits(long bits, NSError* _Nullable* _Nullable error);
|
||||
|
||||
FOUNDATION_EXPORT NSData* _Nullable SrpRandomBytes(long byes, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* VersionNumber get current library version
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull SrpVersionNumber(void);
|
||||
|
||||
#endif
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
// Objective-C API for talking to github.com/ProtonMail/gopenpgp/v2/subtle Go package.
|
||||
// gobind -lang=objc github.com/ProtonMail/gopenpgp/v2/subtle
|
||||
//
|
||||
// File is generated by gobind. Do not edit.
|
||||
|
||||
#ifndef __Subtle_H__
|
||||
#define __Subtle_H__
|
||||
|
||||
@import Foundation;
|
||||
#include "ref.h"
|
||||
#include "Universe.objc.h"
|
||||
|
||||
|
||||
/**
|
||||
* DecryptWithoutIntegrity decrypts data encrypted with AES-CTR.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable SubtleDecryptWithoutIntegrity(NSData* _Nullable key, NSData* _Nullable input, NSData* _Nullable iv, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* DeriveKey derives a key from a password using scrypt. n should be set to the
|
||||
highest power of 2 you can derive within 100 milliseconds.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable SubtleDeriveKey(NSString* _Nullable password, NSData* _Nullable salt, long n, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* EncryptWithoutIntegrity encrypts data with AES-CTR. Note: this encryption
|
||||
mode is not secure when stored/sent on an untrusted medium.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable SubtleEncryptWithoutIntegrity(NSData* _Nullable key, NSData* _Nullable input, NSData* _Nullable iv, NSError* _Nullable* _Nullable error);
|
||||
|
||||
#endif
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
// Objective-C API for talking to Go package.
|
||||
// gobind -lang=objc
|
||||
//
|
||||
// File is generated by gobind. Do not edit.
|
||||
|
||||
#ifndef __Universe_H__
|
||||
#define __Universe_H__
|
||||
|
||||
@import Foundation;
|
||||
#include "ref.h"
|
||||
|
||||
@protocol Universeerror;
|
||||
@class Universeerror;
|
||||
|
||||
@protocol Universeerror <NSObject>
|
||||
- (NSString* _Nonnull)error;
|
||||
@end
|
||||
|
||||
@class Universeerror;
|
||||
|
||||
@interface Universeerror : NSError <goSeqRefInterface, Universeerror> {
|
||||
}
|
||||
@property(strong, readonly) _Nonnull id _ref;
|
||||
|
||||
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;
|
||||
- (NSString* _Nonnull)error;
|
||||
@end
|
||||
|
||||
#endif
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
// Copyright 2015 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
#ifndef __GO_REF_HDR__
|
||||
#define __GO_REF_HDR__
|
||||
|
||||
#include <Foundation/Foundation.h>
|
||||
|
||||
// GoSeqRef is an object tagged with an integer for passing back and
|
||||
// forth across the language boundary. A GoSeqRef may represent either
|
||||
// an instance of a Go object, or an Objective-C object passed to Go.
|
||||
// The explicit allocation of a GoSeqRef is used to pin a Go object
|
||||
// when it is passed to Objective-C. The Go seq package maintains a
|
||||
// reference to the Go object in a map keyed by the refnum along with
|
||||
// a reference count. When the reference count reaches zero, the Go
|
||||
// seq package will clear the corresponding entry in the map.
|
||||
@interface GoSeqRef : NSObject {
|
||||
}
|
||||
@property(readonly) int32_t refnum;
|
||||
@property(strong) id obj; // NULL when representing a Go object.
|
||||
|
||||
// new GoSeqRef object to proxy a Go object. The refnum must be
|
||||
// provided from Go side.
|
||||
- (instancetype)initWithRefnum:(int32_t)refnum obj:(id)obj;
|
||||
|
||||
- (int32_t)incNum;
|
||||
|
||||
@end
|
||||
|
||||
@protocol goSeqRefInterface
|
||||
-(GoSeqRef*) _ref;
|
||||
@end
|
||||
|
||||
#endif
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
framework module "GoLibs" {
|
||||
header "ref.h"
|
||||
header "Crypto.objc.h"
|
||||
header "Armor.objc.h"
|
||||
header "Constants.objc.h"
|
||||
header "Models.objc.h"
|
||||
header "Subtle.objc.h"
|
||||
header "Helper.objc.h"
|
||||
header "Srp.objc.h"
|
||||
header "Universe.objc.h"
|
||||
header "GoLibs.h"
|
||||
|
||||
export *
|
||||
}
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
<?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>CFBundleExecutable</key>
|
||||
<string>GoLibs</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>GoLibs</string>
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>100.0</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.0.1758208790</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>0.0.1758208790</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
@ -1 +0,0 @@
|
|||
A
|
||||
Binary file not shown.
|
|
@ -1,39 +0,0 @@
|
|||
// Objective-C API for talking to github.com/ProtonMail/gopenpgp/v2/armor Go package.
|
||||
// gobind -lang=objc github.com/ProtonMail/gopenpgp/v2/armor
|
||||
//
|
||||
// File is generated by gobind. Do not edit.
|
||||
|
||||
#ifndef __Armor_H__
|
||||
#define __Armor_H__
|
||||
|
||||
@import Foundation;
|
||||
#include "ref.h"
|
||||
#include "Universe.objc.h"
|
||||
|
||||
#include "Constants.objc.h"
|
||||
|
||||
/**
|
||||
* ArmorKey armors input as a public key.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull ArmorArmorKey(NSData* _Nullable input, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* ArmorWithType armors input with the given armorType.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull ArmorArmorWithType(NSData* _Nullable input, NSString* _Nullable armorType, NSError* _Nullable* _Nullable error);
|
||||
|
||||
/**
|
||||
* ArmorWithTypeAndCustomHeaders armors input with the given armorType and
|
||||
headers.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSString* _Nonnull ArmorArmorWithTypeAndCustomHeaders(NSData* _Nullable input, NSString* _Nullable armorType, NSString* _Nullable version, NSString* _Nullable comment, NSError* _Nullable* _Nullable error);
|
||||
|
||||
// skipped function ArmorWithTypeBuffered with unsupported parameter or return types
|
||||
|
||||
|
||||
/**
|
||||
* Unarmor unarmors an armored input into a byte array.
|
||||
*/
|
||||
FOUNDATION_EXPORT NSData* _Nullable ArmorUnarmor(NSString* _Nullable input, NSError* _Nullable* _Nullable error);
|
||||
|
||||
#endif
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue