SM2解密时,兼容GmSSL非压缩省略的04头的密文

This commit is contained in:
Looly
2024-09-05 13:23:37 +08:00
parent c9cac93337
commit 38911594c8
7 changed files with 146 additions and 21 deletions

View File

@@ -159,7 +159,7 @@ public class DatabaseMetaDataWrapper extends SimpleWrapper<DatabaseMetaData> {
// issue#I9BANE Oracle中特殊表名需要解包
tableName = getPureTableName(tableName);
try (final ResultSet rs = this.raw.getTables(catalog, schema, tableName, new String[]{TableType.TABLE.value()})) {
try (final ResultSet rs = this.raw.getTables(catalog, schema, tableName, new String[]{TableType.TABLE.getValue()})) {
if (null != rs) {
if (rs.next()) {
return rs.getString("REMARKS");

View File

@@ -77,55 +77,127 @@ public class IndexInfo implements Serializable, Cloneable {
this.tableName = tableName;
this.schema = schema;
this.catalog = catalog;
this.setColumnIndexInfoList(new ArrayList<>());
this.columnIndexInfoList = new ArrayList<>();
}
/**
* 检查索引是否是非唯一的
*
* @return 如果索引是非唯一的返回true否则返回false
*/
public boolean isNonUnique() {
return nonUnique;
}
public void setNonUnique(final boolean nonUnique) {
/**
* 设置索引的非唯一状态
*
* @param nonUnique 索引的非唯一状态
* @return 当前的IndexInfo对象以支持链式调用
*/
public IndexInfo setNonUnique(final boolean nonUnique) {
this.nonUnique = nonUnique;
return this;
}
/**
* 获取索引名称
*
* @return 索引名称
*/
public String getIndexName() {
return indexName;
}
public void setIndexName(final String indexName) {
/**
* 设置索引名称
*
* @param indexName 索引名称
* @return 当前的IndexInfo对象以支持链式调用
*/
public IndexInfo setIndexName(final String indexName) {
this.indexName = indexName;
return this;
}
/**
* 获取表名称
*
* @return 表名称
*/
public String getTableName() {
return tableName;
}
public void setTableName(final String tableName) {
/**
* 设置表名称
*
* @param tableName 表名称
* @return 当前的IndexInfo对象以支持链式调用
*/
public IndexInfo setTableName(final String tableName) {
this.tableName = tableName;
return this;
}
/**
* 获取 schema 名称
*
* @return schema 名称
*/
public String getSchema() {
return schema;
}
public void setSchema(final String schema) {
/**
* 设置 schema 名称
*
* @param schema schema 名称
* @return 当前的IndexInfo对象以支持链式调用
*/
public IndexInfo setSchema(final String schema) {
this.schema = schema;
return this;
}
/**
* 获取目录名称
*
* @return 目录名称
*/
public String getCatalog() {
return catalog;
}
public void setCatalog(final String catalog) {
/**
* 设置目录名称
*
* @param catalog 目录名称
* @return 当前的IndexInfo对象以支持链式调用
*/
public IndexInfo setCatalog(final String catalog) {
this.catalog = catalog;
return this;
}
/**
* 获取列索引信息列表
*
* @return 列索引信息列表
*/
public List<ColumnIndexInfo> getColumnIndexInfoList() {
return columnIndexInfoList;
}
public void setColumnIndexInfoList(final List<ColumnIndexInfo> columnIndexInfoList) {
/**
* 设置列索引信息列表
*
* @param columnIndexInfoList 列索引信息列表
* @return 当前的IndexInfo对象以支持链式调用
*/
public IndexInfo setColumnIndexInfoList(final List<ColumnIndexInfo> columnIndexInfoList) {
this.columnIndexInfoList = columnIndexInfoList;
return this;
}
@Override
@@ -138,7 +210,7 @@ public class IndexInfo implements Serializable, Cloneable {
}
final IndexInfo indexInfo = (IndexInfo) o;
return ObjUtil.equals(indexName, indexInfo.indexName)
&& ObjUtil.equals(tableName, indexInfo.tableName);
&& ObjUtil.equals(tableName, indexInfo.tableName);
}
@Override
@@ -154,12 +226,12 @@ public class IndexInfo implements Serializable, Cloneable {
@Override
public String toString() {
return "IndexInfo{" +
"nonUnique=" + nonUnique +
", indexName='" + indexName + '\'' +
", tableName='" + tableName + '\'' +
", schema='" + schema + '\'' +
", catalog='" + catalog + '\'' +
", columnIndexInfoList=" + columnIndexInfoList +
'}';
"nonUnique=" + nonUnique +
", indexName='" + indexName + '\'' +
", tableName='" + tableName + '\'' +
", schema='" + schema + '\'' +
", catalog='" + catalog + '\'' +
", columnIndexInfoList=" + columnIndexInfoList +
'}';
}
}

View File

@@ -22,12 +22,33 @@ package org.dromara.hutool.db.meta;
* @author Looly
*/
public enum TableType {
/**
* 数据库表
*/
TABLE("TABLE"),
/**
* 视图
*/
VIEW("VIEW"),
/**
* 系统表
*/
SYSTEM_TABLE("SYSTEM TABLE"),
/**
* 全局临时表
*/
GLOBAL_TEMPORARY("GLOBAL TEMPORARY"),
/**
* 本地临时表
*/
LOCAL_TEMPORARY("LOCAL TEMPORARY"),
/**
* 别名
*/
ALIAS("ALIAS"),
/**
* 快捷方式
*/
SYNONYM("SYNONYM");
private final String value;
@@ -46,12 +67,12 @@ public enum TableType {
*
* @return 值
*/
public String value() {
public String getValue() {
return this.value;
}
@Override
public String toString() {
return this.value();
return this.getValue();
}
}