Format of key file. Signing and encrypting. Lots of questions!

I'm working with public and private keys. When I use KeyPairGenerator with "RSA" algorithm, I have managed to save my public and private keys in files in binary format. This is great. However, I've asked a colleage to use keytool to generate a key pair, export the public key using the "-rfc" flag. The result is an ASCII representation of the key with "-----BEGIN CERTIFICATE-----" at the top.
Q1. So, how can i read this in? I started looking at Cipher to see if I had to somehow "unwrap" the file.
Q2. If I wanted to write my keys in this ascii format, how would I do that?
Q3. Also, am I getting mixed up between certificates and public keys, or are they synonomous?
Q4. Once I've sorted this out, I want to get an object, serialise it, sign it with my private key and encrypt it with the user's public key. Then finally I want to write it in a portable ascii format. Is this a reasonable thing to do? In all the examples, I can either find encrypting or signing, not both. Anyone got an example?
Thanks, Ian

I've managed to make some progress.
Q1. So, how can i read this in? I started looking at
Cipher to see if I had to somehow "unwrap" the file. I've done this using a CertificateFactory.
>
Q2. If I wanted to write my keys in this ascii format,
how would I do that?I think (correct me if I'm wrong) that Certificates are written in this format, but keys arent.
>
Q3. Also, am I getting mixed up between certificates
and public keys, or are they synonomous?I think (correct me if I'm wrong) that a certificate contains a public key. Not sure that's a complete understanding, but it helps.
>
Q4. Once I've sorted this out, I want to get an
object, serialise it, sign it with my private key and
encrypt it with the user's public key. Then finally I
want to write it in a portable ascii format. Is this a
reasonable thing to do? In all the examples, I can
either find encrypting or signing, not both. Anyone
got an example?Still not sure about this. I can sign with my private key and then verify with my public key, but I'm not able to find examples of encrypting using a cipher that uses a public key. All the examples I've found are DES which I believe us a symmetrical algorithm using a secret key.
Thanks again.

Similar Messages

  • Issue while Signing and Encrypting the PDF Document.

    Hello,
    I am developing one component in VC++(MFC) which signs and encrypts the pdf documents.
    When i sign and encrypt pdf document using my component, I am getting following error while opening the document in Adobe Acrobat
    Error during signature verification
    Unexpected byte range values defining scope of signed data.
    Details: The signature byte range is invalid
    But if i open that document in binary mode and calculate the byte range its looking correct.
    The Process for signing and encrypting the PDF document is as follows :
    1)Prepare the PDF document for signing (Add Annotation objects,n0,n2
    layers,create blank signature field,new xref section etc.)
    2)Encrypt the whole document(Password based encryption).
    3)Put the ByteRange values.
    4)Write the signature in blank signature field.
    If i just perform encryption(128 bit RC4 Algorithm) on the pdf document its working fine.Only after adding the signature objects i am getting above error.I think it means something is wrong in signature related objects,but i am not able to recognize the exact problem.
    So what can be the issue?
    Please Help
    Thanks in Advance
    Priyanka

    I am sending the Sample Files
    blank.pdf file is a original file
    http://www.2shared.com/file/4677649/3f341d92/blank.html
    step 1: I am adding Signing object(without data in Contents<> key) in
    blank.pdf file.
    Output File is Prepared-blank.pdf
    http://www.2shared.com/file/4677648/48332d04/Prepared-blank.html
    step 2: Sending Prepared-blank.pdf file for encryption.
    Output File is SignednEncrypted-blank.pdf which is Encrypted and Signed.
    http://www.2shared.com/file/4677647/d88c3095/SignednEncrypted-blank.html
    Password for opening SignednEncrypted-blank.pdf is : "a".
    Please help.
    Thanks.

  • Signing and Encryption Error PI 7.0

    Hi All,
    The scenario is
    1) Two XI boxes are connecting with each other using XI adapter. Earlier there was signing and encryption  certificate used
    for data transfer and was working successfully.
    2) From last 2-3 weeks source XI system is getting error in Call adatper as mentioned below. Then we tried to remove signing and encryption certificate so we disable both end the security check.  And tried to send normal message but then also we are getting following error in Call adapter in SXI_MONITOR
    Signature error Error while valdiating the digital signature. Theerror was com.sap.security.core.ws.wss.NoSecurityHeaderException No wsse:Security header has been defined for role soap:finalActor. Please verify the
    Error during message security handling in inbound channel: Security profile 'Check Signature and Decrypt Message'
    3) The SM59 connection is working fine. We have tried cache refresh. But still issue is not resolved.
    Please guide

    Hi Abhay
    Probably the issue is with the public keys which are stored in both the XI boxes , as both the keys will be same .
    Also check digital signatures which are maintained .
    Regards
    Ninad

  • Sap PI-xml Digital Signing and encryption in PI-ehp1

    Hi Experts,
    Our Business scenario is sap R/3 (sender)>rfc data to PI and to webservice(receiver) using rfc and soap adapters
    The communication channels are secured by snc/ssl.
    Now the issue is PI have to send digitally sign and encrypt xml messages to receiver and I got no clue how to do this.
    Experts please advise.
    We have to Digitally sign and encrypt xml messages in PI
    1)can we use SAML or Ssfdata xml..if so how to use them,can you send me some documents with screen shots so that i can configure the same in PI
    We used adepative tool but it does not support Dsigning
    2)Please advise the correct procedure
    3)how to develop a adapter user module and how to call it for testing purpose...please advise
    O/s:windows
    PI EHP1 7.1
    DB:oracle
    PLEASE HELP
    Thanking you
    Pooja

    Hi Experts,
    Please Advise for my above querys
    1)I tried to develop a EJB project and generate EAR file and depoly it in J2ee server and create adapter modules to call It..however I tried to use a document provided my sdn http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/c0b39e65-981e-2b10-1c9c-fc3f8e6747fa?quicklink=index&overridelayout=true................however I am unable to see the options provided ,unable to create EAR project and unable to see deploy option,please can you share a correct document irrespective of nwds SP level
    2)Apart from giving JNDI name in module tab,what else should be mentioned for a small test message request/response
    3)How to call the adapter for testing purpose apart from monitoring audit logs
    Please Advise Experts
    Thanking you
    Pooja

  • Simple question involving data signing and encryption

    What is exactly mean by signing and encrypting data?
    And how would it apply to the case of a web browser..where I have to sign and encrypt data to and from a web browser? In this case it is an output and input stream.
    Does every byte have to be signed or just the starting bytes? Singing every byte would make the process slow and inefficient

    I know if you you sign and encrypt the data to the
    web browser, it will obviously not be recognized but
    this is my scenario:Your ASCII art didn't come across at all, I'm afraid - I'm not sure what you were going for, but I can't seem to recreate it. I think I can follow the explanation, though.
    P is the program i am developing. It is supposed to
    encrypt and sign data to and from the web browser.
    P1 get the web browser request, encrypts the data
    a and is supposed to sign the data...send it
    to P2 which decrypts and verifies the signing which
    then forwards it to the proxy or the server as seen.
    Vice versa from the server response.So you're working on a web-proxy that encrypts it's transmissions, and you want to add signature verification as well.
    My question still remains...how do you sign a stream?I answered your question, actually. You don't sign "streams" - you sign "messages". In your case, you sign the entire transmission, and then you transmit it.
    Right now I am using RSA keys to send a symmetric key
    across safely for the decryption etc I have the
    encryption/decryption process covered and the browser
    works..but i didn't do signing of any sort...how to
    implement this..for every byte? Is signing necessary?Given your requirements, I have to ask - why are you re-creating SSL? If you have P1 and P2 talk SSL to each other, you get everything you've described here, including signing. I don't understand why you feel the need to recreate an existing protocol.
    Grant

  • Signed and encrypted message

    I am working on a applicaion that can load a message from a third party software.
    The message is signed and encrypted and will be sent via https.
    My application is running on the Tomcat 5.0.24
    And I have certificate from the third party software
    However, I don't know **how** to use the certificate to decrypted the message.
    For example, do I need to write Java code to decrypted the message or does Tomcat take care of the decryption?
    If I need to write the code to decrypted the message, what API I should use?
    If Tomcat cares of the decryption, how does it work? Do I need to modify the configuration file and how?
    Thanks.

    Jenny_Run wrote:
    However, I don't know **how** to use the certificate to decrypted the message.You don't use a certificate to decrypt since certificates are public so anyone could decrypt.
    As for the rest, the devil is in the detail and you don't give any.

  • Signing and encrypting the message

    Hi all,
    How we can do signing and encryption of message with multiple certificates at XI adapter.As it's a XI adapter,we can't use adapter modules for this purpose..
    What's the other way around?Any Clues..??
    Thanks,
    Anoop

    I want signed and encrypted file on my target side from my second XI server.But i have to use FTPS receiver adapter at my second XI server.Now while encrypting my msz,i m have to use multiple certificates.The problem and limitation is, that the FTPS adapter is only taking/accepting the first SOAP attachment and is ignoring any further. This means, that the attached signature would be ignored by FTPS adapter.So, m validating the same at my First XI server so that it goes a single message to my second XI server.Hope it's clear now..
    Thanks,
    Anoop

  • Mail Signing and Encryption Algorithms

    Hi,
    Is there a way to select which algorithms are used for signing and encryption when using S/MIME with the Mac Mail app?
    Thanks and regards,
    Phil.

    Hi Abhay
    Probably the issue is with the public keys which are stored in both the XI boxes , as both the keys will be same .
    Also check digital signatures which are maintained .
    Regards
    Ninad

  • Mesage-Level Signing AND Encrypting Web Services?

    Hello,
    I have a Web Service on a Weblogic 9.2 that is able to encrypt or sign it's output messages but when I want to use both together I get the following error:
    WSSecurityException: Signature failed to validate. Reference: #Body_B1Zi6a4UPGCpLPRh does not validate.
    Could this be an ordering problem of signing and encryption and do I have any influence on what should be done first?
    By the way signing and encrypting input messages from a consumer works fine. I'm not using any user defined ws-policy files.
    thanks for help
    spunti999

    I found out now that encryption alone does not work properly as I thought it would. The messages look fine on TCP-Monitor and I get no Exception or error message but the response content is empty, all fields are null.
    Does anybody know if there is a bug with empty encrypted responses? (Sending and encrypted Request to the service works and it's content fields are not empty.)
    regards
    spunti999
    Edited by spunti999 at 08/10/2007 3:38 AM

  • Can't digitally sign and encrypt email any longer.

    I used to sign and encrypt my emails digitally and then send them to people. I had two email certificates from Comodo, and it's been a while they're expired. so I renewed my certificates and deleted the old ones from my keychain, then downloaded and added the new ones. The trouble is I no longer get the digitally sign the message and encrypt the message button when I compose a new email. What could be the problem? how can I fix this?

    I am now having the same problem.  Have you seen a resolution yet?

  • Looking for "PDF Public-Key Digital Signature and Encryption Specification"

    Hi,
    i am looking for the following ("old") document:
    PDF Public-Key Digital Signature and Encryption Specification
    Originally i could be found here:
    http://partners.adobe.com/asn/developer/acrosdk/DOCS/ppk_pdfspec.pdf
    But not anymore. Does somebody of you still have it? Adobe today just offers the latest documents but i specifically need that older version.
    Or is there an archive i don't know of?
    Thanks for your help,
    ToM

    You can read the PDF 1.5 specification OR even ISO 32000-1 itself for that information. Each feature is "tagged" with the specific version in which it was introduced.
    Digital Signatures were first introduced in Acrobat 4 (PDF 1.3) and have seen various improvements which each version since.

  • Encoding configuration for signed and encrypted emails

    I have a 8820 device (no BES server)  - I have certificates downloaded and trust on the device.  I can attach the requisite certificates to the message, but I do not have the option to select signing or encrypting encoding.  the menu does not give me this option.  I have the S/MIME package installed.  Any thoughts / pointers?

    The S/MIME support package is only supported with a BES. You might try Djigzo for BlackBerry. Djigzo for BlackBerry is an add-on to the Djigzo Email Encryption Gateway which can be used to send and receive S/MIME digitally signed and encrypted email from a BlackBerry smartphone. An installation of the Djigzo gateway is required.
    Djigzo for BlackBerry and the Djigzo gateway is open source and can be freely used.
    For more information see www.djigzo.com
    Djigzo open source email encryption

  • How can I sign and encrypt massage to send via rmi ??

    Hi,,,
    I want to sign a massage with RMI client private key and then encrypt the message with the signature using the RMI server public key.
    How can I do this ?

    I suspect you won't like my answer but a good starting point is "Beginning Cryptography with Java" by David Hook published by Wrox.
    P.S. It is much more secure to use RMI with secure sockets since this provides both authentication and encryption and most of the work is done by existing system libraries.

  • Signed and Encrypted Emails

    Hi all,
    I'm having issues with viewing Signed or Signed & Encrypted emails, I'm using iOS 4.1 and have added my email certificates using IPhone Configuration Tool.
    Any help would be good.
    Thanks
    Greg

    LiveCycle does not handle signed or encrypted emails out of the box.
    You could develop a component to do this, or you could get someone to develop it for you.
    Email us at info-at-avoka.com if you'd like to discuss further.
    Howard
    http://www.avoka.com

  • Handling digitally signed and encrypted emails

    Hi all,
    Is it possible to handle digitally signed emails with LiveCycle ES?
    And what about encrypted emails?
    Sincerely
    Kim Christensen

    LiveCycle does not handle signed or encrypted emails out of the box.
    You could develop a component to do this, or you could get someone to develop it for you.
    Email us at info-at-avoka.com if you'd like to discuss further.
    Howard
    http://www.avoka.com

Maybe you are looking for