We currently have 8 questions, one of them closed about .Net's SecureString. I find this topic interesting and would like to follow these questions, but we don't have a tag for it. In theory, every SecureString question could (should?) be tagged with + + (maybe) . Following all of these tags wouldn't really allow me to easily spot out these questions though as they individually cover a much larger space.

I was going to create , but it is very specific to .Net. We, as a rule, try to create language agnostic tags on this site. Is there a language agnostic concept for what SecureString accomplishes?

For those who may not know what SecureString is, think of it as a way to securely pass around data, like passwords, in your program.

From MSDN:

An instance of the System.String class is both immutable and, when no longer needed, cannot be programmatically scheduled for garbage collection; that is, the instance is read-only after it is created and it is not possible to predict when the instance will be deleted from computer memory. Consequently, if a String object contains sensitive information such as a password, credit card number, or personal data, there is a risk the information could be revealed after it is used because your application cannot delete the data from computer memory.

A SecureString object is similar to a String object in that it has a text value. However, the value of a SecureString object may use a protection mechanism, such as encryption, provided by the underlying operating system, can be modified until your application marks it as read-only, and can be deleted from computer memory by either your application or the .NET Framework garbage collector.

  • \$\begingroup\$ ProtectedString could be a good tag because it could also cover the GuardedString from java. \$\endgroup\$
    – Heslacher
    Oct 17, 2015 at 12:48
  • \$\begingroup\$ @Heslacher - the GuardedString concept is... not a part of Java, but a 3rd party library, and it looks.... broken in many ways - like the string can be serialized? Really? I would just call it "UglyString", not "Guarded". \$\endgroup\$
    – rolfl
    Oct 17, 2015 at 14:14
  • \$\begingroup\$ @rolfl: You might want to look over my change to the securestring tag-wiki. \$\endgroup\$ Oct 18, 2015 at 2:01
  • \$\begingroup\$ Well, I think the first paragraph is still a bit too managed / gc - based. Though in non-gc-languages one usually rolls ones own secure buffers, or manages them completely manually. See for example stackoverflow.com/questions/3785582/… for a C++ implementation employing secure erasing. \$\endgroup\$ Oct 18, 2015 at 2:32
  • 1
    \$\begingroup\$ In cryptography we have forward-secrecy and key-erasure as related concepts. \$\endgroup\$ Oct 19, 2015 at 7:06

1 Answer 1


I have done some reading around, and, no, I can't find other languages with similar constructs.

In this case, I would give .NET the bonus of naming rights, and create the tag with that name since it got there first.

As an interesting observation, there is a great discussion of this concept on Security.se.

What I take away from that is that Windows as a platform has some historical/legacy issues which make it more important to consider string security, but all platforms are vulnerable to some level....

... also, the weakest link is probably the code, or interface, that transports the data in to the SecureString, not the memory itself.

Regardless, I would recommend you create the tag, and let the other platforms be tagged with it when their corresponding implementations materialize, if ever.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .