[minor] change directory to public key
[fix] use buffer in stead of code