PaillierCipher.java 文件源码

java
阅读 33 收藏 0 点赞 0 评论 0

项目:paillier 作者:
/**
 * Initialises this cipher with key and a source of randomness
 */
protected void engineInit(int mode, Key key, SecureRandom random)
        throws InvalidKeyException {
    if (mode == Cipher.ENCRYPT_MODE)
        if (!(key instanceof PaillierPublicKey))
            throw new InvalidKeyException(
                    "I didn't get a PaillierPublicKey. ");
        else if (mode == Cipher.DECRYPT_MODE)
            if (!(key instanceof PaillierPrivateKey))
                throw new InvalidKeyException(
                        "I didn't get a PaillierPrivateKey. ");
            else
                throw new IllegalArgumentException("Bad mode: " + mode);

    stateMode = mode;
    keyPaillier = key;
    SECURE_RANDOM = random;
    int modulusLength = ((PaillierKey) key).getN().bitLength();
    calculateBlockSizes(modulusLength);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号