Canonicalization of XML

RodtmcleanRodtmclean Member Posts: 89
edited 2017-07-25 in NAV Three Tier
Hi,

I'm having a wee bit of a problem with .NET within C/AL and canonicalization of XML, RSACrypto contains a Private key. Getting the following message, see crashed here in code below: -

cfvrw6qvw7p4.png

Best Regards
Roddy

Canonicalize(IStream : InStream;VAR RSACrypto : DotNet "System.Security.Cryptography.RSACryptoServiceProvider") DigestValue : Text[250]
CanonicalizeMethod := CanonicalizeMethod.XmlDsigExcC14NTransform;

XmlDoc := XmlDoc.XmlDocument;
XmlDoc.Load(IStream);

SignedXML := SignedXML.SignedXml(XmlDoc);
//RSACrypto := RSACrypto.RSACryptoServiceProvider;

SignedInfo := SignedXML.SignedInfo;
SignedInfo.CanonicalizationMethod := XmlDsigExcC14NTransformUrl;
CanonicalizeMethod.InclusiveNamespacesPrefixList := 'Sign';

Reference := Reference.Reference;
Reference.Uri := '';

EnvTransform := EnvTransform.XmlDsigEnvelopedSignatureTransform;
Reference.AddTransform(EnvTransform);
SignedXML.AddReference(Reference);

RSAKeyValue := RSAKeyValue.RSAKeyValue(RSACrypto);
KeyInfo := KeyInfo.KeyInfo;
KeyInfo.AddClause(RSAKeyValue);

SignedXML.KeyInfo := KeyInfo;
SignedXML.ComputeSignature; // <<<<< Crashes Here
xmlDigitalSignature := SignedXML.GetXml;

Regards
Roddy

Best Answer

  • RodtmcleanRodtmclean Member Posts: 89
    Answer ✓
    We are moving all this onto c# as we have found issues with comprehensive DotNet in NAV. Advice is use a wrapper for heavy duty DotNet - write in c#.

    Thanks

Answers

  • RodtmcleanRodtmclean Member Posts: 89
    Answer ✓
    We are moving all this onto c# as we have found issues with comprehensive DotNet in NAV. Advice is use a wrapper for heavy duty DotNet - write in c#.

    Thanks
Sign In or Register to comment.