Account Options

  1. Sign in
The old Google Groups will be going away soon.
Switch to the new Google Groups.
Google Groups Home
« Groups Home
How to sign a message with only "n" and "d" fields of RSA-1024 bit private key?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Gary  
View profile  
 More options Feb 28 2009, 3:23 pm
From: Gary <b.rostami...@gmail.com>
Date: Sat, 28 Feb 2009 12:23:10 -0800 (PST)
Local: Sat, Feb 28 2009 3:23 pm
Subject: How to sign a message with only "n" and "d" fields of RSA-1024 bit private key?

Hi there!
I've built the below code(RSASign) successfully and it works fine:

#include "stdafx.h"

#include "rsa.h"
#include "osrng.h"   // PRNG
#include "hex.h"     // Hex Encoder/Decoder
#include "filters.h" // String Source and Sink
//std
#include <iostream>
#include <conio.h>
using namespace std;
using namespace CryptoPP;
int main()
{

      AutoSeededRandomPool rng;
      string message = "Yoda said, Do or Do Not. There is not try.";

      // Input: Private Key
          byte PrivateKeyArray[]=
{0x30,0x82,0x01,0x52,0x02,0x01,0x00,0x30,0x0D,
                  0x06,0x09,0x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,0x05,0x00,
                  0x04,0x82,0x01,0x3C,0x30,0x82,0x01,0x38,0x02,0x01,0x00,0x02,0x41,
                  0x00,0xD1,0x8A,0x48,0xC0,0x60,0x56,0x27,0x32,0x98,0xE4,0x3F,0xB4,
                  0x43,0xF2,0xB9,0xF6,0xA2,0x75,0xF0,0x42,0x17,0x07,0xD8,0x4E,0x9C,
                  0x62,0x29,0x19,0xF6,0xE5,0xFB,0xDA,0x49,0x6E,0x42,0x85,0xB1,0x1A,
                  0xE3,0x1A,0x1B,0x24,0x7B,0x0F,0xCD,0x5F,0x9E,0x3D,0xC1,0x1C,0x7C,
                  0x26,0x06,0xA7,0x28,0x88,0xED,0x87,0x2D,0xC7,0xB5,0x2A,0xDB,0x0F,
                  0x02,0x01,0x11,0x02,0x40,0x49,0xF4,0x92,0x25,0xC7,0xA5,0xEF,0xB7,
                  0x81,0x41,0x7F,0xE5,0x45,0x28,0x7D,0xDE,0x93,0xB1,0x27,0x9E,0xDA,
                  0xF3,0xB5,0xC1,0x64,0x5E,0xE1,0x54,0x75,0x42,0x1C,0xA6,0xC1,0x5D,
                  0x3B,0xCE,0xED,0x85,0x1F,0xE6,0x6B,0xEA,0xB8,0x47,0x5B,0x2C,0x38,
                  0x06,0xEE,0xC9,0x92,0x9D,0xB3,0x24,0x43,0xD1,0x85,0x6E,0x11,0x9D,
                  0xF2,0x01,0x68,0x31,0x02,0x21,0x00,0xF7,0x77,0x08,0xF8,0xCE,0xF8,
                  0x9E,0x98,0x32,0x6C,0x9C,0x7C,0x9B,0x41,0x5F,0xB8,0xEC,0x63,0x8A,
                  0xEE,0xAC,0xD0,0xA5,0xFC,0x60,0xEC,0x43,0x72,0x80,0xFC,0xE9,0x1F,
                  0x02,0x21,0x00,0xD8,0xC4,0x65,0x6D,0x41,0x29,0x14,0xCA,0x61,0x9E,
                  0xD4,0x73,0xAF,0xCB,0x9F,0xC6,0x85,0x7D,0xD1,0xCD,0xDE,0x45,0x17,
                  0xBA,0xE7,0xE3,0x0D,0xC0,0x5B,0xD4,0xA0,0x11,0x02,0x21,0x00,0xCB,
                  0xCB,0x70,0xCC,0xE6,0xAE,0xA0,0xB9,0x92,0xF0,0x08,0x66,0x9D,0xF9,
                  0x9A,0x1F,0xD1,0xBB,0x63,0x5B,0x24,0xE8,0x10,0x39,0x40,0xC2,0x91,
                  0xE5,0xD3,0xA3,0x1A,0x55,0x02,0x20,0x19,0x80,0x84,0x67,0x34,0xD7,
                  0xA8,0x17,0xCF,0x3F,0xDC,0xC2,0x50,0xEA,0xC7,0x80,0xC4,0x69,0x27,
                  0xBD,0xDD,0xEA,0x02,0xCA,0xB1,0xDE,0x7A,0x16,0xA1,0x64,0x4F,0x11,
                  0x02,0x20,0x1B,0x29,0x5C,0x2F,0x54,0x61,0xED,0x90,0xCA,0x8A,0xB6,
                  0xE2,0x8E,0x27,0x0C,0x8F,0x00,0x40,0x90,0x78,0xF8,0xDD,0xF1,0xED,
                  0x9F,0x1B,0x3E,0x46,0x86,0xD3,0x93,0xB6};

      // Output: Signed Message M
          byte signature[256];

      StringSource privArray(PrivateKeyArray,sizeof(PrivateKeyArray),
true,NULL);
      RSASSA_PKCS1v15_SHA_Signer priv(privArray);

      // Sign Away...
        StringSource( message, true,
         new SignerFilter( rng, priv,
            new HexEncoder(
               new ArraySink(signature,sizeof(signature))
            ) // HexEncoder
         ) // SignerFilter
      ); // StringSource

                 cout<<"signature is:"<<endl;
                 for(int i=0;i<sizeof(signature);i++)
                 cout<<signature[i]<<" | ";
                 _getch();

   return 0;

}

It's private key value is in a RSAPrivateKey structure format,as
defined by PKCS#1,
And is of type a DER-encoded PKCS#8 PrivateKeyInfo structure.

I need to sign a message by only "n"(modulus) and "d"(private
exponent),
I've read "RSADumpKeys" example to parse key fields,but I don't know
how can I sign a message with only "n" and "d" parts?
And with which function?

I want to store "n" and "d" parts of generated Private key into a byte
array(with length 256 bytes) and sign a message with this array,

Is this job possible with the above "CryptoPP" functions? or their
input private key should be only in DER-encoded format?

Because now I need to store only 256 bytes(128 bytes for "n" and 128
bytes for "d")!

What is your suggesstion?

Hope you help me!
Thanks in Advance.
Gary


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Wei Dai  
View profile  
 More options Feb 28 2009, 4:23 pm
From: "Wei Dai" <wei...@weidai.com>
Date: Sat, 28 Feb 2009 13:23:39 -0800
Local: Sat, Feb 28 2009 4:23 pm
Subject: Re: How to sign a message with only "n" and "d" fields of RSA-1024 bit private key?
It's possible, but you have to know "e" as well. You can use this member
function in InvertibleRSAFunction:

//! factor n given private exponent
void Initialize(const Integer &n, const Integer &e, const Integer &d);

to initialize the private key, then sign the message normally.

--------------------------------------------------
From: "Gary" <b.rostami...@gmail.com>
Sent: Saturday, February 28, 2009 12:23 PM
To: "Crypto++ Users" <cryptopp-users@googlegroups.com>
Subject: How to sign a message with only "n" and "d" fields of RSA-1024 bit
private key?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »