如果我理解正确的话,数字签名意味着明确地发送消息以及使用私钥加密的消息的散列.
消息的接收者计算散列,使用公钥解密接收的散列,然后比较两个散列的匹配.
这有多安全?我的意思是,您可以轻松获取消息的哈希值,并且还具有加密的哈希值.查找用于创建Encrypted_hash的私钥有多容易?
例:
Message Hash Encrypted_hash
-----------------------------------------
Hello world! 1234 abcd
Hi there 5678 xyzt
Bla bla 0987 gsdj
...
Run Code Online (Sandbox Code Playgroud)
鉴于Hash和Encrypted_hash值以及足够的这些消息,找到私钥有多容易/多难?
是否可以通过电缆(USB)连接将iPhone的签名转换为.xls文件?
在Java中,我尝试使用充气城堡和本规范中的证书签署一个byte [](这是我的文档的sha256摘要):
在第14.1.4.1.1节数字签名生成中.
我在bouncy的java doc中找到了这个方法:
public static byte[] signer(byte[] datas, Certificat cert) {
try {
List<X509Certificate> certList = new ArrayList<X509Certificate>();
CMSTypedData msg = new CMSProcessableByteArray(datas);
certList.add(cert.getCertificat());
Store certs = new JcaCertStore(certList);
CMSSignedDataGenerator gen = new CMSSignedDataGenerator();
ContentSigner sha256signer = new JcaContentSignerBuilder(
"SHA256withRSA").setProvider("BC").build(
cert.getPrivateKey());
gen.addSignerInfoGenerator(new JcaSignerInfoGeneratorBuilder(
new JcaDigestCalculatorProviderBuilder().setProvider("BC")
.build()).build(sha256signer, cert.getCertificat()));
gen.addCertificates(certs);
CMSSignedData sigData = gen.generate(msg, true);
return sigData.getEncoded();
}
catch (Exception e) {
throw new RuntimeException(
"Erreur lors de la signature du document", e);
}
Run Code Online (Sandbox Code Playgroud)
我不知道这个签名是否真的符合规范要求的PKCS#1 1.5.我是否必须手动添加填充?和RSA256的OID?
我很好奇,通过谷歌研究,我一直在学习数字签名和强烈命名的程序集.如果您真的努力,似乎可以使用数字签名来签署强名称的程序集.
我推测,通过这种做法,可以通过这种方式使用它来规避数字签名的目的.
微软说:
"强名称本身并不意味着一种信任程度,例如通过数字签名和支持证书提供的信任."
- http://msdn.microsoft.com/en-us/library/wd40t7ad%28v=vs.110%29.aspx
我是否正确地猜测以这种方式使用数字签名实际上是一种不好的做法,这可能会造成安全漏洞并且绝对没有用处?或者甚至可能吗?使用数字签名作为强名称可能或更好然后什么都不做?除了正确使用数字签名之外,它是否提供了额外的安全性.
我正在签署一个.dmg包含.app有效开发者ID配置文件的人.一切都签署,包括框架.当我运行时codesign -dvvv,会显示正确的证书satisfies its Designated Requirement.应用运行正常.
但是,当我上传和下载时.dmg,签名"消失".当我跑步时codesign -dvvv,它说code object is not signed at all.并且GateKeeper自然拒绝运行该应用程序.
注意:这听起来很像这个问题,但我肯定会使用正确的开发者身份证书签名,并且.dmg不会出现"损坏".
我有这种情况.
我有一个生成PDF的应用程序,需要签名.
我们没有签署文档的证书,因为它们在HSM中,我们使用证书的唯一方法是使用Web服务.
此Web服务提供两个选项,发送PDF文档,并返回已签名的pdf,或发送将要签名的哈希.
第一个选项是不可行的,因为PDF没有时间戳签名(这是一个非常重要的必要条件),因此选择了第二个选项.
这是我们的代码,首先,我们得到签名外观,并计算哈希:
PdfReader reader = new PdfReader(Base64.decode(pdfB64));
reader.setAppendable(true);
baos = new ByteArrayOutputStream();
PdfStamper stamper = PdfStamper.createSignature(reader, baos, '\0', null, true);
appearance = stamper.getSignatureAppearance();
appearance.setCrypto(null, chain, null, PdfSignatureAppearance.SELF_SIGNED);
appearance.setVisibleSignature("Representant");
cal = Calendar.getInstance();
PdfDictionary dic = new PdfDictionary();
dic.put(PdfName.TYPE, PdfName.SIG);
dic.put(PdfName.FILTER, PdfName.ADOBE_PPKLITE);
dic.put(PdfName.SUBFILTER, new PdfName("adbe.pkcs7.detached"));
dic.put(PdfName.M, new PdfDate(cal));
appearance.setCryptoDictionary(dic);
HashMap<PdfName, Integer> exc = new HashMap<PdfName, Integer>();
exc.put(PdfName.CONTENTS, Integer.valueOf(reservedSpace.intValue() * 2 + 2));
appearance.setCertificationLevel(1);
appearance.preClose(exc);
AbstractChecksum checksum = JacksumAPI.getChecksumInstance("sha1");
checksum.reset();
checksum.update(Utils.streamToByteArray(appearance.getRangeStream()));
hash = checksum.getByteArray();
Run Code Online (Sandbox Code Playgroud)
在这一点上,我们有文档的哈希码.然后我们将哈希发送到webservice,我们得到签名的哈希码.
最后,我们将签名的哈希值放到PDF中:
byte[] paddedSig = …Run Code Online (Sandbox Code Playgroud) 微软正在远离SHA1.结果,许多可执行文件现在具有两个或更多个签名; 一个使用SHA1摘要以实现向后兼容,另一个使用SHA256.
例如,如果您查看vstest.executionengine.exeVisual Studio 2013的属性(查看Windows 8或Server 2012上的属性),您将看到它有来自3个不同证书的3个不同签名.
我已经有一个使用的组合代码CryptQueryObject,CryptMsgGetParam和.NET SignedCms,但它只能看到3个签名1.一个签名者似乎只有一条消息.
我需要获取所有签名的证书信息.如何对多个签名进行建模 - 是单个消息中的多个消息还是多个签名者?Microsoft是否添加了新的API或新标志来访问多个签名?
我在不使数字签名无效的情况下加盖PDF文档时遇到麻烦。
目前,我已成功将PDF标记。但是,如果文档先前已签名,则签名不再有效。我知道为什么会发生这种情况,但是如果我使用Acrobat添加文本或使用注释对其进行标记,则签名有效。
我尝试添加注释或注释,但它仍然使签名无效。有没有一种方法可以在不使数字签名无效的情况下使用iText将图章添加到PDF ?
这是我用来标记的代码片段:
PdfReader reader = new PdfReader(inputstream);
stamp = new PdfStamper(reader, new FileOutputStream(file));
PdfContentByte pcb;
BaseFont bf = BaseFont.createFont("Courier", BaseFont.CP1250,BaseFont.EMBEDDED);
Rectangle r = reader.getPageSizeWithRotation(1);
pcb = stamp.getOverContent(1);
// set the font and size
float size = 12;
pcb.setFontAndSize(bf, size);
float width = 90;
float centerX = 0, startY = 0;
centerX = r.getWidth() - (width / 2) - 20;
startY = r.getHeight() - (15 * 2) - 145;
pcb.beginText();
pcb.showTextAligned(PdfContentByte.ALIGN_CENTER, stampText, centerX, startY, …Run Code Online (Sandbox Code Playgroud) 我的应用程序(PHP)从具有签名值的OKTA获取SAML响应,并且我还拥有具有公钥的OKTA证书.我的申请做了以下,
我的代码,
$pubkeyid = openssl_pkey_get_details(openssl_pkey_get_public(file_get_contents("okta.cert")));
$pubkeyid = $pubkeyid["key"];
$signature = "<get it form SAML Response>";
$data = ???? (what should be provided)
$ok = openssl_verify($data, $signature, $pubkeyid,"sha1WithRSAEncryption");
Run Code Online (Sandbox Code Playgroud)
当我将数据值分配给发送给应用程序的SAML响应时,我总是得到0.我错过了什么吗?
我正在使用C#.NET构建一个应用程序(win form)来进行文档签名.我在签名时遇到错误.当我在某些计算机(Windows 7,Windows 10,而不是Windows Server)上签署文档时,我收到一个错误:"未定义的密钥集".那么,有人可以教程或建议我如何解决这个问题?非常感谢!这是我的代码:
// get certficate
public X509Certificate2 LoadCertificateFromWindowsStore()
{
X509Store x509Store = new X509Store(StoreName.My, StoreLocation.CurrentUser);
try
{
x509Store.Open(OpenFlags.ReadOnly | OpenFlags.OpenExistingOnly);
X509Certificate2Collection numberCerts = (X509Certificate2Collection)x509Store.Certificates;
X509Certificate2Enumerator certEnumerator;
if (numberCerts.Count == 1)
{
certEnumerator = numberCerts.GetEnumerator();
while (certEnumerator.MoveNext())
return certEnumerator.Current;
return null;
}
else if (numberCerts.Count > 1)
{
X509Certificate2Collection chooseCert = X509Certificate2UI.SelectFromCollection(numberCerts,
"Certificates List", "Choose your certificate", X509SelectionFlag.SingleSelection);
if (chooseCert.Count == 1)
return chooseCert[0];
else
return null;
}
else
return null;
}
catch (CryptographicException e)
{
Console.WriteLine(e.Message);
} …
c# ×2
itext ×2
java ×2
.net ×1
algorithm ×1
authenticode ×1
bouncycastle ×1
cryptoapi ×1
digest ×1
download ×1
encryption ×1
invalidation ×1
iphone ×1
macos ×1
okta ×1
pdf ×1
php ×1
saml-2.0 ×1
security ×1
sha1 ×1
sha256 ×1
strongname ×1
windows ×1