Is there a way to archive posts on Stack Exchange?
I want them to be private.
No, there's no such thing or concept in Stack Exchange.
Once you post question or answer it's public to everyone. You can delete it under certain conditions, but even then any user with 10k reputation and any moderator will still be able to see that post.
In extreme cases, moderator can "hard delete" a revision, aka redact it, see What should I do if a user posts sensitive information as part of a question or answer? for details.
Comments are bit different, you can always delete any comment you ever made without any conditions, and only moderators can see deleted comments.
No, you cannot make them private. By posting content, you have agreed to the Terms of Service, which state
You agree that any and all content, including without limitation any and all text, graphics, logos, tools, photographs, images, illustrations, software or source code, audio and video, animations, and product feedback (collectively, “Content”) that you provide to the public Network (collectively, “Subscriber Content”), is perpetually and irrevocably licensed to Stack Overflow on a worldwide, royalty-free, non-exclusive basis pursuant to Creative Commons licensing terms (CC-BY-SA), and you grant Stack Overflow the perpetual and irrevocable right and license to access, use, process, copy, distribute, export, display and to commercially exploit such Subscriber Content, even if such Subscriber Content has been contributed and subsequently removed by you as reasonably necessary to, for example (without limitation):
- Provide, maintain, and update the public Network
- Process lawful requests from law enforcement agencies and government agencies
- Prevent and address security incidents and data security features, support features, and to provide technical assistance as it may be required
- Aggregate data to provide product optimization
This means that you cannot revoke permission for Stack Overflow to publish, distribute, store and use such content and to allow others to have derivative rights to publish, distribute, store and use such content. The CC-BY-SA Creative Commons license terms are explained in further detail by Creative Commons, but you should be aware that all Public Content you contribute is available for public copy and redistribution, and all such Public Content must have appropriate attribution.
If you accidentally spoiled credentials or other privacy-sensitive information, you can flag the post for moderator attention to have that information redacted, as described here.
Archiving (downloading your content for offline use) is of course permitted, one of the options is to download everything via SEDE, as shown in the following question: Dump of my own Stack Exchange content.