Need help with implementing Digital Signatures

Hello,
Here's an excerpt from a security book:
To create a digital signature, a sender first takes the original plaintext message and runs it through a hash function.
The Secure Hash Algorithm (SHA-1) is the standard for hash functions.
The hash value is also known as a message digest.
Next, the sender uses the its private key to encrypt the message digest. This step creates
a digital signature and authenticates the sender, since only the owner of that private key could
encrypt the message. The sender encrypts the original message with the receiver’s public key
and sends the encrypted message and the digital signature to the receiver.
The receiver uses the sender’s public key to decipher the original digital signature and reveal the message
digest. The receiver then uses his or her own private key to decipher the original message.
Finally, the receiver applies the agreed upon hash function (e.g. SHA-1 or MD5) to the original
message. If the hash value of the original message matches the message digest included
in the signature, there is message integrity-the message has not been altered in transmission.
I would like to implement the sender's part and create an encrypted message and the digital signature.
Suppose I have in hand a message (let's call it myMessage), my private key (let's call it myPrivateKey) and the receiver's public key (let's call it receiverPublicKey).
In order to encrypt the original message with the receiver’s public key I've implemented this piece of code:
Cipher cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.ENCRYPT_MODE,receiverPublicKey);
byte[] binaryCryptData = cipher.doFinal(myMessage.getBytes());
String encPayload = Base64.byteArrayToBase64(binaryCryptData);
return encPayload;In order to create the signature I've implemented this piece of code:
Signature RSA = Signature.getInstance("SHA1withRSA");
RSA.initSign(myPrivateKey);
byte bt[] = message.getBytes();
RSA.update(bt);
byte[] signature = RSA.sign();My assumption is that I don't follow the exact guidlines in the book for the sender.
Can someone please let me know what I'm missing and help me in adjusting my code with the books standards?
Thank you in advance,
Roy

it's your homework, not ours.
Congratulations on typing in everything BUT the most important part that it's all about, but that's not enough.

Similar Messages

  • Help with Mail & Digital Signatures

    My work is moving to Common Access Cards and digitally signed email. I can't get Mail to bring up the digital signature icon when I use the CAC card. It works fine with a software certificate, but I can't use that.
    The certificates in the CAC show up in a different keychain, and I think Mail wants the certificates in the login keychain. I've tried the following:
    -- importing the certificate from the CAC (didn't allow it)
    -- changing the default keychain to the CAC keychain (caused mail and keychain access and Safari to all quit)
    I don't really want to try logging in using the CAC card -- the only instructions I've seen to do this require messing around with Terminal and other files. Seems the potential for messing things up is rather large.
    Anyone know how I can get Mail to recognise the CAC card for digital signatures?
    Mac Pro   Mac OS X (10.4.9)  

    I haven't had to do this myself, but these instructions may be of help, if you haven't already seen them.
    Matt

  • I need help with my digital mp3 pla

    hi, i recently bought a creative digital mp3 player second hand?and i have no clue on how to get music off and on to it (i only got the mp3 player itself and bought the usb cable to go with it)?and i also need to know?where to get the driver to install the program on to my computer can someone help me please...

    i bought a second hand one it just says on the front of it that it a "creative digital mp3 player"i have windows xp and the latest version of windows media

  • Need help with deciding digital options... creative ddts-100, ddts-610, x-fi i/o cons

    I think i have narrowed down my options for upgrading my computer audio... except i am not sure which way to go and would like some help or ti
    ps.
    ... thanks.
    first off i mainly game and listen to music on the pc or listen to the music while gaming... i currently have the logitech z5300e speaker system, creative labs x-fi fatalty pro gamer sound card... i wanted to purchase a receiver to go digital except thats a bit too much for me right now, if i was to get a receiver it would be for my home theater. so i looked around and came up with a couple alternati'ves, except i am not sure if these options will work with what i have now...
    ?st option, i could go along with getting a creative labs inspire digital 5500 speaker system because that sytem comes with a decoder box that creative labs no longer makes... this decoder box has 2 optical in, coax in, also has a adaoter that connects the speakers to the decoder box as well... runs around 200.00 dollars?2nd option, i found on creatives website a new decoder called the dts-60 except this option would require a receiver because this newer model does not come with the speaker adapter as the dts-00 does... but since i am going to upgrade my home theater receiver i would have that one to use with the coax connections. this option runs 00.00 dollars?3rd option, i? found on creatives website a x-fi i/o console so far from what i read it works with my sound card ... i am still not sure if i can just connect the speaker cable to the console but this would run 80.00?4th option , on there website there is also, a dribe bay x-fi i/o upgrade. not sure if it will work with my soundcard but i was thinking it may be an option to use cause the card i have has built in decoders i think..
    ??what would you guys do ?

    dont buy creative ...no support from them

  • Need help with password for signature with Adobe Acrobat X Pro

    Signature password is invalid in the PDF but when I use the same password to access the Adobe Webpage, it works perfectly. Where is the disconnect and how do I create a situation where the signature on the pdf recognizes my password?

    Yes, same password.
    Dave Gelfand
    Property Manager
    Clinton Street Lofts
    226 N. Clinton Street
    Chicago, IL. 60661
    Office: 312.655.0935
    Fax: 312.655.0937
    [email protected]
    Managed By:
    TheBuildingGroup®
      <https://www.facebook.com/pages/Clinton-Street-Lofts/144392282255974>    <http://www.linkedin.com/profile/view?id=7200625&locale=en_US>    <http://www.clintonstreetlofts.net/>     <http://www.buildinggroup.com/buildinggroup/outside_home.asp>
    P Save a tree. Please don't print this e-mail unless you really need to.

  • Need help with having a signature

    Ok admittedly I haven't a Dickee bird or for that matter a clue as to how to write a signature for my posts? Have looked through everything and am stumped.  Please help 

    Go to My Settings / Personal Profile / Personal Info. You can include HTML in them, e.g.
    <br>ISPs: 1999: Freeserve 48K Dial-Up =&gt; 2005: Wanadoo 1 Meg BB =&gt; 2007: Orange 2 Meg BB =&gt; 2008: Orange 8 Meg LLU =&gt; 2010: Orange 16 Meg LLU =&gt; <strong>2011: Orange 20 Meg WBC</strong>
    Still haven't got the hang of Mobile Sigs, which is elsewhere.

  • Need help with adobe digital editions authorizing tablet

    I have ADE on my laptop to download and trasfer ebooks to my Nook color and want to transfer ebooks to my new Samsung galaxy tab 2.  I have the Nook app on my tablet and have transfered the ebook to the table using copy and paste method but can't read the book.  I get a message that the tablet is not authorized in ADE.   How do I get the tablet authorized?

    Try the forum for ADE.

  • Please help me with the digital signature validation problem?

    Please help me with the digital signature validation problem?

    Hi
    Execute the program in the Debuggin mode.
    In the Debugger Window
    Select Breakpoint -> Break point at -> Breakpoint at source code Menu Item and enter the details of the program/include/line no..
    Activate the System Debugger On from the Settings Menu.
    Hope this would help you.
    Murthy
    Edited by: Kalyanam Seetha Rama Murthy on Jul 18, 2008 7:20 AM

  • I need help with validating signatures.

    I have Adobe Acrobat X and Reader 9 and need help with how to validate signatures.
    I have a document that I am emailing to all employees that require the signature; but, when the form is emailed back, it states that the signatures requires validating.

    Or, is the validation something I do once the form is emailed back to me?
    I guess a subquestion would be, how to establish/manage trusted certificates with reader or acrobat 8. 

  • Need to implement Digital signature

    Hi,
    We are trying to implement digital signature for the client.
    As per the requirement ,Digitally signed document will be sent to the statutory bodies.
    Please guide me how to implement digital signature in SAP with smart card stored private key ,since we already have 3 rd party tool to read digital signature through Card reader,certificate issued by NIC.
    Please suggest pre-requisites and methodology for this.
    Regards,
    Nageswara Rao

    Hi All,
    Please suggest Pre-requisites and methodology for this.

  • Need help in creating multiple signature forms?

    need help in creating multiple signature forms that can be digitally signed in adobe reader

    Automator gets a bit unweildy when trying to vary things outside of what the actions provide.  Since you are already using an AppeScript in your workflow, might as well do the whole thing:
    set baseFolder to (path to desktop) -- the location to create the folder
    display dialog "Please provide a new folder name:" default answer "test"
    set folderName to text returned of the result
    repeat -- keep repeating until a number is returned
      display dialog "How many subfolders?" default answer "5"
      set theNumber to text returned of the result
        try -- test the result
          set theNumber to theNumber as integer
          exit repeat -- success
        end try
    end repeat
    tell application "Finder"
      try -- make new folder
        set newFolder to (make new folder at baseFolder with properties {name:folderName})
      on error number -48 -- skip errors if the folder is already there
        set newFolder to ((baseFolder as text) & folderName) as alias
      end try
      repeat with X from 1 to theNumber
        try -- make new subfolder
          make new folder at newFolder with properties {name:folderName & X}
        on error number -48 -- skip errors if the folder is already there
        end try
      end repeat
    end tell

  • Implementing Digital Signature Strategy In Adobe Forms

    Hi Everyone,
    I need to know how to implement Digital Signatures with the use of Signature Strategy in my ECC 6.0 system..
    Here is what i've done already,
    1) Created a signature strategy with user authentication and registered the Signature Object in TA_SIGNO according to the document below.
        [http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e0fbaa71-cd8d-2910-5982-e30626035400]
    2) I have Adobe Acrobat 9.0 already.
    3) Now, Ive added a Document Signature Field in my Adobe Form Layout too.
    4) How to implement the Signature strategy i've created in this Adobe Form ???????????
    Kindly share your ideas.
    Edited by: Prashanth on Jan 25, 2011 1:21 PM
    Edited by: Prashanth on Jan 25, 2011 1:30 PM

    Hi,
    maybe the reason for this is that the status of the digital signature is not changed. Then the system thinks that the digital signature is still completed and therefore the user is not getting the pop-up again. The database table for the digital signature for documents is TC77. I hope this information is usefull for you.
    Best regards,
    Christoph

  • Docs for implementing Digital signatures

    Hello Everyone,
    We would like to implement digital signature in our landscpae for sending Form 16 from SAP system.
    Please  let me the step by step configuration guide for digital signature along with pre-requistive if anything applicable.
    Thanks in advance
    Appreciate your response.
    Regards,
    Vadi

    Hi Vadivambal,
    Refer to the following note:
    [Note 1168740 - Digital Signature for Form 16|https://service.sap.com/sap/support/notes/1168740]
    Also refer to the following link:
    http://www.saptechies.com/digital-signature-for-form-16/
    Hope this helps!!
    Cheers,
    Arafat
    Edited by: Arafat Farooqui on May 11, 2009 1:03 PM

  • Need help with JTextArea and Scrolling

    import java.awt.*;
    import java.awt.event.*;
    import java.text.DecimalFormat;
    import javax.swing.*;
    public class MORT_RETRY extends JFrame implements ActionListener
    private JPanel keypad;
    private JPanel buttons;
    private JTextField lcdLoanAmt;
    private JTextField lcdInterestRate;
    private JTextField lcdTerm;
    private JTextField lcdMonthlyPmt;
    private JTextArea displayArea;
    private JButton CalculateBtn;
    private JButton ClrBtn;
    private JButton CloseBtn;
    private JButton Amortize;
    private JScrollPane scroll;
    private DecimalFormat calcPattern = new DecimalFormat("$###,###.00");
    private String[] rateTerm = {"", "7years @ 5.35%", "15years @ 5.5%", "30years @ 5.75%"};
    private JComboBox rateTermList;
    double interest[] = {5.35, 5.5, 5.75};
    int term[] = {7, 15, 30};
    double balance, interestAmt, monthlyInterest, monthlyPayment, monPmtInt, monPmtPrin;
    int termInMonths, month, termLoop, monthLoop;
    public MORT_RETRY()
    Container pane = getContentPane();
    lcdLoanAmt = new JTextField();
    lcdMonthlyPmt = new JTextField();
    displayArea = new JTextArea();//DEFINE COMBOBOX AND SCROLL
    rateTermList = new JComboBox(rateTerm);
    scroll = new JScrollPane(displayArea);
    scroll.setSize(600,170);
    scroll.setLocation(150,270);//DEFINE BUTTONS
    CalculateBtn = new JButton("Calculate");
    ClrBtn = new JButton("Clear Fields");
    CloseBtn = new JButton("Close");
    Amortize = new JButton("Amortize");//DEFINE PANEL(S)
    keypad = new JPanel();
    buttons = new JPanel();//DEFINE KEYPAD PANEL LAYOUT
    keypad.setLayout(new GridLayout( 4, 2, 5, 5));//SET CONTROLS ON KEYPAD PANEL
    keypad.add(new JLabel("Loan Amount$ : "));
    keypad.add(lcdLoanAmt);
    keypad.add(new JLabel("Term of loan and Interest Rate: "));
    keypad.add(rateTermList);
    keypad.add(new JLabel("Monthly Payment : "));
    keypad.add(lcdMonthlyPmt);
    lcdMonthlyPmt.setEditable(false);
    keypad.add(new JLabel("Amortize Table:"));
    keypad.add(displayArea);
    displayArea.setEditable(false);//DEFINE BUTTONS PANEL LAYOUT
    buttons.setLayout(new GridLayout( 1, 3, 5, 5));//SET CONTROLS ON BUTTONS PANEL
    buttons.add(CalculateBtn);
    buttons.add(Amortize);
    buttons.add(ClrBtn);
    buttons.add(CloseBtn);//ADD ACTION LISTENER
    CalculateBtn.addActionListener(this);
    ClrBtn.addActionListener(this);
    CloseBtn.addActionListener(this);
    Amortize.addActionListener(this);
    rateTermList.addActionListener(this);//ADD PANELS
    pane.add(keypad, BorderLayout.NORTH);
    pane.add(buttons, BorderLayout.SOUTH);
    pane.add(scroll, BorderLayout.CENTER);
    addWindowListener( new WindowAdapter()
    public void windowClosing(WindowEvent e)
    System.exit(0);
    public void actionPerformed(ActionEvent e)
    String arg = lcdLoanAmt.getText();
    int combined = Integer.parseInt(arg);
    if (e.getSource() == CalculateBtn)
    try
    JOptionPane.showMessageDialog(null, "Got try here", "Error", JOptionPane.ERROR_MESSAGE);
    catch(NumberFormatException ev)
    JOptionPane.showMessageDialog(null, "Got here", "Error", JOptionPane.ERROR_MESSAGE);
    if ((e.getSource() == CalculateBtn) && (arg != null))
    try{
    if ((e.getSource() == CalculateBtn) && (rateTermList.getSelectedIndex() == 1))
    monthlyInterest = interest[0] / (12 * 100);
    termInMonths = term[0] * 12;
    monthlyPayment = combined * (monthlyInterest / (1 - (Math.pow (1 + monthlyInterest,  -termInMonths))));
    lcdMonthlyPmt.setText(calcPattern.format(monthlyPayment));
    if ((e.getSource() == CalculateBtn) && (rateTermList.getSelectedIndex() == 2))
    monthlyInterest = interest[1] / (12 * 100);
    termInMonths = term[1] * 12;
    monthlyPayment = combined * (monthlyInterest / (1 - (Math.pow (1 + monthlyInterest,  -termInMonths))));
    lcdMonthlyPmt.setText(calcPattern.format(monthlyPayment));
    if ((e.getSource() == CalculateBtn) && (rateTermList.getSelectedIndex() == 3))
    monthlyInterest = interest[2] / (12 * 100);
    termInMonths = term[2] * 12;
    monthlyPayment = combined * (monthlyInterest / (1 - (Math.pow (1 + monthlyInterest,  -termInMonths))));
    lcdMonthlyPmt.setText(calcPattern.format(monthlyPayment));
    catch(NumberFormatException ev)
    JOptionPane.showMessageDialog(null, "Invalid Entry!\nPlease Try Again", "Error", JOptionPane.ERROR_MESSAGE);
    }                    //IF STATEMENTS FOR AMORTIZATION
    if ((e.getSource() == Amortize) && (rateTermList.getSelectedIndex() == 1))
    loopy(7, 5.35);
    if ((e.getSource() == Amortize) && (rateTermList.getSelectedIndex() == 2))
    loopy(15, 5.5);
    if ((e.getSource() == Amortize) && (rateTermList.getSelectedIndex() == 3))
    loopy(30, 5.75);
    if (e.getSource() == ClrBtn)
    rateTermList.setSelectedIndex(0);
    lcdLoanAmt.setText(null);
    lcdMonthlyPmt.setText(null);
    displayArea.setText(null);
    if (e.getSource() == CloseBtn)
    System.exit(0);
    private void loopy(int lTerm,double lInterest)
    double total, monthly, monthlyrate, monthint, monthprin, balance, lastint, paid;
    int amount, months, termloop, monthloop;
    String lcd2 = lcdLoanAmt.getText();
    amount = Integer.parseInt(lcd2);
    termloop = 1;
    paid = 0.00;
    monthlyrate = lInterest / (12 * 100);
    months = lTerm * 12;
    monthly = amount *(monthlyrate/(1-Math.pow(1+monthlyrate,-months)));
    total = months * monthly;
    balance = amount;
    while (termloop <= lTerm)
    displayArea.setCaretPosition(0);
    displayArea.append("\n");
    displayArea.append("Year " + termloop + " of " + lTerm + ": payments\n");
    displayArea.append("\n");
    displayArea.append("Month\tMonthly\tPrinciple\tInterest\tBalance\n");
    monthloop = 1;
    while (monthloop <= 12)
    monthint = balance * monthlyrate;
    monthprin = monthly - monthint;
    balance -= monthprin;
    paid += monthly;
    displayArea.setCaretPosition(0);
    displayArea.append(monthloop + "\t" + calcPattern.format(monthly) + "\t" + calcPattern.format(monthprin) + "\t");
    displayArea.append(calcPattern.format(monthint) + "\t" + calcPattern.format(balance) + "\n");
    monthloop ++;
    termloop ++;
    public static void main(String args[])
    MORT_RETRY f = new MORT_RETRY();
    f.setTitle("MORTGAGE PAYMENT CALCULATOR");
    f.setBounds(600, 600, 500, 500);
    f.setLocationRelativeTo(null);
    f.setVisible(true);
    }need help with displaying the textarea correctly and the scroll bar please.
    Message was edited by:
    new2this2020

    What's the problem you're having ???
    PS.

  • Need help with home work see what you got

    1. The MEMBERS table has the phone number broken into three fields:
       CountryCode - e,g., '1' for the United States
       AreaCode - e.g., three digits for the United States
       Phone - e.g., 7 digits, with or without a dash between the first three digits (Exchange) and last four digits (Line)
       Any or all of the fields may be missing (null) or blank or contain only spaces.
       Write a T-SQL statement to concatenate the three fields into a complete phone number
       with the format: CountryCode(AreaCode)Exchange-Line, e.g., 1(816)123-4567
       If no Phone is present, return a blank string.
       If no area code is present, return only the Phone number. Do not return an empty pair of parentheses or the CountryCode.
    2. The PERSON_CAMPAIGN table contains a row for each war/conflict the member served in. A member may have served in multiple conflicts
       For this purpose, each row contains:
       PersonID - unique member identifier
       Campaign - name of war/conflict
       Write a T-SQL statement to return one row per member with all campaigns concatenated into a single field and separated by commas
       E.g., PersonID    Campaigns
             12345678    Global War on Terror, Iraq, Afghanistan
    3. The MEMBER_STATISTICS table contains one row per post.
       For this purpose, each row contains the post's:
       Division - a way of grouping posts by their member size
       Department - the state in which the post is located
       PostNumber - unique post identifier
       Reinstated - count of members whose annual subscription had lapsed for at least two years but who have now subscribed for the current year
       Write a T-SQL statement to determine the top ten posts in each division based on the number of reinstated members, with a minimum of 50 reinstated members.
       Rank them by highest to lowest reinstated count.
       Return their Division, Rank, Department, PostNumber, Reinstated

    I got 3 home work questions think i have the first two need help with the last one please.
    Kinda stuck on #3 hard I can see data not sure witch to sum or count?
    1. The MEMBERS table has the phone number broken into three fields:
       CountryCode - e,g., '1' for the United States
       AreaCode - e.g., three digits for the United States
       Phone - e.g., 7 digits, with or without a dash between the first three digits (Exchange) and last four digits (Line)
       Any or all of the fields may be missing (null) or blank or contain only spaces.
       Write a T-SQL statement to concatenate the three fields into a complete phone number
       with the format: CountryCode(AreaCode)Exchange-Line, e.g., 1(816)123-4567
       If no Phone is present, return a blank string.
       If no area code is present, return only the Phone number. Do not return an empty pair of parentheses or the CountryCode.
    ANSWER******************
    Notes: created a funtion to format the phone 
    Then used the this function in a select to concatenate Phone 
     CREATE FUNCTION dbo.FORMATPHONE (@CountryCode int, @AreCode int, @Phone VARCHAR(14))
    RETURNS VARCHAR(14)
        AS BEGIN
           DECLARE @ReturnPhone VARCHAR(14)
           DECLARE @NewPhone VARCHAR(14)
    -- Note case sets newphone to null if phone null or '' also to see if phone has '-' in it if not inserts into newphone
           case 
                when @Phone is null or @Phone  = ''
                   Then SET @NewPhone = Null
                when @Phone = substring(@Phone,4,1)='-'
          Then SET @NewPhone = @Phone 
           else  
                SET @NewPhone = substring(@Phone,1,3)+'-'+ substring(@Phone,4,4)
           End     
           case 
                when @NewPhone is null then SET @ReturnPhone = @NewPhone            
           elese case
                    when @AreCode is null or @AreCode = '' then SET @ReturnPhone = @NewPhone
                 else 
          SET @ReturnPhone = @CountryCode + '(' + @AreCode + ')' +  @NewPhone
                END
           END
        RETURN @ReturnPhone 
    END
    select dbo.FORMATPHONE(CountryCode,AreCode,Phone)
    from MEMBERS 
    2. The PERSON_CAMPAIGN table contains a row for each war/conflict the member served in. A member may have served in multiple conflicts
       For this purpose, each row contains:
       PersonID - unique member identifier
       Campaign - name of war/conflict
       Write a T-SQL statement to return one row per member with all campaigns concatenated into a single field and separated by commas
       E.g., PersonID    Campaigns
             12345678    Global War on Terror, Iraq, Afghanistan
    ANSWER******************
    SELECT      PersonID,
                STUFF((    SELECT ',' + Campaign AS [text()]
                            FROM PERSON_CAMPAIGN 
                            WHERE (PersonID = Results.ID)
                            FOR XML PATH('') 
                            ), 1, 1, '' )
                AS Campaigns
    FROM  PERSON_CAMPAIGN Results
    3. The MEMBER_STATISTICS table contains one row per post.
       For this purpose, each row contains the post's:
       Division - a way of grouping posts by their member size
       Department - the state in which the post is located
       PostNumber - unique post identifier
       Reinstated - count of members whose annual subscription had lapsed for at least two years but who have now subscribed for the current year
       Write a T-SQL statement to determine the top ten posts in each division based on the number of reinstated members, with a minimum of 50 reinstated members.
       Rank them by highest to lowest reinstated count.
       Return their Division, Rank, Department, PostNumber, Reinstated

Maybe you are looking for

  • Adobe PDF not printing yosemite

    Just added new Officejet 5740 to home network, everything works except won't print Adobe PDF documents. Ok with Preview, .docx etc.  Running 10.10.1 on iMac.  Prints blank pages.  I have run into this in the past with my office HP Laser printer, but

  • L440 Externer Monitor an Display Port Ruhezustand

    Hallo, wenn ich über Display Port mit einem externen Monitor (Asus PB 248) arbeite, dann das L440 in Ruhezustand versetze und ich es wieder starte, wird immer das eingebaute Display eingeschaltet. Der externe Monitor muss jedes Mal über "Win+P" aktiv

  • Illustrator CS2 file crashes

    I created a file yesterday in Illustrator CS2 on the MAC and today it crashes when I try to open it?? Help! I need to open this file, OR I'VE LOST A FULL DAYS WORK.

  • Requirement to add new Document data restriction Field in OLI8BW

    HI        I need to fill in Set Up Tables for 2LIS_12_VCITM (Deliveries) in source system. I want to restrict data only to past 3 years (2008-2010). Currently i dont have an option to select year in the Document Data Restriction area of the statistic

  • LR5.3 incorrect image size export

    When exporting an image and specifying to resize 1500 pixels on the long edge I get this result 2541 x 1500, which is exactly the same result when I specify the short edge. I have tried this with cropped images and with uncropped images, same nonsens