473,385 Members | 1,757 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

String to Octet String C#

122 100+
Hi guys, I am curently working with ADAM and AZMAN and I would like to store the users passord in the ADAM database.

However it is of type Octet String. Being knew to the world of C# I have no Idea what that is and I tried to convert it t a byte array and then save it but it only errors out.

Can anyone help me with.

1. converting a textbox.text to an octet string and
2. converting an octet string value back into a string.

Thanks,
Dale.
Sep 12 '08 #1
2 9707
Plater
7,872 Expert 4TB
By octet strings, do you mean hexidecimal strings?
Expand|Select|Wrap|Line Numbers
  1. Int32 i=42;
  2. string hexstring= i.ToString("X8");
  3.  
That will give the value of 42 in hex, padded to 8 hex digits

If you have a string of characters, you will need to convert them to a byte[]. THEN, go through each byte (in a loop probably) and append that .ToString("X2") (X2 because you need to ensure that 2 hex digits come out) to another string.
I think you can do this with a StringBuilder rather nicely.
Sep 12 '08 #2
DragonLord
122 100+
That is a good question I really don't know what an Octet string is to be honest, some say byte array bt i have tried that and the damn thing gets rejected by ADAM, if i comment it out i am able to add all the other attributes.
Sep 12 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Matthew | last post by:
I am working on some software that uses SNMP to get information from routers and switches. I am using the pysnmp module (v2.0.8) to do the snmp part. The problem that I am having is that when I...
32
by: Wolfgang Draxinger | last post by:
I understand that it is perfectly possible to store UTF-8 strings in a std::string, however doing so can cause some implicaions. E.g. you can't count the amount of characters by length() | size()....
1
by: AstroDrabb | last post by:
I am trying to update some Active Directory attributes in C#. The C# app creates new computer objects and then populates some attributes. However, I am having problems with one attribute named...
29
by: zoltan | last post by:
Hi, The scenario is like this : struct ns_rr { const u_char* rdata; }; The rdata field contains some fields such as :
7
by: wenmang | last post by:
Hi all, I have a confusion for representation of hex number: For an unsigned long long number, its max value is: unsigned long long maxNum = 18446744073709551615; if I do: printf("max uint64_t...
6
by: itgaurav198 | last post by:
Hi, Is it possible to convert a string in "Binary Octet String".?Also, if possible, please make clear what "Binary Octet String" is. Thanks
2
by: Jeffrey Walton | last post by:
Hi All, BMP Strings are a subset of Universal Strings.The BMP string uses approximately 65,000 code points from Universal String encoding. BMP Strings: ISO/IEC 10646, 2-octet canonical form,...
0
by: Jeffrey Walton | last post by:
I wanted to share this with anyone who may stumble across this thread. X.690 specifies a BMP string is the 2-octet canonical form (specified in ISO/IEC 10646-1) of UCS (also specified in ISO/IEC...
2
by: miltizem | last post by:
Guys i'm using a software to monitor the signal over noise factor of a traffic ... The result is given under two formats .. First an octet string Second a decibel number my question how can i...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.