Trying to understand Java RSA key size

后端 未结 2 685
清歌不尽
清歌不尽 2020-12-05 09:00

The key generator was initilized with a size of 1024, so why the printed sizes are 635 and 162?

import java.security.KeyPair;
import java.security.KeyPairGen         


        
2条回答
  •  不思量自难忘°
    2020-12-05 09:28

    First hint: 1024 bits = 128 bytes

    Second hint: privateKey.getEncoded() returns an encoded representation (i.e. not raw).

提交回复
热议问题