tunnelkit/TunnelKit/Sources/Core/TLSBox.h

39 lines
1.1 KiB
C
Raw Normal View History

2018-08-23 08:19:25 +00:00
//
// TLSBox.h
// TunnelKit
2018-08-23 08:19:25 +00:00
//
// Created by Davide De Rosa on 2/3/17.
// Copyright © 2018 London Trust Media. All rights reserved.
//
#import <Foundation/Foundation.h>
extern const NSInteger TLSBoxMaxBufferLength;
extern NSString *const TLSBoxPeerVerificationErrorNotification;
//
// cipher text is safe within NSData
// plain text might be sensitive and must avoid NSData
//
// WARNING: not thread-safe!
//
@interface TLSBox : NSObject
- (nonnull instancetype)initWithCAPath:(nullable NSString *)caPath;
2018-08-23 08:19:25 +00:00
- (BOOL)startWithError:(NSError **)error;
2018-08-23 08:19:25 +00:00
- (NSData *)pullCipherTextWithError:(NSError **)error;
// WARNING: text must be able to hold plain text output
- (BOOL)pullRawPlainText:(uint8_t *)text length:(NSInteger *)length error:(NSError **)error;
- (BOOL)putCipherText:(NSData *)text error:(NSError **)error;
- (BOOL)putRawCipherText:(const uint8_t *)text length:(NSInteger)length error:(NSError **)error;
- (BOOL)putPlainText:(NSString *)text error:(NSError **)error;
- (BOOL)putRawPlainText:(const uint8_t *)text length:(NSInteger)length error:(NSError **)error;
- (BOOL)isConnected;
@end