Skip to content

Commit

Permalink
[Security] Add support for Xcode 15 (#19021)
Browse files Browse the repository at this point in the history
Co-authored-by: GitHub Actions Autoformatter <github-actions-autoformatter@xamarin.com>
  • Loading branch information
haritha-mohan and GitHub Actions Autoformatter authored Sep 14, 2023
1 parent bf8593d commit 3e2ef13
Show file tree
Hide file tree
Showing 12 changed files with 94 additions and 99 deletions.
7 changes: 7 additions & 0 deletions src/Security/Authorization.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,13 @@ public enum AuthorizationFlags : int {
PartialRights = 1 << 2,
DestroyRights = 1 << 3,
PreAuthorize = 1 << 4,
#if NET
[SupportedOSPlatform ("maccatalyst17.0")]
[SupportedOSPlatform ("macos14.0")]
#else
[Mac(14, 0), MacCatalyst(17, 0)]
#endif
SkipInternalAuth = 1 << 9,
NoData = 1 << 20,
}

Expand Down
25 changes: 25 additions & 0 deletions src/Security/Items.cs
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,11 @@ public static SecStatusCode Update (SecRecord query, SecRecord newAttributes)

}
#if MONOMAC
#if NET
[ObsoletedOSPlatform ("macos10.10")]
#else
[Deprecated (PlatformName.MacOSX, 10,10)]
#endif
[DllImport (Constants.SecurityLibrary)]
extern static SecStatusCode SecKeychainAddGenericPassword (
IntPtr keychain,
Expand All @@ -311,6 +316,11 @@ extern static SecStatusCode SecKeychainAddGenericPassword (
byte[] passwordData,
IntPtr itemRef);

#if NET
[ObsoletedOSPlatform ("macos10.10")]
#else
[Deprecated (PlatformName.MacOSX, 10,10)]
#endif
[DllImport (Constants.SecurityLibrary)]
extern static SecStatusCode SecKeychainFindGenericPassword (
IntPtr keychainOrArray,
Expand All @@ -322,6 +332,11 @@ extern static SecStatusCode SecKeychainFindGenericPassword (
out IntPtr passwordData,
IntPtr itemRef);

#if NET
[ObsoletedOSPlatform ("macos10.10")]
#else
[Deprecated (PlatformName.MacOSX, 10,10)]
#endif
[DllImport (Constants.SecurityLibrary)]
extern static SecStatusCode SecKeychainAddInternetPassword (
IntPtr keychain,
Expand All @@ -340,6 +355,11 @@ extern static SecStatusCode SecKeychainAddInternetPassword (
byte[] passwordData,
IntPtr itemRef);

#if NET
[ObsoletedOSPlatform ("macos10.10")]
#else
[Deprecated (PlatformName.MacOSX, 10,10)]
#endif
[DllImport (Constants.SecurityLibrary)]
extern static SecStatusCode SecKeychainFindInternetPassword (
IntPtr keychain,
Expand All @@ -358,6 +378,11 @@ extern static SecStatusCode SecKeychainFindInternetPassword (
out IntPtr passwordData,
IntPtr itemRef);

#if NET
[ObsoletedOSPlatform ("macos10.10")]
#else
[Deprecated (PlatformName.MacOSX, 10,10)]
#endif
[DllImport (Constants.SecurityLibrary)]
extern static SecStatusCode SecKeychainItemFreeContent (IntPtr attrList, IntPtr data);

Expand Down
48 changes: 48 additions & 0 deletions src/security.cs
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,10 @@ interface SecItem {
[MacCatalyst (13, 1)]
[Field ("kSecUseAuthenticationContext")]
IntPtr UseAuthenticationContext { get; }

[TV (17, 0), NoWatch, NoMacCatalyst, NoMac, NoiOS]
[Field ("kSecUseUserIndependentKeychain")]
IntPtr UseUserIndependentKeychain { get; }
}

[NoiOS]
Expand Down Expand Up @@ -1035,6 +1039,50 @@ enum SecKeyAlgorithm {
[MacCatalyst (13, 1)]
[Field ("kSecKeyAlgorithmECIESEncryptionCofactorVariableIVX963SHA512AESGCM")]
EciesEncryptionCofactorVariableIvx963Sha512AesGcm,

[Watch (10, 0), TV (17, 0), Mac (14, 0), iOS (17, 0), MacCatalyst (17, 0)]
[Field ("kSecKeyAlgorithmECDSASignatureDigestRFC4754")]
EcdsaSignatureDigestRfc4754,

[Watch (10, 0), TV (17, 0), Mac (14, 0), iOS (17, 0), MacCatalyst (17, 0)]
[Field ("kSecKeyAlgorithmECDSASignatureDigestRFC4754SHA1")]
EcdsaSignatureDigestRfc4754Sha1,

[Watch (10, 0), TV (17, 0), Mac (14, 0), iOS (17, 0), MacCatalyst (17, 0)]
[Field ("kSecKeyAlgorithmECDSASignatureDigestRFC4754SHA224")]
EcdsaSignatureDigestRfc4754Sha224,

[Watch (10, 0), TV (17, 0), Mac (14, 0), iOS (17, 0), MacCatalyst (17, 0)]
[Field ("kSecKeyAlgorithmECDSASignatureDigestRFC4754SHA256")]
EcdsaSignatureDigestRfc4754Sha256,

[Watch (10, 0), TV (17, 0), Mac (14, 0), iOS (17, 0), MacCatalyst (17, 0)]
[Field ("kSecKeyAlgorithmECDSASignatureDigestRFC4754SHA384")]
EcdsaSignatureDigestRfc4754Sha384,

[Watch (10, 0), TV (17, 0), Mac (14, 0), iOS (17, 0), MacCatalyst (17, 0)]
[Field ("kSecKeyAlgorithmECDSASignatureDigestRFC4754SHA512")]
EcdsaSignatureDigestRfc4754Sha512,

[Watch (10, 0), TV (17, 0), Mac (14, 0), iOS (17, 0), MacCatalyst (17, 0)]
[Field ("kSecKeyAlgorithmECDSASignatureMessageRFC4754SHA1")]
EcdsaSignatureMessageRfc4754Sha1,

[Watch (10, 0), TV (17, 0), Mac (14, 0), iOS (17, 0), MacCatalyst (17, 0)]
[Field ("kSecKeyAlgorithmECDSASignatureMessageRFC4754SHA224")]
EcdsaSignatureMessageRfc4754Sha224,

[Watch (10, 0), TV (17, 0), Mac (14, 0), iOS (17, 0), MacCatalyst (17, 0)]
[Field ("kSecKeyAlgorithmECDSASignatureMessageRFC4754SHA256")]
EcdsaSignatureMessageRfc4754Sha256,

[Watch (10, 0), TV (17, 0), Mac (14, 0), iOS (17, 0), MacCatalyst (17, 0)]
[Field ("kSecKeyAlgorithmECDSASignatureMessageRFC4754SHA384")]
EcdsaSignatureMessageRfc4754Sha384,

[Watch (10, 0), TV (17, 0), Mac (14, 0), iOS (17, 0), MacCatalyst (17, 0)]
[Field ("kSecKeyAlgorithmECDSASignatureMessageRFC4754SHA512")]
EcdsaSignatureMessageRfc4754Sha512,
}

[MacCatalyst (13, 1)]
Expand Down
11 changes: 0 additions & 11 deletions tests/xtro-sharpie/api-annotations-dotnet/iOS-Security.todo

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -490,3 +490,10 @@

## xcode 12.2 / we do not have bindings for XPC
!missing-pinvoke! SecCodeCreateWithXPCMessage is not bound

## xcode15
!missing-field! kSecCodeInfoDefaultDesignatedLightweightCodeRequirement not bound
!missing-pinvoke! SecCodeValidateFileResource is not bound
!missing-field! kSecCFErrorResourceRecursive not bound
!missing-field! kSecCodeInfoStapledNotarizationTicket not bound

21 changes: 0 additions & 21 deletions tests/xtro-sharpie/api-annotations-dotnet/macOS-Security.todo

This file was deleted.

12 changes: 0 additions & 12 deletions tests/xtro-sharpie/api-annotations-dotnet/tvOS-Security.todo

This file was deleted.

11 changes: 0 additions & 11 deletions tests/xtro-sharpie/iOS-Security.todo

This file was deleted.

7 changes: 7 additions & 0 deletions tests/xtro-sharpie/macOS-Security.ignore
Original file line number Diff line number Diff line change
Expand Up @@ -492,3 +492,10 @@
!missing-pinvoke! SecCodeCreateWithXPCMessage is not bound
!extra-enum-value! Managed value -2147483648 for SecAccessControlCreateFlags.ApplicationPassword not found in native headers
!missing-enum-value! SecAccessControlCreateFlags native value kSecAccessControlApplicationPassword = 2147483648 not bound

## xcode15
!missing-field! kSecCodeInfoDefaultDesignatedLightweightCodeRequirement not bound
!missing-pinvoke! SecCodeValidateFileResource is not bound
!missing-field! kSecCFErrorResourceRecursive not bound
!missing-field! kSecCodeInfoStapledNotarizationTicket not bound

21 changes: 0 additions & 21 deletions tests/xtro-sharpie/macOS-Security.todo

This file was deleted.

12 changes: 0 additions & 12 deletions tests/xtro-sharpie/tvOS-Security.todo

This file was deleted.

11 changes: 0 additions & 11 deletions tests/xtro-sharpie/watchOS-Security.todo

This file was deleted.

6 comments on commit 3e2ef13

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

Please sign in to comment.