Skip to content

Commit dc4426e

Browse files
authored
Merge pull request #1658 from AzureAD/release/1.19.0
Release/1.19.0
2 parents 2528083 + 71bf64f commit dc4426e

File tree

66 files changed

+4577
-226
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+4577
-226
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,4 @@ fastlane/test_output
7070
.DS_Store
7171

7272
#VSCode
73-
.vscode
73+
.vscode

IdentityCore/IdentityCore.xcodeproj/project.pbxproj

Lines changed: 178 additions & 0 deletions
Large diffs are not rendered by default.

IdentityCore/src/IdentityCore_Internal.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,22 @@
4848

4949
#define STRING_CASE(_CASE) case _CASE: return @#_CASE
5050
#define MSID_ENABLE_SSO_EXTENSION (!MSID_EXCLUDE_WEBKIT)
51+
52+
// Check if IdentityCore-Swift.h is available (generated at build time)
53+
// This macro evaluates to 1 if the Swift bridging header is available, 0 otherwise.
54+
// Use this macro to conditionally compile code that depends on Swift implementations.
55+
//
56+
// Note: JWE decryption functionality relies on Swift implementations. When
57+
// MSID_IDENTITYCORE_SWIFT_AVAILABLE evaluates to 0, JWE decryption will not
58+
// be available and operations that require JWE decryption are expected to fail.
59+
//
60+
// Example usage:
61+
// #if MSID_IDENTITYCORE_SWIFT_AVAILABLE
62+
// #import "IdentityCore-Swift.h"
63+
// // Use Swift classes here (including JWE decryption functionality)
64+
// #endif
65+
#if __has_include("IdentityCore-Swift.h")
66+
#define MSID_IDENTITYCORE_SWIFT_AVAILABLE 1
67+
#else
68+
#define MSID_IDENTITYCORE_SWIFT_AVAILABLE 0
69+
#endif
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
//
2+
// Copyright (c) Microsoft Corporation.
3+
// All rights reserved.
4+
//
5+
// This code is licensed under the MIT License.
6+
//
7+
// Permission is hereby granted, free of charge, to any person obtaining a copy
8+
// of this software and associated documentation files(the "Software"), to deal
9+
// in the Software without restriction, including without limitation the rights
10+
// to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
11+
// copies of the Software, and to permit persons to whom the Software is
12+
// furnished to do so, subject to the following conditions :
13+
//
14+
// The above copyright notice and this permission notice shall be included in
15+
// all copies or substantial portions of the Software.
16+
//
17+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23+
// THE SOFTWARE.
24+
25+
26+
import Foundation
27+
import CryptoKit
28+
29+
public class MSIDAesGcmDecryptor: NSObject {
30+
31+
@objc public func decryptWithAES256GCMHandler(message ciphertext: Data, iv nonce: Data, key keyData: Data, tag: Data, aad: Data) throws -> Data
32+
{
33+
let sealedBox = try AES.GCM.SealedBox(nonce: AES.GCM.Nonce(data: nonce), ciphertext: ciphertext, tag: tag)
34+
let key = SymmetricKey(data: keyData)
35+
return try AES.GCM.open(sealedBox, using: key, authenticating: aad)
36+
}
37+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
//
2+
// Copyright (c) Microsoft Corporation.
3+
// All rights reserved.
4+
//
5+
// This code is licensed under the MIT License.
6+
//
7+
// Permission is hereby granted, free of charge, to any person obtaining a copy
8+
// of this software and associated documentation files(the "Software"), to deal
9+
// in the Software without restriction, including without limitation the rights
10+
// to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
11+
// copies of the Software, and to permit persons to whom the Software is
12+
// furnished to do so, subject to the following conditions :
13+
//
14+
// The above copyright notice and this permission notice shall be included in
15+
// all copies or substantial portions of the Software.
16+
//
17+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23+
// THE SOFTWARE.
24+
25+
#import <Foundation/Foundation.h>
26+
#import "MSIDJweResponse.h"
27+
#import "MSIDRequestContext.h"
28+
#import "MSIDJWECrypto.h"
29+
#import "MSIDJsonSerializable.h"
30+
31+
typedef NSString *const MSIDJWECryptoKeyExchangeAlgorithm NS_TYPED_ENUM;
32+
typedef NSString *const MSIDJWECryptoKeyResponseEncryptionAlgorithm NS_TYPED_ENUM;
33+
34+
extern MSIDJWECryptoKeyExchangeAlgorithm const _Nonnull MSID_KEY_EXCHANGE_ALGORITHM_ECDH_ES;
35+
extern MSIDJWECryptoKeyResponseEncryptionAlgorithm const _Nonnull MSID_RESPONSE_ENCRYPTION_ALGORITHM_A256GCM;
36+
37+
NS_ASSUME_NONNULL_BEGIN
38+
@interface MSIDJweResponse (EcdhAesGcm)
39+
- (BOOL)IsJweResponseAlgorithmSupported:(NSError * _Nullable __autoreleasing * _Nullable)error;
40+
- (nullable NSDictionary *)decryptJweResponseWithPrivateStk:(SecKeyRef)privateStk
41+
jweCrypto:(MSIDJWECrypto *)jweCrypto
42+
error:(NSError * _Nullable __autoreleasing * _Nullable)error;
43+
@end
44+
NS_ASSUME_NONNULL_END

0 commit comments

Comments
 (0)