locked
Extract RSA key value from XmlString RRS feed

  • Question

  • Hi all!

    I need to extract the RSA key values ( Modulus, exponent etc... ) from String generated by RSA->ToXmlString() method.

    Could somebody help me? 

    Thanks! 



      
    Tuesday, February 24, 2009 10:09 PM

Answers

  • You probably want to use RSACryptoServiceProvider instead.  Its ExportParameters() method gives you direct access to the Modulus value.
    Hans Passant.
    • Marked as answer by Nancy Shao Monday, March 2, 2009 4:04 AM
    Wednesday, February 25, 2009 11:50 AM
    Moderator

All replies

  • RSA::FromXmlString() looks promising.
    Hans Passant.
    Wednesday, February 25, 2009 1:45 AM
    Moderator
  • Ok, but this method is good to an System.Security.Cryptography.RSA object, while i would extract key values in a byte array, for example, but without xml tags.

    for example, i have  this node in my xmlString
    <Modulus>zjFmn/hT8J3wZqW5IhU4aQggHtqZmL+OpWO1HCgo4x38HAbRXrrzXH2d3FA0AOSipfluDh1vSq/FMC/Kvm//xw==</Modulus>

    and i wont the modules value only
    zjFmn/hT8J3wZqW5IhU4aQggHtqZmL+OpWO1HCgo4x38HAbRXrrzXH2d3FA0AOSipfluDh1vSq/FMC/Kvm//xw==

    Thanks!
     
    Wednesday, February 25, 2009 8:47 AM
  • You probably want to use RSACryptoServiceProvider instead.  Its ExportParameters() method gives you direct access to the Modulus value.
    Hans Passant.
    • Marked as answer by Nancy Shao Monday, March 2, 2009 4:04 AM
    Wednesday, February 25, 2009 11:50 AM
    Moderator