0

The OssBitString takes in string length (in bits) and a const unsigned char* as parameters. However, when I convert the input std::string to const unsigned char* and pass it to OssBitString, the contents of the string get modified and contains weird characters. The following is the conversion function from std::string to OssBitString:

inline const OssBitString converter(const std::string&s, int size)
{ 
return OssBitString(size, reinterpret_cast<const unsigned char*>(s.c_str()))
}

I am not sure how to proceed. Also,I tried to convert the string into binary format and then convert as a OssBitString as well. But it did not work. How to convert std::string to OssBitString then?

1
  • 1
    Should not you address this question to OSS Novalka as you seem to use their ASN1/C++ tool ? Commented Jan 15, 2020 at 9:42

2 Answers 2

0

Since you seem to be asking a question about a particular commercial ASN.1 Tool vendor's product, you should send your question directly to them. To reach OSS Nokalva's technical support, send an email to [email protected] rather than asking your question here.

Sign up to request clarification or add additional context in comments.

Comments

0

Like such:

std::string my_str;

OssBitString my_bit_str;

my_bit_str.set(my_str.length(), my_str.data());

https://www.oss.com/asn1/products/documentation/asn1_cpp_6.7/asn1cpp-runtime-representation-classes.html#OssBitString_set_length_char

The poor interface of OSS was a good motivator for my to write my own ASN.1 library. In fast_ber any string like type can be assigned to directly. Example of usage in fast_ber:

https://github.com/Samuel-Tyler/fast_ber/blob/master/sample/encode/main.cpp

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.