admin
2021-01-15 5405154d6979f1b50ce2d881bb164b1acca80b6d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/**
 * Alipay.com Inc. Copyright (c) 2004-2019 All Rights Reserved.
 */
package com.ks.daylucky.util;
 
import com.alipay.api.AlipayConstants;
 
/**
 * RSA算法加密器 签名部分采用SHA1算法进行摘要计算
 */
public class RSA2Encryptor extends RSAEncryptor {
    /**
     * RSA2最大加密明文大小(2048/8-11=244)
     */
    private static final int MAX_ENCRYPT_BLOCK_SIZE = 244;
    /**
     * RSA2最大解密密文大小(2048/8=256)
     */
    private static final int MAX_DECRYPT_BLOCK_SIZE = 256;
 
    @Override
    protected String getAsymmetricType() {
        return AlipayConstants.SIGN_TYPE_RSA2;
    }
 
    @Override
    protected String getSignAlgorithm() {
        return AlipayConstants.SIGN_SHA256RSA_ALGORITHMS;
    }
 
    @Override
    protected int getMaxDecryptBlockSize() {
        return MAX_DECRYPT_BLOCK_SIZE;
    }
 
    @Override
    protected int getMaxEncryptBlockSize() {
        return MAX_ENCRYPT_BLOCK_SIZE;
    }
 
}