According to the one law in this link (German law §90 StGB), offending the president of Germany carries a penalty of anywhere from 3 months to 5 years prison. This can even apply in private matters.
Speaking of Austria, blasphemy laws still apply there and were upheld by an EU court when challenged two years ago [1].
[1] https://humanism.org.uk/2018/10/29/european-court-of-human-r...