개발잡다
Base64 - RFC 2045/RFC 4648
fmoths
2022. 4. 17. 23:06
Currently, XMLDSIG references RFC 2045 (one of the MIME RFCs) for a definition of Base64 encoding/decoding. (See section 6.8 of [1].) It has been pointed out to me that RFC 2045 *requires* that Base64-encoded content have line breaks at least every 76 characters. Paragraph 6 reads as follows:
Base64를 디코딩하는데 안되는 이슈가 발생하여 봤더니 base64 타입에 따라 다르게 인코딩되는 것을 알게 되었다.
RFC 2045의 경우는 매 76자 마다 개행문자를 넣는다. MIME을 지원하기 위함이라는 것 같다. 예전에는 펀치 머신과 같은 기계에서는 76글자 이상을 지원하지않았다고 한다. 그 때문에 76글자 이상이 아니라는것을 보장하기 위해서 개행문자를 넣었다.
엥간하면 개행문자를 넣지 않는 RFC 4648을 쓰는 것이 낫다.
참고: https://lists.w3.org/Archives/Public/w3c-ietf-xmldsig/2001AprJun/0183.html