Skip to content

Commit da38e8b

Browse files
Add sha256 signature support(with fallback to sha). (#7)
* Add sha256 signature support(with fallback to sha). * Update CHANGELOG(Add SHA256 signature support) --------- Co-authored-by: Gleb Ivanov <ivanov@panzerdog.com>
1 parent 5555dfd commit da38e8b

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## master
44

5+
- Support SHA256 signatures(with a fallback to SHA) in `ReceiptDecoder.Verifier`
56
- Require Elixir 1.13.
67

78
## v0.5.0

lib/receipt_decoder/verifier/verifier.ex

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,9 @@ defmodule ReceiptDecoder.Verifier do
118118
public_key = extract_public_key(itunes_cert)
119119

120120
with {:ok, payload} <- Extractor.extract_payload(receipt),
121-
true <- :public_key.verify(payload, :sha, signature, public_key) do
121+
true <-
122+
:public_key.verify(payload, :sha256, signature, public_key) or
123+
:public_key.verify(payload, :sha, signature, public_key) do
122124
:ok
123125
else
124126
false ->

0 commit comments

Comments
 (0)