mirror of
https://github.com/maxgoedjen/secretive.git
synced 2024-11-25 15:07:07 +00:00
Fix padding bug (#83)
This commit is contained in:
parent
f1e8e43f62
commit
ccbf92785d
@ -113,8 +113,17 @@ extension Agent {
|
|||||||
|
|
||||||
|
|
||||||
let rawLength = rawRepresentation.count/2
|
let rawLength = rawRepresentation.count/2
|
||||||
let r = rawRepresentation[0..<rawLength]
|
// Check if we need to pad with 0x00 to prevent certain
|
||||||
let s = rawRepresentation[rawLength...]
|
// ssh servers from thinking r or s is negative
|
||||||
|
let paddingRange: ClosedRange<UInt8> = 0x80...0xFF
|
||||||
|
var r = Data(rawRepresentation[0..<rawLength])
|
||||||
|
if paddingRange ~= r.first! {
|
||||||
|
r.insert(0x00, at: 0)
|
||||||
|
}
|
||||||
|
var s = Data(rawRepresentation[rawLength...])
|
||||||
|
if paddingRange ~= s.first! {
|
||||||
|
s.insert(0x00, at: 0)
|
||||||
|
}
|
||||||
|
|
||||||
var signatureChunk = Data()
|
var signatureChunk = Data()
|
||||||
signatureChunk.append(writer.lengthAndData(of: r))
|
signatureChunk.append(writer.lengthAndData(of: r))
|
||||||
|
Loading…
Reference in New Issue
Block a user