Skip to content

Commit 0699bb1

Browse files
authored
Correctly generate signature. (#48)
1 parent 686c695 commit 0699bb1

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Sources/APNSwift/APNSwiftSigner.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,9 @@ public struct APNSwiftSigner {
7070
let lens = Int(BN_bn2bin(.make(optional: s), &sb))
7171

7272
var signatureBytes = ByteBufferAllocator().buffer(capacity: lenr + lens)
73-
signatureBytes.writeBytes(rb[0..<lenr])
74-
signatureBytes.writeBytes(sb[0..<lens])
73+
let allZeroes = Array(repeating: UInt8(0), count: 32)
74+
signatureBytes.writeBytes([allZeroes, rb].joined().suffix(32))
75+
signatureBytes.writeBytes([allZeroes, sb].joined().suffix(32))
7576
return signatureBytes
7677
}
7778
}

0 commit comments

Comments
 (0)