我需要知道是否可以使用RSA,证书和那些东西进行数字签名,或者是否只能签署某种文件.所有这些,使用PHP.
例如:纯文本文件可以用数字签名吗?图像怎么样(png,jpeg,bmp)?
我不需要"附加"带有图形签名的图像.
谢谢您的帮助.
我正在使用Maven的Failsafe插件为我的Spring Boot应用程序运行集成测试.当我创建一个简单的测试,例如:
@RunWith (SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(App.class)
public class MyTestIT {
@Test
public void test() {
assertTrue (true);
}
}
Run Code Online (Sandbox Code Playgroud)
然后运行mvn verify我在Spring应用程序启动之前看到以下日志条目(例如,甚至在Spring Boot标题之前):
Running org.....MyTestIT
2016-04-14 13:25:01.166 INFO ???? --- [ main]
or.sp.te.co.su.AbstractContextLoader :
Could not detect default resource locations for test class
[org....MyTestIT]: no resource found for suffixes
{-context.xml, Context.groovy}.
2016-04-14 13:25:01.175 INFO ???? --- [ main]
or.sp.te.co.su.DefaultTestContextBootstrapper :
Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener]
2016-04-14 13:25:01.185 INFO ???? --- [ …Run Code Online (Sandbox Code Playgroud) 我使用Spring MVC实现了简单的REST服务.我决定用Springfox和Swagger 2.0来描述它们.在我开始添加安全模式和上下文之前,一切似乎都没问题.我对某些端点使用HTTP基本身份验证,对其他端点使用基于令牌的身份验证.无论我做什么,我都看不到任何设置HTTP Basic身份验证凭据或在Swagger UI中指定令牌的选项.以下是我的配置.为简单起见,我在这里将两个模式应用于所有端点.
@Configuration
@EnableSwagger2
public class SwaggerConfig {
@Bean
public Docket apiV1() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.any())
.paths(PathSelectors.any())
.build()
.pathMapping("/api/v1")
.securitySchemes(newArrayList(new BasicAuth("xBasic"),
new ApiKey("X-Auth-Token", "xAuthToken", "header")))
.securityContexts(newArrayList(xBasicSecurityContext(), xAuthTokenSecurityContext()))
}
private SecurityContext xBasicSecurityContext() {
SecurityContext.builder()
.securityReferences(newArrayList(new SecurityReference("xBasic",
new AuthorizationScope[0])))
.build()
}
private SecurityContext xAuthTokenSecurityContext() {
SecurityContext.builder()
.securityReferences(newArrayList(new SecurityReference("xAuthToken",
new AuthorizationScope[0])))
.build()
}
Run Code Online (Sandbox Code Playgroud) 上下文:我正在尝试使用内联asm编写一个小型C程序,该程序应该在x86_64系统上的Linux下运行并使用gcc编译,以便更好地理解系统调用在Linux下的工作方式.
我的问题是:在这种环境中,如何从系统调用(例如写入)返回错误号码?我知道当我使用像glibc这样的库时,它会将结果错误代码保存在全局errno变量中.但是当我直接通过内联汇编程序调用系统调用时,存储的错误号在哪里?它会存储在一个单独的寄存器中,还是会被编码%rax?
我们以linux上的write syscall为例:
当write在syscall返回后调用时我发现它存储0xfffffffffffffff2在里面%rax,我是否需要以某种方式从中提取错误代码?
如果我有错误代码编号,我应该在哪里找出发生的实际错误?让我说我得到了返回的数字5,我需要咨询哪个头文件以找到相应的符号错误名称.
我正在调用这样的写系统调用:
asm ("mov $1,%%rax;"
"mov $1,%%rdi;"
"mov %1,%%rsi;"
"mov %2,%%rdx;"
"syscall;"
"mov %%rax,%0;"
: "=r" (result)
: "r" (msg), "r" (len)
: "%rdx", "%rsi", "%rax", "%rdi" /* EDIT: this is needed or else the registers will be overwritten */
);
Run Code Online (Sandbox Code Playgroud)
用result,msg并len定义如下:
long result = 0;
char* msg = "Hello World\n";
long len = 12;
Run Code Online (Sandbox Code Playgroud) 使用Autotools时,通常config.h通过如下指定AC_CONFIG_HEADERS宏来生成文件configure.ac:
AC_CONFIG_HEADERS([config.h])
Run Code Online (Sandbox Code Playgroud)
使用CMake时,相应的等价物是什么?
Spring Boot 附带了几个默认的日志框架配置,包括 Log4j2。虽然 Spring boot 参考手册中有关于日志记录的详细文档,但它没有提及默认日志模式的具体配置方式和位置,这使得很难覆盖它。
问题是 Spring Boot 在哪里配置 Log4j2 的默认日志模式?
到目前为止,我已经查看了 Spring Boot 的以下位置:
AutoConfigurationReportLoggingInitializer
LoggingApplicationListener
SimpleFormatter
LoggingSystem
Log4J2LoggingSystem
Run Code Online (Sandbox Code Playgroud) 在Tomcat的文档中,有关定义上下文的部分列出了以下用于定义上下文的选项:
$CATALINA_BASE/conf/[enginename]/[hostname]/。上下文路径和版本将从文件的基本名称(文件名减去.xml扩展名)派生。该文件将始终优先于Web应用程序的META-INF目录中打包的任何context.xml文件。选项1不好,因为这意味着必须对应用程序工件内部的值进行硬编码,并且不能轻易更改它们。
文档积极建议不使用选项3:
不建议将元素直接放置在server.xml文件中。
这仅给我们留下了选项2,特别是如果我们想以不同的配置多次部署同一应用程序(例如,一个用于生产,一个用于测试),则这是唯一的选择。
但是,文档没有说明什么,应该是什么[enginename]或[hostname]默认设置。
这些的默认值是什么,我可以在哪里更改它们?
我正在使用Jenkins与Pipelines并使用a 定义了一个脚本化管道Jenkinsfile.它看起来像这样:
node {
/* some stages */
}
Run Code Online (Sandbox Code Playgroud)
我已将Jenkins附带的GDSL文件导入IntelliJ.现在我得到了语法高亮,但整个文件在一个警告块中突出显示,IntelliJ显示以下消息:
'node' cannot be applied to '(groovy.lang.closure<Object>)'
Run Code Online (Sandbox Code Playgroud)
我认为可能是语法定义不支持节点对象,但如果我尝试以pipelineroot 身份写入,则会出现相同的警告.
我已经使用 Swagger API 文档配置了一个 Spring Boot 应用程序并配置了 Swagger UI。
我还在一个反向代理后面运行我的后端应用程序,该代理将所有请求映射host:port/api到backend_host:port/,当我在本地本地运行时映射到localhost:8082/api。在生产中应用了类似的映射。
当我从中打开 Swagger UI 时,localhost:8082/api/swagger-ui.html它会在标题下方显示以下几行:
[ 基本 URL: localhost:8080 ]
http://localhost:8082/api/v2/api-docs
当我调用任何休息操作时,swagger 总是尝试针对 localhost:8080 执行它,然后由于相同的来源策略而失败。
我知道使用pathProvider但它只影响基本 URL 的路径部分,而不影响域和端口。所以我只能使用它来将基本 URL 更改为 localhost:8080/api 但我需要将其更改为 localhost:8082/api。有没有办法将主机动态设置为浏览器中活动的当前主机和端口?
.pathProvider (new RelativePathProvider (servletContext) {
@Override
public String getApplicationBasePath() {
return "/api";
}
})
Run Code Online (Sandbox Code Playgroud) 我有一个 dotnet 项目,已packages.lock.json提交到我的 Nuget 存储库中。提交的版本有一个依赖属性,如下所示:
dependencies: {
...
"MQTTnet": "3.0.15",
...
}
Run Code Online (Sandbox Code Playgroud)
当我使用 Rider IDE(来自 Jetbrains)打开项目时,Nuget 似乎在后台自动运行,并将版本更改为使用此范围语法:
dependencies: {
"MQTTnet": "[3.0.15, )",
...
}
Run Code Online (Sandbox Code Playgroud)
当我检查锁定文件时,我可以看到某些版本正在使用范围,而其他版本似乎使用特定版本。我想避免锁定文件中的随机更改,除非我明确决定更新我的包依赖项,并且当我更新时,我希望对何时使用范围与特定版本有更多的控制。
我如何理解这些变化发生的原因以及导致这些变化的原因?
java ×2
spring-boot ×2
springfox ×2
swagger-ui ×2
.net-core ×1
autotools ×1
c ×1
cmake ×1
file ×1
groovy ×1
jenkins ×1
linux ×1
log4j2 ×1
nuget ×1
php ×1
rsa ×1
spring ×1
spring-mvc ×1
spring-test ×1
swagger-2.0 ×1
system-calls ×1
tomcat ×1