It is said that 〜 は、that の後ろの主語を文の主語にして、主語+is said to+動詞 の形に書きかえられます。
It is said that 〜
be said to 〜
It is said that he is rich.
He is said to be rich.
It is said that he was rich.
He is said to have been rich.
This library is said to be the oldest building in town.
The first librarian is believed to have been a teacher.
この図書館は町でいちばん古い建物だと言われています。
最初の図書館員は先生だったと信じられています。
「言われている」時より前のことは、to have+過去分詞 で表します。
解答
The castle is said to be 400 years old.
She is believed to have written the letter.(書いたのは前の時)