Quantcast
Channel: Visual COBOL - Forum - Recent Threads
Viewing all articles
Browse latest Browse all 4356

Decrypt XML Elements with Asymmetric Keys

$
0
0

I have this code working in VB.NET and I am migrating to VC2010. NET. Unfortunately I'm having trouble with this function. How would this code?

    Sub Decrypt(ByVal Doc As XmlDocument, ByVal Alg As RSA, ByVal KeyName As String)
        ' Check the arguments.  

        If KeyName Is Nothing Then
            Throw New ArgumentNullException("KeyName")
        End If
        ' Create a new EncryptedXml object.
        Dim exml As New EncryptedXml(Doc)
        ' Add a key-name mapping.
        ' This method can only decrypt documents
        ' that present the specified key name.
        exml.AddKeyNameMapping(KeyName, Alg)
        ' Decrypt the element.
        exml.DecryptDocument()
    End Sub

VC2010 .NET

       method-id Decrypt public.      
       local-storage section.
       01 exml type System.Xml.XmlDocument.       
       procedure division using by value cDoc as type XmlDocument by value cAlg As type RSA by value cKeyName As type String.       
      *    Dim exml As New EncryptedXml(Doc)       - vb.net
          
           set exml to new XmlDocument()
           set exml to cDoc
        
       
      *     exml.AddKeyNameMapping(KeyName, Alg)   - vb.net
              
      *     exml.DecryptDocument()                 - vb.net

           goback.
       end method.


Viewing all articles
Browse latest Browse all 4356

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>