org.dromara.hutool.crypto.asymmetric.AbstractAsymmetricCrypto Maven / Gradle / Ivy
/*
* Copyright (c) 2013-2024 Hutool Team and hutool.cn
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.dromara.hutool.crypto.asymmetric;
import java.security.KeyPair;
/**
* 抽象的非对称加密对象,包装了加密和解密为Hex和Base64的封装
*
* @param 返回自身类型
* @author Looly
*/
public abstract class AbstractAsymmetricCrypto>
extends BaseAsymmetric
implements AsymmetricEncryptor, AsymmetricDecryptor{
private static final long serialVersionUID = 1L;
// ------------------------------------------------------------------ Constructor start
/**
* 构造
*
* 私钥和公钥同时为空时生成一对新的私钥和公钥
* 私钥和公钥可以单独传入一个,如此则只能使用此钥匙来做加密或者解密
*
* @param algorithm 算法
* @param keyPair 密钥对,如果为{@code null}则生成随机的私钥和公钥
*/
public AbstractAsymmetricCrypto(final String algorithm, final KeyPair keyPair) {
super(algorithm, keyPair);
}
// ------------------------------------------------------------------ Constructor end
}