From 719eb543a8d08c4f536ea7933ffb3af0a8553e87 Mon Sep 17 00:00:00 2001 From: Chris Ballinger Date: Fri, 8 Apr 2016 17:24:41 -0700 Subject: Xcode, podspec, wrapper --- xcode/OLMKit/OLMUtility.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 xcode/OLMKit/OLMUtility.h (limited to 'xcode/OLMKit/OLMUtility.h') diff --git a/xcode/OLMKit/OLMUtility.h b/xcode/OLMKit/OLMUtility.h new file mode 100644 index 0000000..0de9725 --- /dev/null +++ b/xcode/OLMKit/OLMUtility.h @@ -0,0 +1,15 @@ +// +// OLMUtility.h +// olm +// +// Created by Chris Ballinger on 4/8/16. +// +// + +#import + +@interface OLMUtility : NSObject + ++ (NSData*) randomBytesOfLength:(NSUInteger)length; + +@end -- cgit v1.2.3 From f505113fb7a6d61015ad8050b3fb4e26df029150 Mon Sep 17 00:00:00 2001 From: Chris Ballinger Date: Sat, 9 Apr 2016 14:00:30 -0700 Subject: Initial test passing --- xcode/OLMKit/OLMUtility.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'xcode/OLMKit/OLMUtility.h') diff --git a/xcode/OLMKit/OLMUtility.h b/xcode/OLMKit/OLMUtility.h index 0de9725..8acbf40 100644 --- a/xcode/OLMKit/OLMUtility.h +++ b/xcode/OLMKit/OLMUtility.h @@ -10,6 +10,6 @@ @interface OLMUtility : NSObject -+ (NSData*) randomBytesOfLength:(NSUInteger)length; ++ (NSMutableData*) randomBytesOfLength:(NSUInteger)length; @end -- cgit v1.2.3 From 45ecaaedd1eab582965f2cca8d2a04e6c906491b Mon Sep 17 00:00:00 2001 From: manuroe Date: Wed, 28 Sep 2016 16:07:39 +0200 Subject: OLMKit: Add [OLMUtility ed25519Verify] --- xcode/OLMKit/OLMUtility.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'xcode/OLMKit/OLMUtility.h') diff --git a/xcode/OLMKit/OLMUtility.h b/xcode/OLMKit/OLMUtility.h index 8acbf40..eca9d3a 100644 --- a/xcode/OLMKit/OLMUtility.h +++ b/xcode/OLMKit/OLMUtility.h @@ -10,6 +10,20 @@ @interface OLMUtility : NSObject +/** + Verify an ed25519 signature. + + @param key the ed25519 key. + @param message the message which was signed. + @param signature the base64-encoded signature to be checked. + @param the result error if there is a problem with the verification. + If the key was too small then the message will be "OLM.INVALID_BASE64". + If the signature was invalid then the message will be "OLM.BAD_MESSAGE_MAC". + + @return YES if valid. + */ +- (BOOL)ed25519Verify:(NSString*)key message:(NSString*)message signature:(NSString*)signature error:(NSError**)error; + + (NSMutableData*) randomBytesOfLength:(NSUInteger)length; @end -- cgit v1.2.3 From 4a2aac5800dacb3de935f6594e4d213087cb7cb5 Mon Sep 17 00:00:00 2001 From: manuroe Date: Fri, 14 Oct 2016 15:57:12 +0200 Subject: OLMKit: Add signature tests --- xcode/OLMKit/OLMUtility.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'xcode/OLMKit/OLMUtility.h') diff --git a/xcode/OLMKit/OLMUtility.h b/xcode/OLMKit/OLMUtility.h index eca9d3a..a8a3743 100644 --- a/xcode/OLMKit/OLMUtility.h +++ b/xcode/OLMKit/OLMUtility.h @@ -13,16 +13,16 @@ /** Verify an ed25519 signature. + @param signature the base64-encoded signature to be checked. @param key the ed25519 key. @param message the message which was signed. - @param signature the base64-encoded signature to be checked. @param the result error if there is a problem with the verification. If the key was too small then the message will be "OLM.INVALID_BASE64". If the signature was invalid then the message will be "OLM.BAD_MESSAGE_MAC". @return YES if valid. */ -- (BOOL)ed25519Verify:(NSString*)key message:(NSString*)message signature:(NSString*)signature error:(NSError**)error; +- (BOOL)verifyEd25519Signature:(NSString*)signature key:(NSString*)key message:(NSData*)message error:(NSError**)error; + (NSMutableData*) randomBytesOfLength:(NSUInteger)length; -- cgit v1.2.3 From a9be04fa4b53e7012406a9a89596e94b65947c20 Mon Sep 17 00:00:00 2001 From: manuroe Date: Mon, 17 Oct 2016 15:47:52 +0200 Subject: OLMKit: Add [OLMUtility sha256:] --- xcode/OLMKit/OLMUtility.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'xcode/OLMKit/OLMUtility.h') diff --git a/xcode/OLMKit/OLMUtility.h b/xcode/OLMKit/OLMUtility.h index a8a3743..1952b8e 100644 --- a/xcode/OLMKit/OLMUtility.h +++ b/xcode/OLMKit/OLMUtility.h @@ -10,6 +10,14 @@ @interface OLMUtility : NSObject +/** + Calculate the SHA-256 hash of the input and encodes it as base64. + + @param message the message to hash. + @return the base64-encoded hash value. + */ +- (NSString*)sha256:(NSData*)message; + /** Verify an ed25519 signature. -- cgit v1.2.3 From cf66af6f2e7c69a3e0712317f8473ab09711d426 Mon Sep 17 00:00:00 2001 From: manuroe Date: Mon, 14 Nov 2016 16:54:51 +0100 Subject: OLMKit: Replaced NSAsserts by NSErrors --- xcode/OLMKit/OLMUtility.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'xcode/OLMKit/OLMUtility.h') diff --git a/xcode/OLMKit/OLMUtility.h b/xcode/OLMKit/OLMUtility.h index 1952b8e..c316829 100644 --- a/xcode/OLMKit/OLMUtility.h +++ b/xcode/OLMKit/OLMUtility.h @@ -8,6 +8,8 @@ #import +FOUNDATION_EXPORT NSString *const OLMErrorDomain; + @interface OLMUtility : NSObject /** -- cgit v1.2.3 From 29de7825c9607955d061c5fe75c7f29d78dfaec5 Mon Sep 17 00:00:00 2001 From: manuroe Date: Thu, 17 Nov 2016 15:50:23 +0100 Subject: OLMKit: Update Copyrights --- xcode/OLMKit/OLMUtility.h | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'xcode/OLMKit/OLMUtility.h') diff --git a/xcode/OLMKit/OLMUtility.h b/xcode/OLMKit/OLMUtility.h index c316829..22e9724 100644 --- a/xcode/OLMKit/OLMUtility.h +++ b/xcode/OLMKit/OLMUtility.h @@ -1,10 +1,20 @@ -// -// OLMUtility.h -// olm -// -// Created by Chris Ballinger on 4/8/16. -// -// +/* + Copyright 2016 Chris Ballinger + Copyright 2016 OpenMarket Ltd + Copyright 2016 Vector Creations Ltd + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ #import -- cgit v1.2.3