- 最新动态
- 功能总览
- 产品介绍
- 计费说明
- 快速入门
-
用户指南
- 开始使用ROMA Connect
- 实例管理
- 集成应用管理
-
数据源管理
- ROMA Connect支持的数据源
- 接入API数据源
- 接入ActiveMQ数据源
- 接入ArtemisMQ数据源
- 接入DB2数据源
- 接入DIS数据源
- 接入DWS数据源
- 接入DM数据源
- 接入Gauss100数据源
- 接入FTP数据源
- 接入HL7数据源
- 接入HANA数据源
- 接入HIVE数据源
- 接入LDAP数据源
- 接入IBM MQ数据源
- 接入Kafka数据源
- 接入MySQL数据源
- 接入MongoDB数据源
- 接入MQS数据源
- 接入MRS Hive数据源
- 接入MRS HDFS数据源
- 接入MRS HBase数据源
- 接入MRS Kafka数据源
- 接入OBS数据源
- 接入Oracle数据源
- 接入PostgreSQL数据源
- 接入Redis数据源
- 接入RabbitMQ数据源
- 接入RocketMQ数据源
- 接入SAP数据源
- 接入SNMP数据源
- 接入SQL Server数据源
- 接入GaussDB(for MySQL)数据源
- 接入WebSocket数据源
- 接入自定义数据源
- 数据集成指导
- 服务集成指导
- 服务集成指导(旧版界面)
- 消息集成指导
- 设备集成指导
- 应用业务模型使用指导
- 扩大资源配额
- 查看审计日志
- 查看监控指标
- 权限管理
- 用户指南(新版)
- 最佳实践
-
开发指南
- 数据集成开发指导
-
服务集成开发指导
- 开发说明
- API调用认证开发(APP认证)
- API调用认证开发(IAM认证)
-
自定义后端开发(函数后端)
- 函数后端脚本开发说明
- AesUtils类说明
- APIConnectResponse类说明
- Base64Utils类说明
- CacheUtils类说明
- CipherUtils类说明
- ConnectionConfig类说明
- DataSourceClient类说明
- DataSourceConfig类说明
- ExchangeConfig类说明
- HttpClient类说明
- HttpConfig类说明
- JedisConfig类说明
- JSON2XMLHelper类说明
- JSONHelper类说明
- JsonUtils类说明
- JWTUtils类说明
- KafkaConsumer类说明
- KafkaProducer类说明
- KafkaConfig类说明
- MD5Encoder类说明
- Md5Utils类说明
- QueueConfig类说明
- RabbitMqConfig类说明
- RabbitMqProducer类说明
- RedisClient类说明
- RomaWebConfig类说明
- RSAUtils类说明
- SapRfcClient类说明
- SapRfcConfig类说明
- SoapClient类说明
- SoapConfig类说明
- StringUtils类说明
- TextUtils类说明
- XmlUtils类说明
- 自定义后端开发(数据后端)
- 后端服务签名校验开发
- 消息集成开发指导
- 设备集成开发指导
-
API参考
- 使用前必读
- API概览
- 如何调用API
- 公共资源API
- 数据集成API
- 服务集成API
- 消息集成API
- 设备集成API
- 应用示例
- 权限和授权项
- 附录
- 历史API
- 修订记录
- SDK参考
-
常见问题
- 实例管理
-
数据集成
-
数据集成普通任务
- FDI各类数据库支持哪些数据类型?
- 跟踪号是什么,能跟踪到数据吗?
- FDI任务是否支持清空目标表?
- FDI任务只能采集单张表到单张表吗?
- 用户创建的FDI任务,同一账号的其他用户可见吗?
- FDI通过公网对接其他租户的MRS HIVE如何配置?
- 从OBS解析文件到RDS数据库,采集过一次后,后面采集会进行更新吗?
- OBS源端的CSV文件解析到关系型数据库时,列的值不对怎么办?
- MRS Hive目标字段和源端字段数据类型不匹配时,数据是否能集成到目标端?
- MRS Hive、MRS HBase和MongoDB的Mapping映射手动输入时,是否区分大小写?
- MRS Hive是否支持分区?
- 源端API类型数据源自定义周期如何设置?
- SAP是否支持分页读取视图?
- 数据集成组合任务
-
数据集成普通任务
- 服务集成
- 消息集成
- 设备集成
-
故障排除
-
数据集成任务
- MRS Hive目标端写入时出现数据乱码
- MRS Hive写入时数据全部写在第一个字段里
- 目标端任务报任务运行超时
- MySQL到MRS Hive时目标端报“could only be written to 0 of the 1 minReplication nodes. There are 2 datanode(s) running and 2 node(s) are excluded in this operation”错误
- Mysql到Mysql时源端报“Illegal mix of collations for operation 'UNION'”错误
- 源端Mysql增量采集每小时执行一次时部分数据丢失
- API到MySQL时源端报“401 unauthorized”错误
- Kafka集到Mysql目标端报“cannot find record mapping field”错误
- API到MySQL的定时任务时会出现源端报“connect timeout”错误
- Kafka到Mysql的实时任务时,MQS中的Topic下有数据,但是FDI任务没有采集到数据。
- Mysql到Mysql的定时任务,源端有类型为tinyint(1),值为2的字段,但是采集到目标端值就变成了1
- 目标端数据源为公网Kafka时,定时任务目标端报“The task executes failed.Writer data to kafka failed”错误
- 数据集成组合任务
- 数据源
- 服务集成
- 设备集成
-
数据集成任务
- 视频帮助
- 文档下载
- 通用参考
链接复制成功!
RSAUtils类说明
路径
com.roma.apic.livedata.common.v1.RSAUtils
说明
提供RSA加解密方法。
使用示例
通过以下java代码生成公钥和私钥:
import java.security.KeyPair; import java.security.KeyPairGenerator; import java.security.PrivateKey; import java.security.PublicKey; import java.util.Base64; public class Main { public static void main(String[] args) { try { KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA"); keyPairGenerator.initialize(1024); KeyPair keyPair = keyPairGenerator.generateKeyPair(); PublicKey publicKey = keyPair.getPublic(); System.out.println("publicKey:" + new String(Base64.getEncoder().encode(publicKey.getEncoded()))); PrivateKey privateKey = keyPair.getPrivate(); System.out.println("privateKey:" + new String(Base64.getEncoder().encode(privateKey.getEncoded()))); } catch (Exception e) { e.printStackTrace(); return; } } }
将上述公钥和私钥填入到下面代码中:
importClass(com.roma.apic.livedata.common.v1.RSAUtils); importClass(com.roma.apic.livedata.common.v1.Base64Utils); function execute(data) { var publicKeyString = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDd4CRRppmYVlFl3dX4iVGN+2Twy5gLeEPRbvhOko/xFipGF7XV0weTp4wCakgdnm+DR4gBBrQtfAuKwYIBPIr+C1FI5sKYA3NxazDWUcXR3xlPM5D0DWjacjcMjnaj2v21WZxGpwHZHQ9TLd4OBBq3fva1r/cE8s1Lji5QeFiklwIDAQAB"; var privateKeyString = "**********"; var publicKey = RSAUtils.getPublicKey(publicKeyString) var privateKey = RSAUtils.getPrivateKey(privateKeyString) var origin = "hello rsa" var encrypted = RSAUtils.encrypt(Base64Utils.encode(origin), publicKey) var decrypted = RSAUtils.decrypt(encrypted, privateKey) return decrypted }
构造器详情
public RSAUtils()
构造一个无参数的RSAUtils
方法列表
返回类型 |
方法和说明 |
---|---|
static byte[] |
decodeBase64(String base64) BASE64字符串解码为二进制数据 |
static byte[] |
decrypt(java.security.PrivateKey privateKey, byte[] encryptData) RSA解密 |
static String |
decrypt(String source, java.security.interfaces.RSAPrivateKey privateKey) RSA解密(source为base64编码) |
static String |
decrypt(String source, java.security.interfaces.RSAPrivateKey privateKey, Map<String, String> config) RSA解密(source为base64编码) |
static String |
decrypt(byte[] source, java.security.interfaces.RSAPrivateKey privateKey) RSA解密 |
static String |
decrypt(byte[] source, java.security.interfaces.RSAPrivateKey privateKey, Map<String, String> config) RSA解密 |
static String |
encodeBase64(byte[] bytes) 二进制数据编码为BASE64字符串 |
static byte[] |
encrypt(java.security.PublicKey publicKey, byte[] source) RSA加密 |
static String |
encrypt(String source, java.security.PublicKey publicKey) RSA加密(source为base64编码,返回加密数据为base64编码) |
static String |
encrypt(String source, java.security.PublicKey publicKey, Map<String, String> config) RSA加密(source为base64编码,返回加密数据为base64编码) |
static String |
encrypt(byte[] source, java.security.PublicKey publicKey) RSA加密(返回加密数据为base64编码) |
static String |
encrypt(byte[] source, java.security.PublicKey publicKey, Map<String, String> config) RSA加密(返回加密数据为base64编码) |
static java.security.interfaces.RSAPrivateKey |
getPrivateKey(byte[] privateKeyByte) 通过私钥字节数组创建RSA私钥 |
static java.security.interfaces.RSAPrivateKey |
getPrivateKey(String privateKeyByte) 通过base64编码的私钥创建RSA私钥 |
static java.security.interfaces.RSAPrivateKey |
getPrivateKey(String modulus, String exponent) 通过模数和指数创建RSA私钥 |
static java.security.interfaces.RSAPublicKey |
getPublicKey(byte[] publicKeyByte) 通过公钥字节数组创建RSA公钥 |
static java.security.interfaces.RSAPublicKey |
getPublicKey(String publicKeyByte) 通过base64编码的公钥创建RSA公钥 |
static java.security.PublicKey |
getPublicKey(String modulus, String exponent) 通过模数和指数创建RSA公钥 |
方法详情
- public static byte[] decodeBase64(String base64)
BASE64字符串解码为二进制数据
输入参数
base64:base64编码的数据
返回信息
返回base64解码后的数据
- public static byte[] decrypt(java.security.PrivateKey privateKey, byte[] encryptData)
RSA解密
输入参数
- privateKey:私钥
- encryptData:待解密数据
返回信息
解密后的数据
- public static String decrypt(String source, java.security.interfaces.RSAPrivateKey privateKey)
RSA解密
输入参数
- source: 待解密数据的base64编码
- privateKey:私钥
返回信息
解密后的数据
- public static String decrypt(String source, java.security.interfaces.RSAPrivateKey privateKey, Map<String,String>config)
RSA解密
输入参数
- source: 带解密数据的base64编码
- privateKey:私钥
- config: 解密配置,配置项可以为:
transformation:指定解密的算法/模式/填充。例如:"RSA/ECB/OAEPPadding"。详见参数说明。
返回信息
解密后的数据
- public static String decrypt(byte[] source, java.security.interfaces.RSAPrivateKey privateKey)
RSA解密
输入参数
- source: 带解密数据
- privateKey:私钥
返回信息
解密后的数据
- public static String decrypt(byte[] source, java.security.interfaces.RSAPrivateKey privateKey, Map<String,String>config)
RSA解密
输入参数
- source: 带解密数据
- privateKey:私钥
- config: 解密配置,配置项可以为:
transformation:指定解密的算法/模式/填充。例如:"RSA/ECB/OAEPPadding"。详见参数说明。
返回信息
解密后的数据
- public static String encodeBase64(byte[] bytes)
二进制数据编码为BASE64字符串
输入参数
bytes:待编码数据
返回信息
BASE64编码
- public static byte[] encrypt(java.security.PublicKey publicKey, byte[] source)
RSA加密
输入参数
- publicKey:公钥
- source:需要加密的内容
返回信息
加密后的数据内容
- public static String encrypt(String source, java.security.PublicKey publicKey)
RSA加密
输入参数
- source:待加密数据的base64编码
- publicKey:公钥
返回信息
加密后的数据内容的base64编码
- public static String encrypt(String source, java.security.PublicKey publicKey, Map<String, String> config)
RSA加密
输入参数
- source:待加密数据的base64编码
- publicKey:公钥
- config:加密选项,配置项可以为:
transformation:指定加密的算法/模式/填充。例如:"RSA/ECB/OAEPPadding"。详见参数说明。
- public static String encrypt(byte[] source, java.security.PublicKey publicKey)
RSA加密
输入参数
- source:需要加密的内容
- publicKey:公钥
返回信息
加密后的数据内容的base64编码
- public static String encrypt(byte[] source, java.security.PublicKey publicKey, Map<String, String> config)
RSA加密
输入参数
- source:需要加密的内容
- publicKey:公钥
- config:加密选项,配置项可以为:
transformation:指定加密的算法/模式/填充。例如:"RSA/ECB/OAEPPadding"。详见参数说明。
返回信息
加密后的数据内容的base64编码
- public static java.security.interfaces.RSAPrivateKey getPrivateKey(byte[] privateKeyByte)
通过x509格式编码的私钥创建RSA私钥
输入参数
privateKeyByte:通过x509格式编码的私钥
返回信息
私钥
- public static java.security.interfaces.RSAPrivateKey getPrivateKey(String privateKeyByte)
通过x509格式编码的私钥创建RSA私钥
输入参数
privateKeyByte:通过x509格式编码的私钥
返回信息
私钥
- public static java.security.interfaces.RSAPrivateKey getPrivateKey(String modulus, String exponent)
通过模数和指数创建RSA私钥
输入参数
- modulus:生成私钥需要的模数
- exponent:生成私钥需要的指数
返回信息
返回RSA私钥
- public static java.security.interfaces.RSAPublicKey getPublicKey(byte[] publicKeyByte)
通过x509格式编码的公钥创建RSA公钥
输入参数
publicKeyByte:x509格式编码的公钥
返回信息
公钥
- public static java.security.PublicKey getPublicKey(String modulus, String exponent)
通过模数和指数创建RSA公钥
输入参数
- modulus:生成公钥需要的模数
- exponent:生成公钥需要的指数
返回信息
返回RSA公钥