-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
Apologies if these are already known to you, but I didn't see anything in the docs or comments about this.
In (
SwiftTLS/SwiftTLS/Sources/TLS/math.swift
Line 15 in f5010aa
| public func modular_pow<T : BinaryInteger>(_ base : T, _ exponent : T, _ mod : T) -> T |
In ECDSA signature https://github.com/nsc/SwiftTLS/blob/master/SwiftTLS/Sources/Crypto/ECDSA.swift#L72 you must invert the k nonce modulo the group order during ECDSA signature. This is done using extended Euclidean algorithm (
SwiftTLS/SwiftTLS/Sources/TLS/math.swift
Line 73 in f5010aa
| public func modular_inverse<T : BinaryInteger>(_ x : T, _ y : T, mod : T) -> T |
Decoding for PKCS1v1.5 ciphertexts exits early if the first bytes of padding are incorrect.
| if paddedData[0] != 0 || paddedData[1] != 2 { |
Similarly, when the PKCS1v1.5 ciphertext is decrypted, the server returns an error immediately
| preMasterSecret = try rsa.decrypt(encryptedPreMasterSecret) |
HTH
Metadata
Metadata
Assignees
Labels
No labels