Trying to read string from Org.BouncyCastle.Asn1.Crmf.AttributeTypeAndValue
.
The string value read from the AttributeTypeAndValue
contains the junk value in the beginning.
My code:
//create type value
string id = "1.2";
string value = "hello";
var derValue = new DerPrintableString(value);
var typeValue = new Org.BouncyCastle.Asn1.Crmf.AttributeTypeAndValue(id, derValue);
//read type value
var decodedValue = new DerPrintableString(typeValue.Value.GetDerEncoded());
Console.WriteLine("Original: {0}, Decoded: {1}",
derValue.GetString(), decodedValue.GetString());
The output for above code is,
Please help me extract the original string value from AttributeTypeAndValue without junk characters.