Hello,
I am attempting to perform a Diffie Hellman Keyexchange with a server running on .Net.
However, the secretKey I am creating on the client side does not match with the secretKey on the server side, which I have for testing purposes.
I can import the server secret key as a SymetricKey, and if I use it to seal and open a box, it works. However, if I seal the box with my client key, I can not open it with the server shared key.
I create the SymetricKey like this:
let sharedHash = SHA256.self
let sharedInfo = serverPublicKey.rawRepresentation
let sharedLength = 32
let symetricKey = sharedSecret.x963DerivedSymmetricKey(
using: sharedHash,
sharedInfo: Data(),
outputByteCount: sharedLength)
The server key is created using .Net like this:
bob.KeyDerivationFunction = ECDiffieHellmanKeyDerivationFunction.Hash;
bob.HashAlgorithm = CngAlgorithm.Sha256;
bobPublicKey = bob.PublicKey.ToByteArray();
bobKey = bob.DeriveKeyMaterial(CngKey.Import(Alice.alicePublicKey, CngKeyBlobFormat.EccPublicBlob));
My assumption is the keys should be the same. Is that correct?
How can I find out what format the server key is in? The .Net documentation is not particularly precise on that
You can find a Playground of my code, and when you google for ECDiffieHellmanCng Class, you will find an example on what .Net does.
Any help is appreciated
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Created
For practice, I have implemented accessibility labels and announcement in a very simple test app (All SwiftUI, all iOS 18).
The app is not localized, default language is English.
When running this on a German phone, odd things happen in the localization. My accessibility labels are read with an accent, but when they contain a url, the "dots" are read as the German "Punkt" (with an English Accent).
When I am providing the same text as accessibility announcement, the same text (which is in English), is read with a German voice.
I am also providing a Button with an "arrow.clockwise" image, and VoiceOver reads this, in an English Voice with "Refresh, Button". This is great and was to be expected. However, when the button is disabled, VoiceOver reads "Refresh, grau dargestellt, Button", all in an English Voice.
Is this an error? Am I doing it wrong?
The video at the link should show the issue
https://share.icloud.com/photos/0757FJW2Q3fsA_cdhMX6ls46Q
Prime Objective
I am trying to have a scroll view with a fixed header, a fixed footer, and a WKWebView in between. Using JavaScript, the height of the webView is determined and set to be large enough to hold the entire content.
The Problem
When selecting text on the webView, the view does not scroll when the edges are reached (this works if the webView is shown without being embedded in a Scroll view, or if it is the last element)
What did I try?
I tried reading the scroll view, or adding a gesture recognizer, but all of that does not work because the selection is essentially a system task
Sourcecode
Sourcecode to demonstrate the issue can be found on GitHub
I am trying to record the requests and responses in a WKWebView, but instruments does not seem to record them. Is this to be expected?
The webView is set to inspectable, and I am using the HTTP Traffic instrument.
All the requests the app is doing are recorded, but neither the original request for the webView, nor subsequent traffic is recorded.
When I use Safari to inspect the webView, all I see is the last page (even when I start the inspector before the first request is made).
How can I see these requests?
I am seeing a weird behavior of the date formatter (Full code is below).
When run, this will give the following output:
57: 1 month, 3 weeks, 5 days
58: 1 month, 3 weeks, 6 days
59: 2 months
60: 2 months, 1 day
61: 2 months
62: 2 months, 1 day
63: 2 months, 2 days
So both 59 days and 61 days are 2 months, and both 60 and 62 days are 2 months and 1 day.
This of course is especially weird because this means, 2 months also comes after 2 months and a day.
Can someone explain to me what is going on here?
import Foundation
let formatter = DateComponentsFormatter()
formatter.unitsStyle = .full
let calendar = Calendar(identifier: .gregorian)
let today = calendar.date(from: DateComponents(year: 2025, month: 7, day: 26))!
for day in 57...63 {
let startDate = calendar.date(byAdding: .day, value: -day, to: today)!
let components = calendar.dateComponents([.day, .weekOfMonth, .month,. year], from: startDate, to: today)
let result = formatter.string(from: components)!
print ("\(String(format: "%3d", day)): \(result)")
}