aboutsummaryrefslogtreecommitdiff
path: root/xcode
diff options
context:
space:
mode:
authormanuroe <manu@matrix.org>2018-10-23 15:47:46 +0200
committermanuroe <manu@matrix.org>2018-10-23 15:47:46 +0200
commit59076a6bda54c90a257eaf3dae32aad7ad178d31 (patch)
treea926197ac4f6179da3af54fe93b458a7d748041b /xcode
parent1aafac2874affafd8c8fc7e3022c6ca6d2d078d6 (diff)
OLMKit: Expose PK private key length
Diffstat (limited to 'xcode')
-rw-r--r--xcode/OLMKit/OLMPkDecryption.h7
-rw-r--r--xcode/OLMKit/OLMPkDecryption.m6
2 files changed, 12 insertions, 1 deletions
diff --git a/xcode/OLMKit/OLMPkDecryption.h b/xcode/OLMKit/OLMPkDecryption.h
index 8715a99..823dc78 100644
--- a/xcode/OLMKit/OLMPkDecryption.h
+++ b/xcode/OLMKit/OLMPkDecryption.h
@@ -59,6 +59,13 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (NSString *)decryptMessage:(OLMPkMessage*)message error:(NSError* _Nullable *)error;
+/**
+ Private key length.
+
+ @return the length in bytes.
+ */
++ (NSUInteger)privateKeyLength;
+
@end
NS_ASSUME_NONNULL_END
diff --git a/xcode/OLMKit/OLMPkDecryption.m b/xcode/OLMKit/OLMPkDecryption.m
index 75fe5f2..4af2c71 100644
--- a/xcode/OLMKit/OLMPkDecryption.m
+++ b/xcode/OLMKit/OLMPkDecryption.m
@@ -130,7 +130,7 @@
return privateKey;
}
--(NSString *)decryptMessage:(OLMPkMessage *)message error:(NSError *__autoreleasing _Nullable *)error {
+- (NSString *)decryptMessage:(OLMPkMessage *)message error:(NSError *__autoreleasing _Nullable *)error {
NSData *messageData = [message.ciphertext dataUsingEncoding:NSUTF8StringEncoding];
NSData *macData = [message.mac dataUsingEncoding:NSUTF8StringEncoding];
NSData *ephemeralKeyData = [message.ephemeralKey dataUsingEncoding:NSUTF8StringEncoding];
@@ -189,6 +189,10 @@
return plaintext;
}
++ (NSUInteger)privateKeyLength {
+ return olm_pk_private_key_length();
+}
+
#pragma mark OLMSerializable
/** Initializes from encrypted serialized data. Will throw error if invalid key or invalid base64. */