我已经使用java 8签署了一个没有问题的XML文档,直到我升级到 Java 8u121 版本,代码是:
signature.sign(dsc)
错误在代码行中:
javax.xml.crypto.XMLSignatureException: java.security.InvalidKeyException: Invalid RSA private key
错误是:
Sub Mail_Selection_Range_Outlook_Body()
'For Tips see: http://www.rondebruin.nl/win/winmail/Outlook/tips.htm
'Don't forget to copy the function RangetoHTML in the module.
'Working in Excel 2000-2016
Dim rng As Range
Dim OutApp As Object
Dim OutMail As Object
Set rng = Nothing
On Error Resume Next
'Only the visible cells in the selection
Set rng = Selection.SpecialCells(xlCellTypeVisible)
'You can also use a fixed range if you want
On Error GoTo 0
If rng Is Nothing Then
MsgBox "The selection is not a range or the sheet is protected" & _
vbNewLine & "please correct and try again.", vbOKOnly
Exit Sub
End If
With Application
.EnableEvents = False
.ScreenUpdating = False
End With
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.To = "ron@debruin.nl"
.CC = ""
.BCC = ""
.Subject = "This is the Subject line"
.HTMLBody = RangetoHTML(rng)
.Send 'or use .Display
End With
On Error GoTo 0
With Application
.EnableEvents = True
.ScreenUpdating = True
End With
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
...
对于Java 8u121之前的版本,不要发生任何错误。
答案 0 :(得分:0)
这是由JDK 8u121(http://www.oracle.com/technetwork/java/javase/8u121-relnotes-3315208.html)&#34中的修复引起的错误; DER编码解析代码中添加了更多检查更多检查添加到DER编码解析代码中以捕获各种编码错误。此外,包含构造的无限长度编码的签名现在将在解析期间导致IOException。请注意,使用JDK默认提供程序生成的签名不受此更改的影响。 JDK-8168714(不公开)"
JDK-8175251(https://bugs.openjdk.java.net/browse/JDK-8175251)已经修复了这个问题,将在下一次JDK更新中提供。该修复已经在JDK 8u152中,其早期访问版本可以从https://jdk8.java.net/download.html
下载