Skip to content

OCES3 certificate not supported #35

@Kishmet

Description

@Kishmet

If you use an OCES3 certificate for the clientCertificate you will encounter the following error from the framework:
"Unexpected error: Der er angivet en ugyldig algoritme." or "Invalid algoritme specified".

This error can be solved by modifying the code in the file:
Digst.OioIdws.OioWsTrust.Utils.XmlSignatureUtils.
Change the following line (in the SignDocument function):
signedXml.SigningKey = cert.PrivateKey;
To
signedXml.SigningKey = cert.GetRSAPrivateKey();

The stacktrace for the error:
Server stack trace:
ved System.Security.Cryptography.CryptographicException.ThrowCryptographicException(Int32 hr)
ved System.Security.Cryptography.Utils.SignValue(SafeKeyHandle hKey, Int32 keyNumber, Int32 calgKey, Int32 calgHash, Byte[] hash, Int32 cbHash, ObjectHandleOnStack retSignature)
ved System.Security.Cryptography.Utils.SignValue(SafeKeyHandle hKey, Int32 keyNumber, Int32 calgKey, Int32 calgHash, Byte[] hash)
ved System.Security.Cryptography.RSACryptoServiceProvider.SignHash(Byte[] rgbHash, Int32 calgHash)
ved System.Security.Cryptography.RSAPKCS1SignatureFormatter.CreateSignature(Byte[] rgbHash)
ved System.Security.Cryptography.AsymmetricSignatureFormatter.CreateSignature(HashAlgorithm hash)
ved System.Security.Cryptography.Xml.SignedXml.ComputeSignature()
ved Digst.OioIdws.OioWsTrust.Utils.XmlSignatureUtils.SignDocument(XDocument xDoc, IEnumerable`1 ids, X509Certificate2 cert)
ved Digst.OioIdws.OioWsTrust.ProtocolChannel.OioWsTrustMessageTransformer.SignMessage(XDocument& xDocument, X509Certificate2 clientCertificate)
ved Digst.OioIdws.OioWsTrust.ProtocolChannel.OioWsTrustMessageTransformer.ModifyMessageAccordingToStsNeeds(Message& request)
ved Digst.OioIdws.OioWsTrust.ProtocolChannel.OioWsTrustChannel.Request(Message message, TimeSpan timeout)
ved System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
ved System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
ved System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
ved System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]:
ved System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
ved System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
ved System.ServiceModel.Security.IWSTrustContract.Issue(Message message)
ved System.ServiceModel.Security.WSTrustChannel.Issue(RequestSecurityToken rst, RequestSecurityTokenResponse& rstr)
ved System.ServiceModel.Security.WSTrustChannel.Issue(RequestSecurityToken rst)
ved Digst.OioIdws.OioWsTrust.StsTokenService.GetToken(StsAuthenticationCase stsAuthenticationCase, SecurityToken authenticationToken)
2023-02-10 13:52:43,523 INFO OioIdws - Unexpected error: Der er angivet en ugyldig algoritme.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions