Transient Keyword: serialize, protecting third Information

Source: Internet
Author: User

The earliest technology to protect sensitive information is to declare the members that contain sensitive data as private and temporary ). variables modified with transietn are neither serialized nor serialized.
Save. such a statement does not cause sensitive data to appear in the stream or be restored through the serialization mechanism. moreover, read/write to Private Members cannot spread out of the class, so this method can protect the security of sensitive data.

Especially important classes should not be serialized at all. To ensure this, such classes cannot implement the serializable interface or the externalizable interface.

Usage of transient keywords

For some types of objects, their statuses are instantaneous. Such objects cannot save their statuses, such as a thread object or a fileinputstream object. For these fields, we must use
Transient keyword declaration, otherwise the compiler reports an error.

In addition, serialization may involve storing objects on disks or transmitting objects over the network,
At this time, security issues will occur, because the data is located outside the Java Runtime Environment,
It is not under control of the Java security mechanism.
It should be stored in permanent media, or simply not stored without processing. To ensure security, the transient keyword should be added before these fields.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.