A code $C$ is a self-dual code if $C=C^{\perp}$ where $C^{\perp}$ is the dual of $C$.
Consider $C$ is a linear code of length $2n$ over finite field $GF(2^q)$ with generator matrix $G=[I_n\mid A]$ where $I_n$ is the identity matrix of order $n$ and $A$ is an $n\times n$ matrix. From $G$ we get the parity-check matrix of $C$ is $H=[ A^T\mid I_n]$.
My question: $C$ is a self-dual code if and only if $AA^T=I_n$.
My try: If $C$ be a self-dual then $G=H$ and because we have $GH^T=0$ then $GG^T=0$ which results that $I_n+AA^T=0$. Now if $AA^T=I_n$ then $GG^T=0$ which implies that $G=H$.
Is my proof correct?
Thanks for any suggestion.