| Author |  | 
      
        | jing.wang Newbie
 
  
 
 Joined: 22 October 2009
 Online Status: Offline
 Posts: 1
 | 
          Hi
           | Posted: 22 October 2009 at 3:10am | IP Logged |   |  
           | 
 |  I tried to sign a message with DomainKeys
 signature.
 I created a private key using openssl.
 byte[] privateKey=null;
 using(Stream stream=new
 FileStream("rsa.private"))
 {
 privateKeys=new byte[stream.Length];
 
 stream.Read(privateKeys,0,privateKeys.Length);
 }
 DomainKeys dk=new DomainKeys();
 smtpObject.Message=dk.Sign(message,null,privat
 eKeys,"dk");
 
 I get an exception:
 "Invalid cryptographic private key format."
 
 What's happening ?
 
 Thanks by advance for your help.
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | Igor AfterLogic Support
 
  
 
 Joined: 24 June 2008
 Location: United States
 Online Status: Offline
 Posts: 6167
 | 
          You're sending base64-encoded data to method which expects decoded (binary) data. Try using different overload for this, you may either read from filestream or specify a filename, be sure to set isFilename property accordingly.
           | Posted: 22 October 2009 at 3:53am | IP Logged |   |  
           | 
 |  
 --
 Regards,
 Igor, AfterLogic Support
 | 
       
        | Back to Top |     | 
       
       
        |  |