| 157 | } |
| 158 | |
| 159 | size_t BERDecodeTextString(BufferedTransformation &bt, std::string &str, byte asnTag) |
| 160 | { |
| 161 | byte b; |
| 162 | if (!bt.Get(b) || b != asnTag) |
| 163 | BERDecodeError(); |
| 164 | |
| 165 | size_t bc; |
| 166 | if (!BERLengthDecode(bt, bc)) |
| 167 | BERDecodeError(); |
| 168 | if (bc > bt.MaxRetrievable()) // Issue 346 |
| 169 | BERDecodeError(); |
| 170 | |
| 171 | SecByteBlock temp(bc); |
| 172 | if (bc != bt.Get(temp, bc)) |
| 173 | BERDecodeError(); |
| 174 | str.assign((char *)temp.begin(), bc); |
| 175 | return bc; |
| 176 | } |
| 177 | |
| 178 | /// ASN BitString |
| 179 | size_t DEREncodeBitString(BufferedTransformation &bt, const byte *str, size_t strLen, unsigned int unusedBits) |
no test coverage detected