秘钥管理改造,服务端返回sign

1.x
tanghc 6 years ago
parent eb179632c8
commit 955e7ef1fd
  1. 20
      sop-1.11.0.sql
  2. 4
      sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/api/isv/result/IsvDetailDTO.java
  3. 2
      sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/mapper/IsvInfoMapper.java
  4. 3
      sop-gateway/src/main/java/com/gitee/sop/gateway/entity/IsvDetailDTO.java
  5. 20
      sop.sql

@ -0,0 +1,20 @@
DROP TABLE IF EXISTS `isv_keys`;
CREATE TABLE `isv_keys` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`app_key` varchar(128) NOT NULL DEFAULT '应用id(交给开发者)',
`sign_type` tinyint(4) NOT NULL DEFAULT '1' COMMENT '1:RSA2,2:MD5',
`secret` varchar(200) NOT NULL DEFAULT '' COMMENT 'sign_type=2时使用',
`key_format` tinyint(4) NOT NULL DEFAULT '1' COMMENT '秘钥格式,1:PKCS8(JAVA适用),2:PKCS1(非JAVA适用)',
`public_key_isv` text NOT NULL COMMENT '开发者生成的公钥',
`private_key_isv` text NOT NULL COMMENT '开发者生成的私钥(交给开发者)',
`public_key_platform` text NOT NULL COMMENT '平台生成的公钥(交给开发者)',
`private_key_platform` text NOT NULL COMMENT '平台生成的私钥',
`gmt_create` datetime DEFAULT CURRENT_TIMESTAMP,
`gmt_modified` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `uk_appkey` (`app_key`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='ISV秘钥';
INSERT INTO `sop`.`isv_keys` (`app_key`,`sign_type`, `secret`,`key_format`, `public_key_isv`, `private_key_isv`, `public_key_platform`, `private_key_platform`)
select app_key, sign_type, secret, 1, pub_key,pri_key,'','' from isv_info;

@ -17,16 +17,16 @@ public class IsvDetailDTO {
@ApiDocField(description = "状态:0启用,1禁用")
private Byte status;
// keys
/** secret, 数据库字段:secret */
@ApiDocField(description = "secret", example = "bbbb")
private String secret;
/** 开发者生成的公钥, 数据库字段:public_key_isv */
@ApiDocField(description = "开发者生成的公钥")
private String publicKeyIsv;
/** 平台生成的私钥, 数据库字段:private_key_platform */
@ApiDocField(description = "平台生成的私钥")
private String privateKeyPlatform;
@ApiDocField(description = "签名类型:1:RSA2,2:MD5")

@ -19,8 +19,6 @@ public interface IsvInfoMapper extends CrudMapper<IsvInfo, Long> {
" ,t2.sign_type signType " +
" ,t2.secret " +
" ,t2.public_key_isv publicKeyIsv " +
" ,t2.private_key_isv privateKeyIsv " +
" ,t2.public_key_platform publicKeyPlatform " +
" ,t2.private_key_platform privateKeyPlatform " +
"FROM isv_info t " +
"INNER JOIN isv_keys t2 ON t.app_key = t2.app_key " +

@ -14,8 +14,6 @@ public class IsvDetailDTO {
/** 0启用,1禁用, 数据库字段:status */
private Byte status;
// keys
/** secret, 数据库字段:secret */
private String secret;
@ -25,5 +23,6 @@ public class IsvDetailDTO {
/** 平台生成的私钥, 数据库字段:private_key_platform */
private String privateKeyPlatform;
/** 签名类型:1:RSA2,2:MD5 */
private Byte signType;
}

@ -13,7 +13,7 @@ DROP TABLE IF EXISTS `config_route_base`;
DROP TABLE IF EXISTS `config_limit`;
DROP TABLE IF EXISTS `admin_user_info`;
DROP TABLE IF EXISTS `config_common`;
DROP TABLE IF EXISTS `isv_keys`;
CREATE TABLE `admin_user_info` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
@ -147,6 +147,21 @@ CREATE TABLE `config_common` (
UNIQUE KEY `uk_groupkey` (`config_group`,`config_key`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='通用配置表';
CREATE TABLE `isv_keys` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`app_key` varchar(128) NOT NULL DEFAULT '',
`sign_type` tinyint(4) NOT NULL DEFAULT '1' COMMENT '1:RSA2,2:MD5',
`secret` varchar(200) NOT NULL DEFAULT '' COMMENT 'sign_type=2时使用',
`key_format` tinyint(4) NOT NULL DEFAULT '1' COMMENT '秘钥格式,1:PKCS8(JAVA适用),2:PKCS1(非JAVA适用)',
`public_key_isv` text NOT NULL COMMENT '开发者生成的公钥',
`private_key_isv` text NOT NULL COMMENT '开发者生成的私钥(交给开发者)',
`public_key_platform` text NOT NULL COMMENT '平台生成的公钥(交给开发者)',
`private_key_platform` text NOT NULL COMMENT '平台生成的私钥',
`gmt_create` datetime DEFAULT CURRENT_TIMESTAMP,
`gmt_modified` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `uk_appkey` (`app_key`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='ISV秘钥';
SET FOREIGN_KEY_CHECKS = @PREVIOUS_FOREIGN_KEY_CHECKS;
@ -261,7 +276,8 @@ ALTER TABLE `user_info` ENABLE KEYS;
UNLOCK TABLES;
INSERT INTO `sop`.`isv_keys` (`app_key`,`sign_type`, `secret`,`key_format`, `public_key_isv`, `private_key_isv`, `public_key_platform`, `private_key_platform`)
select app_key, sign_type, secret, 1, pub_key,pri_key,'','' from isv_info;
SET FOREIGN_KEY_CHECKS = @PREVIOUS_FOREIGN_KEY_CHECKS;

Loading…
Cancel
Save