diff --git a/scapy/asn1/ber.py b/scapy/asn1/ber.py index c2b0cf3a5..deadf770f 100644 --- a/scapy/asn1/ber.py +++ b/scapy/asn1/ber.py @@ -337,7 +337,8 @@ class BERcodec_STRING(BERcodec_Object): tag = ASN1_Class_UNIVERSAL.STRING @classmethod def enc(cls,s): - return chb(hash(cls.tag))+BER_len_enc(len(s))+raw(s) # Be sure we are encoding bytes + s = raw(s) + return chb(hash(cls.tag))+BER_len_enc(len(s))+s # Be sure we are encoding bytes @classmethod def do_dec(cls, s, context=None, safe=False): l,s,t = cls.check_type_check_len(s)