diff --git a/scfs-api-service/src/test/java/com/czcb/scfs/api/service/MockResponse.java b/scfs-api-service/src/test/java/com/czcb/scfs/api/service/MockResponse.java index 70ca4ed..eb58af1 100644 --- a/scfs-api-service/src/test/java/com/czcb/scfs/api/service/MockResponse.java +++ b/scfs-api-service/src/test/java/com/czcb/scfs/api/service/MockResponse.java @@ -45,7 +45,7 @@ public class MockResponse { list.add(certificate); CertificateProvider certificateProvider = new LocalCertificateProvider(list); Privacy privacy = new TestPrivacy(privateKey, certificateProvider); - Signature signature = new DefaultSignature(certificateProvider, new TestSigner(privateKey), new TestVerifier(certificateProvider)); + Signature signature = new DefaultSignature(certificateProvider, new TestSigner(privateKey, "6CDDAA92CAD75998325027647847330C1756291"), new TestVerifier(certificateProvider)); return new TestProfile( privacy, signature, new DefaultChannel.Builder() diff --git a/scfs-api-service/src/test/java/com/czcb/scfs/api/service/cipher/TestSigner.java b/scfs-api-service/src/test/java/com/czcb/scfs/api/service/cipher/TestSigner.java index 3903236..0d53804 100644 --- a/scfs-api-service/src/test/java/com/czcb/scfs/api/service/cipher/TestSigner.java +++ b/scfs-api-service/src/test/java/com/czcb/scfs/api/service/cipher/TestSigner.java @@ -13,7 +13,7 @@ public class TestSigner extends AbstractSigner { /** * @param privateKey API私钥 */ - public TestSigner(PrivateKey privateKey) { - super("SHA256withRSA", "SHA256withRSA", privateKey, null, ""); + public TestSigner(PrivateKey privateKey, String certificateSerial) { + super("SHA256withRSA", "SHA256withRSA", privateKey, null, certificateSerial); } } diff --git a/scfs-api-spring-boot-starter/src/main/java/com/czcb/scfs/spring/boot/starter/RsaConfiguration.java b/scfs-api-spring-boot-starter/src/main/java/com/czcb/scfs/spring/boot/starter/RsaConfiguration.java index e54bfa7..1d9ae34 100644 --- a/scfs-api-spring-boot-starter/src/main/java/com/czcb/scfs/spring/boot/starter/RsaConfiguration.java +++ b/scfs-api-spring-boot-starter/src/main/java/com/czcb/scfs/spring/boot/starter/RsaConfiguration.java @@ -9,7 +9,6 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import javax.annotation.Resource; import java.io.InputStream; import java.security.PrivateKey; import java.security.cert.X509Certificate; @@ -24,12 +23,14 @@ import java.util.stream.Collectors; @ConditionalOnClass(RsaProfile.class) @ConditionalOnProperty(value = "scfs.api-gateway.cipher.type", havingValue = "rsa") public class RsaConfiguration extends AbstractAutoConfiguration { + private final ScfsApiGatewayProperties properties; - @Resource - private ScfsApiGatewayProperties properties; + public RsaConfiguration(ScfsApiGatewayProperties properties) { + this.properties = properties; + } @Override - protected ScfsApiGatewayProperties getProperties() { + public ScfsApiGatewayProperties getProperties() { return properties; } diff --git a/scfs-api-spring-boot-starter/src/main/java/com/czcb/scfs/spring/boot/starter/SmConfiguration.java b/scfs-api-spring-boot-starter/src/main/java/com/czcb/scfs/spring/boot/starter/SmConfiguration.java index 12daad1..19d6b09 100644 --- a/scfs-api-spring-boot-starter/src/main/java/com/czcb/scfs/spring/boot/starter/SmConfiguration.java +++ b/scfs-api-spring-boot-starter/src/main/java/com/czcb/scfs/spring/boot/starter/SmConfiguration.java @@ -10,7 +10,6 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import javax.annotation.Resource; import java.io.InputStream; import java.security.PrivateKey; import java.security.cert.X509Certificate; @@ -25,8 +24,11 @@ import java.util.stream.Collectors; @ConditionalOnClass(SmProfile.class) @ConditionalOnProperty(value = "scfs.api-gateway.cipher.type", havingValue = "sm", matchIfMissing = true) public class SmConfiguration extends AbstractAutoConfiguration { - @Resource - private ScfsApiGatewayProperties properties; + private final ScfsApiGatewayProperties properties; + + public SmConfiguration(ScfsApiGatewayProperties properties) { + this.properties = properties; + } @Override public ScfsApiGatewayProperties getProperties() { diff --git a/scfs-api-spring-boot-starter/src/test/java/com/czcb/scfs/spring/boot/starter/RsaConfigurationTest.java b/scfs-api-spring-boot-starter/src/test/java/com/czcb/scfs/spring/boot/starter/RsaConfigurationTest.java new file mode 100644 index 0000000..a35c960 --- /dev/null +++ b/scfs-api-spring-boot-starter/src/test/java/com/czcb/scfs/spring/boot/starter/RsaConfigurationTest.java @@ -0,0 +1,79 @@ +package com.czcb.scfs.spring.boot.starter; + +import com.czcb.scfs.api.core.cipher.StoreType; +import com.czcb.scfs.api.core.http.LogLevel; +import com.czcb.scfs.api.rsa.RsaProfile; +import org.assertj.core.util.Lists; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +import java.util.HashMap; +import java.util.Map; + +import static net.javacrumbs.jsonunit.assertj.JsonAssertions.assertThatJson; + +class RsaConfigurationTest { + + private RsaConfiguration rsaConfiguration; + + private ScfsApiGatewayProperties properties() { + ScfsApiGatewayProperties properties = new ScfsApiGatewayProperties(); + + ScfsApiGatewayProperties.Httpclient httpclient = new ScfsApiGatewayProperties.Httpclient(); + Map headers = new HashMap<>(); + headers.put("aa", "123456"); + httpclient.setHeaders(headers); + + ScfsApiGatewayProperties.Httpclient.Proxy proxy = new ScfsApiGatewayProperties.Httpclient.Proxy(); + proxy.setEnabled(true); + proxy.setHost("128.0.0.1"); + proxy.setPort("1000"); + proxy.setUsername("name"); + proxy.setPassword("123456"); + proxy.setScheme("https"); + httpclient.setProxy(proxy); + + ScfsApiGatewayProperties.Httpclient.ConnPool connPool = new ScfsApiGatewayProperties.Httpclient.ConnPool(); + connPool.setMaxRequests(100); + connPool.setMaxRequestPerHost(100); + connPool.setConnectTimeout(100); + connPool.setSocketTimeout(100); + httpclient.setConnPool(connPool); + httpclient.setCompressionEnabled(false); + httpclient.setLogLevel(LogLevel.basic); + properties.setHttpclient(httpclient); + + ScfsApiGatewayProperties.Channel channel = new ScfsApiGatewayProperties.Channel(); + channel.setChannelNo("000000"); + channel.setAppNo("111111"); + properties.setChannel(channel); + + ScfsApiGatewayProperties.Cipher cipher = new ScfsApiGatewayProperties.Cipher(); + cipher.setStoreType(StoreType.RESOURCES); + cipher.setChannelPrivateKey("rsa_channel_private_key.pem"); + cipher.setChannelCertificateSerial("xxxxxx"); + cipher.setCertificate(Lists.list("rsa_channel_certificate.pem")); + properties.setCipher(cipher); + + properties.setOnline(true); + properties.setHost("http://127.0.0.1"); + return properties; + } + + @Test + void getProperties() { + rsaConfiguration = new RsaConfiguration(properties()); + ScfsApiGatewayProperties properties = rsaConfiguration.getProperties(); + Assertions.assertNotNull(properties); + } + + @Test + void smProfile() { + rsaConfiguration = new RsaConfiguration(properties()); + RsaProfile profile = rsaConfiguration.rsaProfile(); + Assertions.assertNotNull(profile); + assertThatJson("{\"channelNo\":\"000000\",\"appNo\":\"111111\"}").isEqualTo(profile.getChannel()); + assertThatJson("{\"host\":\"http://127.0.0.1\",\"connPool\":{\"maxRequests\":100,\"maxRequestPerHost\":100,\"connectTimeout\":100,\"socketTimeout\":100},\"headers\":{\"aa\":\"123456\"},\"proxy\":{\"enabled\":true,\"host\":\"128.0.0.1\",\"port\":\"1000\",\"username\":\"name\",\"password\":\"123456\",\"scheme\":\"https\"}}\n") + .isEqualTo(profile.getHttpProfile()); + } +} \ No newline at end of file diff --git a/scfs-api-spring-boot-starter/src/test/java/com/czcb/scfs/spring/boot/starter/ScfsAutoConfigurationTest.java b/scfs-api-spring-boot-starter/src/test/java/com/czcb/scfs/spring/boot/starter/ScfsAutoConfigurationTest.java new file mode 100644 index 0000000..dec8e94 --- /dev/null +++ b/scfs-api-spring-boot-starter/src/test/java/com/czcb/scfs/spring/boot/starter/ScfsAutoConfigurationTest.java @@ -0,0 +1,129 @@ +package com.czcb.scfs.spring.boot.starter; + +import com.czcb.scfs.api.core.ApiClient; +import com.czcb.scfs.api.core.cipher.StoreType; +import com.czcb.scfs.api.core.http.LogLevel; +import com.czcb.scfs.api.core.http.client.ApacheHttpclient; +import org.apache.hc.client5.http.impl.classic.HttpClients; +import org.assertj.core.util.Lists; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.junit.jupiter.MockitoExtension; + +import java.util.HashMap; +import java.util.Map; + +@ExtendWith(MockitoExtension.class) +class ScfsAutoConfigurationTest { + private final ScfsAutoConfiguration configuration = new ScfsAutoConfiguration(); + + private ScfsApiGatewayProperties properties() { + ScfsApiGatewayProperties properties = new ScfsApiGatewayProperties(); + + ScfsApiGatewayProperties.Httpclient httpclient = new ScfsApiGatewayProperties.Httpclient(); + Map headers = new HashMap<>(); + headers.put("aa", "123456"); + httpclient.setHeaders(headers); + + ScfsApiGatewayProperties.Httpclient.Proxy proxy = new ScfsApiGatewayProperties.Httpclient.Proxy(); + proxy.setEnabled(true); + proxy.setHost("128.0.0.1"); + proxy.setPort("1000"); + proxy.setUsername("name"); + proxy.setPassword("123456"); + proxy.setScheme("https"); + httpclient.setProxy(proxy); + + ScfsApiGatewayProperties.Httpclient.ConnPool connPool = new ScfsApiGatewayProperties.Httpclient.ConnPool(); + connPool.setMaxRequests(100); + connPool.setMaxRequestPerHost(100); + connPool.setConnectTimeout(100); + connPool.setSocketTimeout(100); + httpclient.setConnPool(connPool); + httpclient.setCompressionEnabled(false); + httpclient.setLogLevel(LogLevel.basic); + properties.setHttpclient(httpclient); + + ScfsApiGatewayProperties.Channel channel = new ScfsApiGatewayProperties.Channel(); + channel.setChannelNo("000000"); + channel.setAppNo("111111"); + properties.setChannel(channel); + + ScfsApiGatewayProperties.Cipher cipher = new ScfsApiGatewayProperties.Cipher(); + cipher.setStoreType(StoreType.RESOURCES); + cipher.setChannelPrivateKey("sm2_private_key.pem"); + cipher.setChannelCertificateSerial("xxxxxx"); + cipher.setCertificate(Lists.list("scfs_sm2_certificate.pem")); + properties.setCipher(cipher); + + properties.setOnline(true); + properties.setHost("http://127.0.0.1"); + return properties; + } + + protected ApiClient apiClient() { + SmConfiguration smConfiguration = new SmConfiguration(properties()); + return new ApacheHttpclient(HttpClients.custom().build(), smConfiguration.smProfile()); + } + + @Test + void echoService() { + Assertions.assertNotNull(configuration.echoService(apiClient())); + } + + @Test + void accountService() { + Assertions.assertNotNull(configuration.accountService(apiClient())); + } + + @Test + void billService() { + Assertions.assertNotNull(configuration.billService(apiClient())); + } + + @Test + void bmdService() { + Assertions.assertNotNull(configuration.bmdService(apiClient())); + } + + @Test + void communalDataService() { + Assertions.assertNotNull(configuration.communalDataService(apiClient())); + } + + @Test + void faceService() { + Assertions.assertNotNull(configuration.faceService(apiClient())); + } + + @Test + void fileService() { + Assertions.assertNotNull(configuration.fileService(apiClient())); + } + + @Test + void loanService() { + Assertions.assertNotNull(configuration.loanService(apiClient())); + } + + @Test + void ocrService() { + Assertions.assertNotNull(configuration.ocrService(apiClient())); + } + + @Test + void payService() { + Assertions.assertNotNull(configuration.payService(apiClient())); + } + + @Test + void smsService() { + Assertions.assertNotNull(configuration.smsService(apiClient())); + } + + @Test + void transService() { + Assertions.assertNotNull(configuration.transService(apiClient())); + } +} \ No newline at end of file diff --git a/scfs-api-spring-boot-starter/src/test/java/com/czcb/scfs/spring/boot/starter/SmConfigurationTest.java b/scfs-api-spring-boot-starter/src/test/java/com/czcb/scfs/spring/boot/starter/SmConfigurationTest.java index 6894339..ba16c1d 100644 --- a/scfs-api-spring-boot-starter/src/test/java/com/czcb/scfs/spring/boot/starter/SmConfigurationTest.java +++ b/scfs-api-spring-boot-starter/src/test/java/com/czcb/scfs/spring/boot/starter/SmConfigurationTest.java @@ -2,21 +2,21 @@ package com.czcb.scfs.spring.boot.starter; import com.czcb.scfs.api.core.cipher.StoreType; import com.czcb.scfs.api.core.http.LogLevel; +import com.czcb.scfs.api.sm.SmProfile; import org.assertj.core.util.Lists; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; -import org.mockito.Mock; -import org.mockito.Mockito; import org.mockito.junit.jupiter.MockitoExtension; import java.util.HashMap; import java.util.Map; +import static net.javacrumbs.jsonunit.assertj.JsonAssertions.assertThatJson; + @ExtendWith(MockitoExtension.class) class SmConfigurationTest { - @Mock private SmConfiguration smConfiguration; private ScfsApiGatewayProperties properties() { @@ -53,9 +53,9 @@ class SmConfigurationTest { ScfsApiGatewayProperties.Cipher cipher = new ScfsApiGatewayProperties.Cipher(); cipher.setStoreType(StoreType.RESOURCES); - cipher.setChannelPrivateKey("/home/key.pem"); - cipher.setChannelCertificateSerial("/home/c1.pem"); - cipher.setCertificate(Lists.list("/home/c2.pem")); + cipher.setChannelPrivateKey("sm2_private_key.pem"); + cipher.setChannelCertificateSerial("xxxxxx"); + cipher.setCertificate(Lists.list("scfs_sm2_certificate.pem")); properties.setCipher(cipher); properties.setOnline(true); @@ -65,23 +65,18 @@ class SmConfigurationTest { @Test void getProperties() { - Mockito.when(smConfiguration.getProperties()).thenReturn(properties()); + smConfiguration = new SmConfiguration(properties()); ScfsApiGatewayProperties properties = smConfiguration.getProperties(); Assertions.assertNotNull(properties); } -// @Test -// void smProfile() { -// Mockito.when(smConfiguration.getProperties()).thenReturn(properties()); -// Mockito.when(smConfiguration.smProfile()).thenReturn(new SmConfiguration().smProfile()); -// Mockito.when(smConfiguration.getChannel()).thenReturn(new SmConfiguration().getChannel()); -// SmProfile smProfile = smConfiguration.smProfile(); -// Assertions.assertNotNull(smProfile); -// assertThatJson("{\"channelNo\":\"000000\",\"appNo\":\"111111\"}").isEqualTo(smProfile.getChannel()); -// assertThatJson("{\"logEnabled\":false,\"compressionEnabled\":false," + -// "\"connPool\":{\"maxRequests\":100,\"maxRequestPerHost\":100,\"connectTimeout\":100,\"socketTimeout\":100}," + -// "\"proxy\":{\"enabled\":true,\"host\":\"128.0.0.1\",\"port\":\"1000\",\"username\":\"name\",\"password\":\"123456\",\"scheme\":\"https\"}," + -// "\"headers\":{\"aa\":\"123456\"}}") -// .isEqualTo(smProfile.getHttpProfile()); -// } + @Test + void smProfile() { + smConfiguration = new SmConfiguration(properties()); + SmProfile smProfile = smConfiguration.smProfile(); + Assertions.assertNotNull(smProfile); + assertThatJson("{\"channelNo\":\"000000\",\"appNo\":\"111111\"}").isEqualTo(smProfile.getChannel()); + assertThatJson("{\"host\":\"http://127.0.0.1\",\"connPool\":{\"maxRequests\":100,\"maxRequestPerHost\":100,\"connectTimeout\":100,\"socketTimeout\":100},\"headers\":{\"aa\":\"123456\"},\"proxy\":{\"enabled\":true,\"host\":\"128.0.0.1\",\"port\":\"1000\",\"username\":\"name\",\"password\":\"123456\",\"scheme\":\"https\"}}\n") + .isEqualTo(smProfile.getHttpProfile()); + } } \ No newline at end of file diff --git a/scfs-api-spring-boot-starter/src/test/resources/invalid_rsa_certificate.pem b/scfs-api-spring-boot-starter/src/test/resources/invalid_rsa_certificate.pem new file mode 100644 index 0000000..378e3b8 --- /dev/null +++ b/scfs-api-spring-boot-starter/src/test/resources/invalid_rsa_certificate.pem @@ -0,0 +1,18 @@ +-----BEGIN CERTIFICATE----- +MIIDeTCCAmGgAwIBAgIhAII88+MQ8uLtGvhVBudKldxDAQBv3vL9AZlT+vTeEqi/MA0GCSqGSIb3 +DQEBCwUAMIGNMQswCQYDVQQGEwJDTjESMBAGA1UECAwJ5rWZ5rGf55yBMRIwEAYDVQQHDAnmna3l +t57luIIxITAfBgNVBAoMGOa1meaxn+eooOW3nuWVhuS4mumTtuihjDEYMBYGA1UECwwP5pWw5a2X +6YeR6J6N6YOoMRkwFwYDVQQDDBBzY2ZzLmN6Y2IuY29tLmNuMB4XDTIzMDYxODA5MDczMVoXDTI0 +MDYxODA5MDczMVowUjELMAkGA1UEBhMCQ04xEjAQBgNVBAgMCea1meaxn+ecgTESMBAGA1UEBwwJ +5p2t5bee5biCMRswGQYDVQQKDBLnqKDlt57llYbkuJrpk7booYwwggEiMA0GCSqGSIb3DQEBAQUA +A4IBDwAwggEKAoIBAQCfHOgnUYbFi780EX9xQTdWPvCyBhaEnU5Y2p1bW4dHoumgEtjQOkLlRe3U +g1lu6TfhuE9YOQ9+V+Dsnzt7MXIRI7KlOuwpfwXn3e/MYP5ZtDBUiuSGNNVSP39wgb6aYXhvFY/L +m9gaO8Q4rauzK94Clw4sH3a7J6ST50xHss8VjSVFUkcPhpH+OJBTUrXWiccZCn01XDz0vmq6J3Au +jM55WBEmoz2r9iiVdCjZsgB4veQIpCKuMvJsEXVgRzULUnaqdX+7BTDBs30kCGyyBarR+wXLAKNQ +1nENFs1IGM99I+O8UsD6CvUnt2t7l3B8/qIlOSfds8x+BoUxQwhmUaMjAgMBAAEwDQYJKoZIhvcN +AQELBQADggEBACRCHOYH8ncOiYjMm3As7OFdnVDuGByMoZsDucqwrs0mJZVdp3OMgvGhC9zkzdZX +sJFKQeIRp/13cD1SKxtwfU7w4J+/FWpWPEG9Jf2bLqurYivu0tTa1xe5SDL4unNaj/o7BA0vaKJe +gagyULAilNCGBCfy59BSR/GQbgAC6pdl3soMx/s1c9BcZVplbq12/rmStGce6h3QqNjwpRMowbVW +XswXhr08AUevF7UriDjHkCsa6MqQ5x+ShV9qO1f2LDYBQRnM2Ty44EV5eUbHyKOJAYF+WqT6IRiA +2sMZrKRTHaNZB4j0Vc87HuxDtTNh/EEXU2sO31WZHs3ymAChbC4= +-----END CERTIFICATE----- \ No newline at end of file diff --git a/scfs-api-spring-boot-starter/src/test/resources/invalid_rsa_private_key.pem b/scfs-api-spring-boot-starter/src/test/resources/invalid_rsa_private_key.pem new file mode 100644 index 0000000..18b2861 --- /dev/null +++ b/scfs-api-spring-boot-starter/src/test/resources/invalid_rsa_private_key.pem @@ -0,0 +1,24 @@ +-----BEGIN PRIVATE KEY----- +MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCfHOgnUYbFi780EX9xQTdWPvCy +BhaEnU5Y2p1bW4dHoumgEtjQOkLlRe3Ug1lu6TfhuE9YOQ9+V+Dsnzt7MXIRI7KlOuwpfwXn3e/M +YP5ZtDBUiuSGNNVSP39wgb6aYXhvFY/Lm9gaO8Q4rauzK94Clw4sH3a7J6ST50xHss8VjSVFUkcP +hpH+OJBTUrXWiccZCn01XDz0vmq6J3AujM55WBEmoz2r9iiVdCjZsgB4veQIpCKuMvJsEXVgRzUL +UnaqdX+7BTDBs30kCGyyBarR+wXLAKNQ1nENFs1IGM99I+O8UsD6CvUnt2t7l3B8/qIlOSfds8x+ +BoUxQwhmUaMjAgMBAAECggEAQ+meKz4QdJvnse0wBKKN4Hl/2bRggxzzVliFJnvEG27tIb45nXLo +n5x/3R9tGjpf+C9namP8eXQ/1C9Iv5XEto0SkJS8PR/y4NspIYZaueX/ZO5diOzfCjqBBf/S32jv +8xX0aLbtf5D3+SsjaJe2LEvWKD4Luuk6RUjJlaa73dnSuGFSuvYV8MvFdHtfU8L8ZRoqZwmM9QTg ++Gpix4z6Hy/Mmi1xRl0EhIITq+mV9wR9Ock/0o12nvsNDyDSyrrt3niXTTkVCbct+t4UFwtnrZyH +dwl1OQ+WleTkUQY+wNgpq4jLjwGowXnqXlKff3tvXEt+3tpdOS8i+kXYwIrvIQKBgQDVnldDo2iq +TwLcZjXbreHskn/4hvWYUPqucEZ93jmyYNKUKPlXkVnc+kXnS0uuM5JZpi/7+FDkTqwHK83ET4/n +kTC9zM+K7KyIBbljclPjzXYJAW7nwD8A/vKx6CWi++f4buYc+lttsTprdAZ4/kWPTnvNJSjhSTAR +SQ32HxkiIQKBgQC+rjujW31WN4d2j48+K0B+7bIQON+VtmBZ48u2ZIQOi4PdoBvHv8HqQyhJlR+6 +z49k5WczSqAXdG2+nIgs8fpjj0lc7YiMIYs0VsLodOToH9J2MfXjWi+A4Y2vbfcjfUuCWhKSZs6B +eMLNe1LPIBDmlT3A1X83qkCpvAYYQWAkwwKBgFVtslZRZk0dtfYwRf+phT1XxSe9yT/1uprCOd6i +XY6RnAU2cajsbvSpfgUmnoh3BWMmy+/HeYokUDW59ds5OkKQVN7CpolXZxQqvd4gXZ4vj7HASfsS +bd/XFXXCcjLA7R70MsCJ+sBebQ+F4gTHI0hRSb9bygJ2g2uWPKgd/a4hAoGABCtZIHxKpEz4iE4h +SrG1alEWOKaVtPdU6gJCHQ3bmVnRm1H56Yc23UF0qw84r2QEdadSd1ulXn3sPGO90oXD/NNQPljv +SGkfWxiekGil7LFtb6ot/zeknEPSTkiwQ7VkpkgD6fGXiFs0nzuYFvFTjUcsH4BLlNMDMPLsizE6 +wfMCgYANvw4Lq1cVfHAl3f6IZlpWHPFEEJbPcBLu9+qtUlZjleCaWA8WXuiBxkqaIkeVi3JMst34 +adfIfBsAk4FeyLpkiTYNjOckZvXFXYKA3a05l/RJ5rsnnI9GRh+3Gk3V+87OU7HwMU6jNZmQiPIO +/jerEvZ9A5tbuzKkfJj2F0ZXfw== +-----END PRIVATE KEY----- \ No newline at end of file diff --git a/scfs-api-spring-boot-starter/src/test/resources/invalid_sm2_certificate.pem b/scfs-api-spring-boot-starter/src/test/resources/invalid_sm2_certificate.pem new file mode 100644 index 0000000..beb4bd8 --- /dev/null +++ b/scfs-api-spring-boot-starter/src/test/resources/invalid_sm2_certificate.pem @@ -0,0 +1,11 @@ +-----BEGIN CERTIFICATE----- +MIIB7jCCAZOgAwIBAgIhALdtngtzF/RUeMwmUCBIxE9gKqg6JyTI/0AIb7owcUCnMAoGCCqBHM9V +AYN1MIGNMQswCQYDVQQGEwJDTjESMBAGA1UECAwJ5rWZ5rGf55yBMRIwEAYDVQQHDAnmna3lt57l +uIIxITAfBgNVBAoMGOa1meaxn+eooOW3nuWVhuS4mumTtuihjDEYMBYGA1UECwwP5pWw5a2X6YeR +6J6N6YOoMRkwFwYDVQQDDBBzY2ZzLmN6Y2IuY29tLmNuMB4XDTIzMDYxODEwMTE0N1oXDTI0MDYx +ODEwMTE0N1owUjELMAkGA1UEBhMCQ04xEjAQBgNVBAgMCea1meaxn+ecgTESMBAGA1UEBwwJ5p2t +5bee5biCMRswGQYDVQQKDBLnqKDlt57llYbkuJrpk7booYwwWTATBgcqhkjOPQIBBggqgRzPVQGC +LQNCAATgVojRcvIdy12MIpdBfrwkbSDROpyggvGs4KkZj7FQ4dfZjG9U/IemckKOiB1rziBmvMZ+ +xcNHM2f7sc4vnNGbMAoGCCqBHM9VAYN1A0kAMEYCIQDMYfauQRljajUQjQP8mhVxmCbpt8ttwmJ+ +tZaY3nYUdAIhAPBxzw9sBktnnfs0OL5JWoD/gtl7Q47DFozB1y7Lg/0D +-----END CERTIFICATE----- \ No newline at end of file diff --git a/scfs-api-spring-boot-starter/src/test/resources/invalid_sm2_private_key.pem b/scfs-api-spring-boot-starter/src/test/resources/invalid_sm2_private_key.pem new file mode 100644 index 0000000..564326b --- /dev/null +++ b/scfs-api-spring-boot-starter/src/test/resources/invalid_sm2_private_key.pem @@ -0,0 +1,5 @@ +-----BEGIN PRIVATE KEY----- +MIGTAgEAMBMGByqGSM49AgEGCCqBHM9VAYItBHkwdwIBAQQgGAiYfS2SFBIImE3m/aYxU8hrIGtb +YMYJOG52CVAj6NmgCgYIKoEcz1UBgi2hRANCAATgVojRcvIdy12MIpdBfrwkbSDROpyggvGs4KkZ +j7FQ4dfZjG9U/IemckKOiB1rziBmvMZ+xcNHM2f7sc4vnNGb +-----END PRIVATE KEY----- \ No newline at end of file diff --git a/scfs-api-spring-boot-starter/src/test/resources/rsa_channel_certificate.pem b/scfs-api-spring-boot-starter/src/test/resources/rsa_channel_certificate.pem new file mode 100644 index 0000000..cd40614 --- /dev/null +++ b/scfs-api-spring-boot-starter/src/test/resources/rsa_channel_certificate.pem @@ -0,0 +1,23 @@ +-----BEGIN CERTIFICATE----- +MIIDyzCCArOgAwIBAgIUBs3aqSytdZmDJQJ2R4RzMMF1YpEwDQYJKoZIhvcNAQEL +BQAwgY0xCzAJBgNVBAYTAkNOMRIwEAYDVQQIDAnmtZnmsZ/nnIExEjAQBgNVBAcM +CeadreW3nuW4gjEhMB8GA1UECgwY5rWZ5rGf56ig5bee5ZWG5Lia6ZO26KGMMRgw +FgYDVQQLDA/mlbDlrZfph5Hono3pg6gxGTAXBgNVBAMMEHNjZnMuY3pjYi5jb20u +Y24wHhcNMjQwMjEzMDk1MjQwWhcNMzQwMjEwMDk1MjQwWjCBjTELMAkGA1UEBhMC +Q04xEjAQBgNVBAgMCea1meaxn+ecgTESMBAGA1UEBwwJ5p2t5bee5biCMSEwHwYD +VQQKDBjmtZnmsZ/nqKDlt57llYbkuJrpk7booYwxGDAWBgNVBAsMD+aVsOWtl+mH +keiejemDqDEZMBcGA1UEAwwQc2Nmcy5jemNiLmNvbS5jbjCCASIwDQYJKoZIhvcN +AQEBBQADggEPADCCAQoCggEBAMPBs6aV43hfpgOJNSTm24WGGolgYh1IFvvHXgTk +4J3/ZQjHHyX+0XXrasCU95iq4czfiaLUdrQCdr3q20w0wMzKrdMFTGrufwfSktTx +9ugKitTzejBGPgSqt+Tu0bRwyB5SathtpNc8Pl2VG8p2kXE3VQ1Fq/6ZhRvU4/Gg +e4lHGh5EYCb9FYLWdOP1Rh4BBAp6FvkWFYPdQEsLGTSJeA+t/KSRkN4t5Qj18D53 +MQOescObP6O319Ce6ndFWS7v+fUNBDII5QM6fbg0Z8FdyIN6K8nf9tnVInLm3/ge +7obKrIkqo/c571QBuRtlY6ci7XzpHp7s0GTmf/4eAN/XsIsCAwEAAaMhMB8wHQYD +VR0OBBYEFPxZwIS1s2a+59+F4mEvMwf01exmMA0GCSqGSIb3DQEBCwUAA4IBAQBE +5FuyVUFm4hRxsO8Jl412lxEvtMtgB3QT0mj0+SWVAp/Cb7Jh3yqkszmnx3CC64lB +OzfU8rsQMu+R8NoBEUIO03vD9DhozYE67iUcmzwKil6IwedA8QxzL/UZpbf/1SqC +Vf4/z0a2dZO7ys/WYPJh+bxsiB5UIfmhnNDIKQoOMrFEzkxz6KHpNXQGt0fj7ugd +8HPSkDtYBoCluI9YfWeOazmVAVZxhpLSMi+6NzVwdXjOdKTgxAYMkXIdtPKLiC0z +zycbiBuKN7tL/NtHfpYQ1noakUahMzw1XvUNTs47PIaDgqG+mjZR3hRRKQq3iNHy +pwDwvSima1XX0KnrzLg+ +-----END CERTIFICATE----- diff --git a/scfs-api-spring-boot-starter/src/test/resources/rsa_channel_private_key.pem b/scfs-api-spring-boot-starter/src/test/resources/rsa_channel_private_key.pem new file mode 100644 index 0000000..dd32f7a --- /dev/null +++ b/scfs-api-spring-boot-starter/src/test/resources/rsa_channel_private_key.pem @@ -0,0 +1,28 @@ +-----BEGIN PRIVATE KEY----- +MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDDwbOmleN4X6YD +iTUk5tuFhhqJYGIdSBb7x14E5OCd/2UIxx8l/tF162rAlPeYquHM34mi1Ha0Ana9 +6ttMNMDMyq3TBUxq7n8H0pLU8fboCorU83owRj4Eqrfk7tG0cMgeUmrYbaTXPD5d +lRvKdpFxN1UNRav+mYUb1OPxoHuJRxoeRGAm/RWC1nTj9UYeAQQKehb5FhWD3UBL +Cxk0iXgPrfykkZDeLeUI9fA+dzEDnrHDmz+jt9fQnup3RVku7/n1DQQyCOUDOn24 +NGfBXciDeivJ3/bZ1SJy5t/4Hu6GyqyJKqP3Oe9UAbkbZWOnIu186R6e7NBk5n/+ +HgDf17CLAgMBAAECggEAOyoOoZEYxHdoJhZwlPwfKe57k7ypOr9gju1VObZxOt+H +Sk1gWSv4Y6Loy1batG4lO7XuE+QSElrSR5k1eYVSJjM1sRsfWwxFIXifvzN4U+5n +wm/qJK/+K4vrc4pIoDgcC6oON+Z/lTvUf5VC5oDKeYTnNFEz6Am/RMelsxA1diob +SNSwPTPijqy0b63IHSWAbB+zmurRZPOSzy5lZ2F+xdYhnF+j9XprP4iJiHydvrgH +RJbxwsiphjgPeqPSVSs5MTQ0zDumRkbMBANk/Y5rCGybBSGpW1BwXZjTp3jtY9Tr +DmXDbzsiZWx/D1wFd0F+BhS6vg3dUkX63mSDOaTvKQKBgQDpLcwdAkhvWbRs03ev +5/BgmgHO2iwJkAL6yyX9wox4NOYe1FInBht5Nc/ZC0mXy5E4Wmd1SGAoYt8R2vxo +LnIyJnRE4iUKWxL87okKCDW4b3AaMTMZXyKmkMgMPDvpk6Odag5Ey2xpojb8TP7q +QtZu5DWTkU2lR+2Z4qH8+DFC2QKBgQDW6k4guiR0ZP7Po1QLQWXwRfQU4WUlxaKp +MEp6hsdKRN2MPbbPqtg4PoBpc1Hpvx2SX3YGAaRIwJtLGuoOq4TnVJ+9SKI5VDqT +YcjE4UZm1DDmm1XYaCJKYeN2Swr2xl2VA6LJpHHZDLXC7YVshZ/53lJhPTbnBpIE +0T+MBCIoAwKBgAtSS+zEpZuycU4vXkpOKp+mGpxef3DfayWeI3QUtBlKCDpK+Moo +Q8E42aSiJaqXGa/ww8EwCGstkcMeLM8qIiVJNK/7guzjyyI4urKf/2u7DWhYJzD+ +K4KG2Q+vBQGsR29nLNYuQk9GrwDFBEN/h0XPEsLddTWnLmQgWtkbe9jRAoGBAIAj +dW+37HJloTPl+v82//ORkeU9OlSaEND1lQKXB431n261gSEyiPaH9YJqGqXWqGgU +eMc+BVjHVhAivPkANR7EavWtr+Okn8QuIkmY06QN0hY8+aMs+30D/l4Sgjf+r99g +Kpg1bxftpxXRDqNUzLxrXQzTNb/rP/aVWGFAOalHAoGAPiW3cKvfTOLIS0PFxGOF +EKQzr/TDGnKJNKeGJ25VOKPnq8RDX/Ik2+hNjdThOWApIgDQo4JtUMCxCDM7lRcu +ne9B/UShSzd8uuZgHZVSFD+pfPJvyVpZ/ORHvrQqUAtveQgk7Cpp2tuvsixbBhdQ +E6ZWsef5uyYdyjLp2C4cl2A= +-----END PRIVATE KEY----- diff --git a/scfs-api-spring-boot-starter/src/test/resources/scfs_sm2_certificate.pem b/scfs-api-spring-boot-starter/src/test/resources/scfs_sm2_certificate.pem new file mode 100644 index 0000000..fa6fb65 --- /dev/null +++ b/scfs-api-spring-boot-starter/src/test/resources/scfs_sm2_certificate.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIICGTCCAcCgAwIBAgIhAPtOPc4Cl0OO05B3H0ZXa5L9fmt/HpvRKn2H6CG1mUjlMAoGCCqBHM9V +AYN1MIGNMQswCQYDVQQGEwJDTjESMBAGA1UECAwJ5rWZ5rGf55yBMRIwEAYDVQQHDAnmna3lt57l +uIIxITAfBgNVBAoMGOa1meaxn+eooOW3nuWVhuS4mumTtuihjDEYMBYGA1UECwwP5pWw5a2X6YeR +6J6N6YOoMRkwFwYDVQQDDBBzY2ZzLmN6Y2IuY29tLmNuMB4XDTI0MDMyNjA4NDU1MFoXDTI5MDMy +NjA4NDU1MFowfzELMAkGA1UEBhMCQ04xEjAQBgNVBAgMCea1meaxn+ecgTESMBAGA1UEBwwJ5p2t +5bee5biCMSEwHwYDVQQKDBjmtZnmsZ/nqKDlt57llYbkuJrpk7booYwxJTAjBgNVBAsMHOaVsOWt +l+mHkeiejemDqC3mtYvor5Xor4HkuaYwWTATBgcqhkjOPQIBBggqgRzPVQGCLQNCAAT0KcBDXLn6 +Zv5vsEtuDzZclr30phN++uOVaQoFcDhhbeZlqRSIqRdg6YstCHUenN7NL2S1b1JlsWeIUxGCndZU +MAoGCCqBHM9VAYN1A0cAMEQCIGp00kvdZqtobJ9X7YHAKBtGZXnXBKeuhdM+ZIhYelwBAiB1Dv0s +0ahzWO+jJ/DVN8zM1b4noePZArFed8qHXsvt+Q== +-----END CERTIFICATE----- \ No newline at end of file diff --git a/scfs-api-spring-boot-starter/src/test/resources/sm2_private_key.pem b/scfs-api-spring-boot-starter/src/test/resources/sm2_private_key.pem new file mode 100644 index 0000000..64ea409 --- /dev/null +++ b/scfs-api-spring-boot-starter/src/test/resources/sm2_private_key.pem @@ -0,0 +1,5 @@ +-----BEGIN PRIVATE KEY----- +MIGTAgEAMBMGByqGSM49AgEGCCqBHM9VAYItBHkwdwIBAQQgmnhieO9Pq+6MhLFfve3N4E4WMbRq +MaIhlgShgDlQPeqgCgYIKoEcz1UBgi2hRANCAATGZG5DywFAZNgP5i83MIL9NJALqqbjeiYUXhFX +JDwADC5ricSL3as4GNrni3iQqH3C2xIiVQg7V0tELKnekigB +-----END PRIVATE KEY----- \ No newline at end of file