在企业环境中使用x509证书签署git commit [英] Sign git commit with x509 certificate in corporate environment

查看:109
本文介绍了在企业环境中使用x509证书签署git commit的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从文档中了解到可以签名git标签和提交。

I have learned from the documentation that it is possible to sign git tags and commits.

git config --global user.signingkey 0A46826A

文档: https://git-scm.com/book/zh/v2/Git-Tools-Signing-Your-Work

这适用于GPG。有人用X509用户证书做了类似的事情吗?

This works for GPG. Has somebody done something like this with X509 user certificates?

GPG与x509 pki证书不兼容或不可互换。由于这是在公司环境中,因此无法选择GPG。

It looks like GPG is not compatible or interchangeable with x509 pki certificates. Since this is in a corporate environment GPG is not a option.

如果有人可以分享想法或经验,那么使用x509证书可以做到这一点将是很棒的?

It would be great if somebody could share thoughts or experiences how this could be done with x509 certs? What would be required and what it takes to implement something like this?

推荐答案

使用Git 2.19(2018年第三季度)应该更容易些? ,因为 git标签-s 等现在具有一些配置变量( gpg.format openpgp x509 以及 gpg。< format> .program ,用于指定要使用哪种程序来处理格式),以允许通过 gpgsm 使用带有CMS的x.509证书而不是通过$ gnupg 打开
openpgp。

That should be easier with Git 2.19 (Q3 2018), since "git tag -s" etc. now have a few configuration variables (gpg.format that can be set to "openpgp" or "x509", and gpg.<format>.program that is used to specify what program to use to deal with the format) to allow x.509 certs with CMS via "gpgsm" to be used instead of openpgp via "gnupg".

请参见提交53fc999 (2018年7月20日),提交1e7adb9 提交42149d7 提交58af57e 提交57a8dd7 ( 2018年7月17日)和提交1865a64 (2018年7月18日)由 Henning Schild( henning-schild

(由 Junio C Hamano合并- gitster - -提交3ec5ebe ,2018年8月15日)

See commit 53fc999 (20 Jul 2018), commit 1e7adb9, commit b02f51b, commit 42149d7, commit 58af57e, commit 57a8dd7 (17 Jul 2018), and commit 1865a64 (18 Jul 2018) by Henning Schild (henning-schild).
(Merged by Junio C Hamano -- gitster -- in commit 3ec5ebe, 15 Aug 2018)

涉及更改li ke:


gpg-interface :添加新配置以选择如何签名commit



添加 gpg.format ,用户可以在其中指定
使用哪种签名类型

gpg-interface: add new config to select how to sign a commit

Add "gpg.format" where the user can specify which type of signature to use for commits.

创建一个结构,该结构保存受支持格式的格式详细信息。

此提交为引入更多可能会使用其他程序并匹配其他签名的格式做准备。

Create a struct that holds the format details for the supported formats.
This commit prepares for the introduction of more formats, that might use other programs and match other signatures.

gnupg 的确会打印keyid,后跟一个空格,然后是签名者。
gpgsm 中也使用了相同的模式,但是密钥长度为40而不是16。

gnupg does print the keyid followed by a space and the signer comes next. The same pattern is also used in gpgsm, but there the key length would be 40 instead of 16.

不是硬编码期望的长度,而是找到第一个空格并进行计算。

与跳转的格式不匹配的输入现在将被忽略,然后我们跳转到found + 17,可能是后面的

Instead of hardcoding the expected length, find the first space and calculate it.
Input that does not match the expected format will be ignored now, before we jumped to found+17 which might have been behind the end of an unexpected string.

这篇关于在企业环境中使用x509证书签署git commit的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆