How Encrypt a File Using Key?

Hi Guys,
Here is my problem. I have to create a bank's document encrypted to send to a legacy system. ( Using a KEY to validate the roll process)
I'm thinking to use two scenarios:
1 - Generate the file via ABAP and sent it to a folder in a server to be consuming - SAP ERP.
2 - Generate the file via ABAP, sent it to PI encrypt it via Java Mapping and sent it to a server.
ABAP
First question.
There is a way to generate this file using SHA1 using a Key as parameter?
(CALCULATE_HASH_FOR_CHAR)
Second one.
How can I decrypt this file to test?
Third.
There is others ways to encrypt a file via SAP ERP? UTF-8 and BASE32 are not encrypt codes. They are encoding code.
PI
First
There is a library or other way to encrypt a file without implement a Java Mapping?
Tnks.

> There is a way to generate this file using SHA1 using a Key as parameter?
Why don't you simple search the forum with "SHA1" term, you'd get the answer in an instant
> How can I decrypt this file to test?
> There is others ways to encrypt a file via SAP ERP? UTF-8 and BASE32 are not encrypt codes. They are encoding code.
What encryption do you need?
> But I would like to know if are these methods algorithms as DES, AES, RSA... or others ?
Couldn't you say it at the beginning!
By simply looking at CL_HARD_WIRED_ENCRYPTOR methods, we see that the encryption mechanism is very simple (I'm not expert so I can't tell what it is), I wouldn't rely on it...
I recommend you to read [Note 662340 - SSF Encryption Using the SAPCryptolib|http://service.sap.com/sap/support/notes/662340]. There are also some documentation, security guides on sap library and sap marketplace.
Edited by: Sandra Rossi on Jul 13, 2010 6:51 PM

Similar Messages

  • Encrypting a file using PGP

    Hi All,
    In my scenario i need to pick up a file,encrypt it using PGP and then send it destination folder.
    As i am new to XI ,I don't have any idea how to encrypt the file using PGP.it would be helpful for me if anyone could help me.
    Regards,
    Hemanth.

    I am trying to write a PI module that would allow us to encrypt data in memory before using the File/FTP adapter to either write the data to disk or send the data to an external system.  We want to avoid writing unencrypted data to disk, even for a short time.
    I've written a Java wrapper around the Bouncy Castle cryptographic library.  Piece of cake.  I can receive a String, encrypt it, and return the resulting String.
    Now I'm trying to figure out what to do in the Module with the ModuleData.  I don't have a good example to follow.  I want to take the output data as a String, encrypt it to a new String, and put it back in the ModuleData in a way that the File/FTP adapter can save the data.
    It looks like I'm going to get the XML representation of the data, though.  What I want to encrypt is the text that would have been written out by the File/FTP adapter.
    Any suggestions?
    Thanks,
    -Andy

  • How to upload file using  *cl_gui_frontend_services* method

    hi
    i want to upload an image file using this method
    and i want to save it in MIME Repository (/SAP/BC/BSP/SAP/PRASHANT)
    DATA:
    itab TYPE TABLE OF sflight.
    CALL METHOD cl_gui_frontend_services=>gui_upload
      EXPORTING
        filename                = 'C:\temp\winter.jpg'
        filetype                = 'ASC'
        has_field_separator     = '|'
      CHANGING
        data_tab                = itab
    IF sy-subrc = 0.
    WRITE:/ 'success'.
    ENDIF.
    So plz tel me how i set given path to upload file using this method .

    Hi Prashant,
    Go through the [Link|https://forums.sdn.sap.com/click.jspa?searchID=24477690&messageID=6684222].
    Hope this is helpful.
    Regards,
    Abhinav

  • HOW to read file using ftp???

    Hi to all,
    I have problem with reading file using ftp connection, i want to read only 1024 bytes for one time, and i have
    next code wich read this:
    byte buffer[] = new byte[1024];
    while( (readCount = input.read(buffer)) > 0) {
    bos.write(buffer, 0, readCount);
    but I dont know how to put all read data in one byte[] if i dont know length of file.
    I can't do some like: byte file[] = new file[1000000];
    Thanks for all sugestions!

          * Download a file from a FTP server. A FTP URL is generated with the following syntax:
         * <code>ftp://user:password@host:port/filePath;type=i</code>.
          * @param ftpServer FTP server address (incl. optional port ':portNumber').
          * @param user Optional user name to login.
          * @param pwd Optional password for <i>user</i>.
          * @param fileName Name of file to download (with optional preceeding relative path, e.g. one/two/three.txt).
          * @param destination Destination file to save.
         * @throws MalformedURLException, IOException on error.
         public void download(String ftpServer, String user, String pwd, String fileName, File destination) throws MalformedURLException, IOException {
            if (ftpServer != null && fileName != null && destination != null) {
                StringBuffer sb = new StringBuffer("ftp://");
                if (user != null && pwd != null) { //need authentication?
                    sb.append(user);
                    sb.append(':');
                    sb.append(pwd);
                    sb.append('@');
                }//else: anonymous access
                sb.append(ftpServer);
                sb.append('/');
                sb.append(fileName);
                sb.append(";type=i"); //a=ASCII mode, i=image (binary) mode, d= file directory listing
                BufferedInputStream bis = null;
                BufferedOutputStream bos = null;
                try {
                    URL url = new URL(sb.toString());
                    URLConnection urlc = url.openConnection();
                    bis = new BufferedInputStream(urlc.getInputStream());
                    bos = new BufferedOutputStream(new FileOutputStream(destination.getName()));
                    int i;
                    while ((i = bis.read()) != -1) { //read next byte until end of stream
                        bos.write(i);
                    }//next byte
                } finally {
                    if (bis != null) try { bis.close(); } catch (IOException ioe) { /* ignore*/ }
                    if (bos != null) try { bos.close(); } catch (IOException ioe) { /* ignore*/ }
            }//else: input unavailable
        }//download()If you don't want to strore the data into a file, use ByteArrayOutputStream instead of a FileOutputStream.

  • How to download file using ftp in bash script

    Hi! I'm runnig a bash script in solaris i want within the script to dowload file using ftp
    How can i do it?
    Tanks a lot

    hello,evgchech
    please try this way:
    1. In the bash script, try following command:
    ftp -n < ftpcmdfile2 in the ftpcmdfile (which is a file),coding the interactive commands of FTP such as:
    user anonymous  [email protected]
              cd /var/sun/download
              bi
              mget *.*
              bye
         try it and good luck!
    Wang Yu
    Developer Technical Support
    Sun Microsystems
    http://sun.com/developers/support

  • Encrypt text file using PGP

    Hi all,
    I have a requirement to encrypt a file before sending as email attachment to another party. We have installed PGP to do the encryption. I am able to generate the text file and store in UNIX server. I created a directory in AL11 with the text file. I also created a command in SM69. When i execute the command in sm69, it is throwing me the following message:
    3083:could not create output file
    3090:operation failed, file not found
    External program terminated with exit code 162
    Any idea why?

    Hello Aida ,
    Could you please share ? how did you solve this issue ?
    Thanks & Regards
    Tisha

  • Encrypting a File using Microsoft PKI Basic EFS template

    Hi All;
    I created a basic EFS template on my Lab issuing CA and configured it for auto-enrollment on the domain . After doing that  I created a  new domain user(Test) on the Active directory and logged in to my windows client machine which is windows 7
    enterprise  using that user (TEST). Now since the machine was set up for auto enrollment the EFS certificate gets issued to the user “TEST” as shown below
    Now as per my understanding this Certificate is tied to the User “Test” for doing crypto operation.
    So now I created a folder a folder named “Puneet” on the desktop of Windows 7 machine and created a file “secret.txt” inside and now I selected the properties of the file “ secret” and selected the advanced option in which I get the pop up “Advanced Attributes”
    in that I selected “Encrypt contents to secure data” and now I believe my EFS certificate should come into picture and help me in encrypting the file .
    But it fails with below error
    I have looked into event log and it does not give much information .
    Note: In home Lab setup KRA is up and running on my PKI setup.
    Has any one of you encountered this error while doing crypto operation using PKI . Any pointers are welcomed
    J

    Hi,
    Do you have any progress on this issue?
    If not, please provide more specific details on the error message for further analyzing.
    Best Regards,
    Amy Wang

  • How encrypt msg with Public Key ?

    I want to encrypt my Session Key with the public key of the recipient but how can I do ?
    I know how to encrypt with the Secret Key but not with the Public Key.
    Thanks for response
    Nicolas

    It depends on the cryptosystem of which the public key you are having.
    If it is of RSA then you have to get the cipher of RSA and pass the session key bytes as input to it.

  • How to receive file using bluetooth transfer?

    my nokia lumia 900 was updated to windows 7,8. so, I can use bluetooth transfer but I cant recive file using bluetooth .. I just can send file

    You also need to downloand and install the Bluetooth Share app from the Marketplace before this will work for you. Note that the Bluetooth Share app is not available in some countries. 

  • How to open files using cmd command?

    Hello... First:
    try {
    Process p = Runtime.getRuntime().exec("cmd.exe ?????");
    catch(Exception e){ }well... I'm trying to open files using a cmd command. It's working only oppening files on my own pc, but i need to know if i can open files using a localweb's pc, with the follow address, for example:
    "\\172.21.0.4\firstdir\seconddir\thirddir..."
    Thanks :D

    Gamboua wrote:
    normaly, i type \\172.21.0.4\dir\dir\dir... directly directly in my cmd.This only works because you are already running cmd.exe
    Try getting it to work with cmd.exe at the start of the line.

  • How can zip file using java ?

    I would like to ask is that any package or example code allowing zipping serveral file using java ?

    Here's a test program I wrote, which may help. As far as I know the jip/zar classes are interchangeable.
    import java.io.*;
    import java.util.jar.*;
    public class ZipTest
        public static void main(String[] args) throws Exception
            /* create a file stream for the new zip file */
            FileOutputStream fileOutputStream=new FileOutputStream("test.zip");
            JarOutputStream zipOutputStream=new JarOutputStream(fileOutputStream);
            /* open file to add to zip file */
            File file=new File("test.dat");
            FileInputStream fileInputStream=new FileInputStream(file);
            /* create a buffer and read file into buffer */
            int length=(int)file.length();
            byte[] buffer=new byte[length];
            fileInputStream.read(buffer,0,length);
            /* create entry in zip file */
            JarEntry jarEntry=new JarEntry("test.dat");
            /* add it */
            zipOutputStream.putNextEntry(jarEntry);
            zipOutputStream.write(buffer,0,length);
            /* clean up and exit */
            fileInputStream.close();
            zipOutputStream.close();
    }

  • How to decrypt an encrypted text file using  Algorithm SHA1withRSA .

    I have one encrypted file instance_demo_Encryp.xml and encrypted format is
    MIMVwmYGCSqGSIb3DQEHAqCDFcJWMIMVwlECAQExCzAJBgUrDgMCGgUAMIMVvzoG
    CSqGSIb3DQEHAaCDFb8qBIMVvyU8P3htbCB2ZXJzaW9uPScxLjAnIGVuY29kaW5n
    PSdVVEYtOCcgPz4NCjx4YnJsaTp4YnJsIHhtbG5zOnhicmxpPSdodHRwOi8vd3d3
    Lnhicmwub3JnLzIwMDMvaW5zdGFuY2UnIHhtbG5zOmxpbms9J2h0dHA6Ly93d3cu
    eGJybC5vcmcvMjAwMy9saW5rYmFzZScgeG1sbnM6eGxpbms9J2h0dHA6Ly93d3cu
    dzMub3JnLzE5OTkveGxpbmsnIHhtbG5zOnJlZj0naHR0cDovL3d3dy54YnJsLm9y
    Zy8yMDA0L3JlZicgeG1sbnM6eGJybGR0PSdodHRwOi8veGJybC5vcmcvMjAwNS94
    I want to decrypt and convert into original xml file.I am using below code but some error occurred javax.crypto.BadPaddingException: Data must start with zero.Please help
    import java.io.*;
    import java.math.BigInteger;
    import java.net.URLEncoder;
    import java.util.*;
    import java.security.AlgorithmParameters;
    import java.security.Key;
    import java.security.KeyFactory;
    import java.security.KeyPairGenerator;
    import java.security.KeyStore;
    import java.security.GeneralSecurityException;
    import java.security.MessageDigest;
    import java.security.PrivateKey;
    import java.security.PublicKey;
    import java.security.Signature;
    import java.security.cert.Certificate;
    import java.security.cert.CertificateFactory;
    import java.security.cert.X509Certificate;
    import java.security.spec.RSAPublicKeySpec;
    import java.security.spec.X509EncodedKeySpec;
    import javax.crypto.Cipher;
    import javax.crypto.CipherInputStream;
    import oracle.security.xmlsec.util.Base64;
    import sun.misc.*;
    //import org.bouncycastle.jce.provider.BouncyCastleProvider;
    //import org.bouncycastle.jce.*;
    public class EsignWithBC {
         public static final String KEY_STORE_PASSWORD = "password";
         public static void main(String[] args) {
               BASE64Encoder base64Encoder = new BASE64Encoder();
               BASE64Decoder base64Decoder = new BASE64Decoder();
              String record = null;
              char[] passwd = KEY_STORE_PASSWORD.toCharArray();
              String inputFileName = "webroot/cerFiles/instance_demo_Encryp.xml";
              try {
                   KeyStore keyStore = KeyStore.getInstance("PKCS12");
                   FileInputStream fis = new FileInputStream(
                             "D:\\eclipse_program\\xRnd\\WebRoot\\cerFiles\\AlicePFX.pfx");
                   keyStore.load(fis, passwd);
                   fis.close();
                   Enumeration aliases = keyStore.aliases();
                   while (aliases.hasMoreElements()) {
                        System.out.println(aliases.nextElement());
                   /*FileInputStream fin = new FileInputStream("D:\\eclipse_program\\xRnd\\WebRoot\\cerFiles\\Alice.cer");
                    CertificateFactory cf = CertificateFactory.getInstance("X.509");
                    Collection c = cf.generateCertificates(fin);
                    Iterator i = c.iterator();
                    while (i.hasNext()) {
                       Certificate cert = (Certificate)i.next();
                       System.out.println("***************************************************");
                       System.out.println(cert.getPublicKey());
                       System.out.println("***************************************************");
                    String filename= "D:\\eclipse_program\\xRnd\\WebRoot\\cerFiles\\Alice.cer";
                    FileInputStream fis1 = new FileInputStream(filename);
                    DataInputStream dis = new DataInputStream(fis1);
                    CertificateFactory cf1 = CertificateFactory.getInstance("X.509");
                    byte[] bytes = new byte[dis.available()];
                    dis.readFully(bytes);
                    ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
                    Key key = null;
                    while (bais.available() > 0) {
                       Certificate cert = cf1.generateCertificate(bais);
                       key = cert.getPublicKey();
                       System.out.println(cert.toString());
                   // EsignWithBC obj = new EsignWithBC();
                    //System.out.println(obj.createUrlFragment("alice's key","password","D:\\eclipse_program\\xRnd\\webroot\\cerFiles\\instance_demo_Encryp.xml"));
                    FileReader fr = new FileReader(inputFileName);
                        BufferedReader br = new BufferedReader(fr);
                        byte text[] = null;
                         //System.out.println(text.toString());
                   // Cipher cipher = Cipher.getInstance("SHA1withRSA");
                        KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA");
                        Signature sig = Signature.getInstance("SHA1withRSA");
                        Cipher rsaCipher = Cipher.getInstance("RSA");
                        String str = null;
                         byte[] cleartext1 = null;
                        rsaCipher.init(Cipher.DECRYPT_MODE, key);
                        System.out.println("********************************");
                        while ( (record=br.readLine()) != null ) {
                              text = base64Decoder.decodeBuffer(record);                         
                              cleartext1 = rsaCipher.doFinal(text);
                              //str = new String(cleartext1);
                              System.out.println(rsaCipher.doFinal(text));
                        System.out.println("********************************");
              } catch (Exception e) {
                   e.printStackTrace();
    }

    SHA1withRSA is a signature algorithm and not an encryption. If all you have is the signature then you can never get back the original document. The best you can do is to check that the signature is valid but for that you will need the original document and the public key of the person who signed the document.
    The code you post is not coherent and though I think can see what you are trying to do I am not willing to make guesses at this stage since it sounds like you are trying to do the impossible.

  • How to share files using airport extreme?

    how can i share files between 2 computers connected to a wifi using airport extreme?

    Suggest that you enable File Sharing on both computers. Assuming that you have Macs....
    Open System Preferences (gear icon on the dock)
    Open Sharing
    Enter a check mark next to File Sharing
    Do this on both Macs. Then you will be able to access files one one Mac from the other Mac
    If you have an AirPort Extreme 802.11n, it is also possible to connect a hard drive to the USB port on the Extreme. Computers will be able to access files on this "shared" drive.

  • How to transfer files using Oracle Managed File Transfer from Oracle EBS 12.1.3

    Hello,
    I'm looking for ideas to securely transfer files bi-directional between Oracle EBS 12.1.3 to IIS using Oracle Managed File Transfer and SOA.  Any help is greatly appreciated.
    Thanks

    Hi Hussain,
    In the Note 466649.1
    Edited
    I have installed R12.1.1
    Datafiles on installed on local file system /u01/EBS_DATa/*dbf, *.ctl, *.log
    doing non RAC to RAC conversion with ASM option,
    I am using ASM with RAC and created ASM disks (DATA, FRA, CRS) on Shared SAN disks between node1 and node2 which are DATA for CRD (control, redo and Data) files, FRA for archive files, CRS for cluster files while doing RAC instalation,
    now how i move my CRD on local file system /u01/EBS_DATa/*dbf, *.ctl, *.log to shared ASM disk DATA ???????
    Please describe with step wise,
    Thanks in advance.
    Regards,
    Vara
    Edited by: user13409653 on Jan 3, 2012 12:25 AM
    Edited by: user13409653 on Jan 3, 2012 5:10 AM

  • How to attach files using an applet

    hi,
    i want to know how can i use an applet to upload or attach files in my application
    help me

    Hallo there,
    I am intrested on the same topic but I am not so good to modify the sound sdk demo. Is there anyone willing to share some code?
    Thanks
    Matteo

Maybe you are looking for

  • Photosmart Premium C309 printer using Photo black cartridge when it is not printing pictures

    My printer has started using the Photo black cartridge a lot more than it used to.  I think it is using the Photo Black even when there are no images on the document.  I have had the printer for about 4 1/2 years, and it just started doing this in th

  • Magic mouse gestures not working

    Hi, the gestures of my magic mouse stop working. I've tried another mouse on my laptop and it work I also tried my mouse on another laptop and the same problem happens. it's behaving like a "normal" mouse. Is this a hardware problem? if yes, How do I

  • HR Mini Master - HR-PDC

    Hi, I've set up the standard HR-PDC with the subsystem and send down the HR Mini Master. I've set the background job and all ran successfully until we engage a new person or create an IT0050 record for an existing person. For some reason the new pers

  • JDI - Import 3rd party vendor code?

    I'm currently investigating JDI and how we're going to implement it.  I think we're most likely going to start with a 2+ environment, with perhaps moving to 3 soon after. I have a question regarding 'vendor branches'.  Using a tool such as CVS or Sub

  • Quiz questions in Captivate 7

    I'm fairly new to Captivate, but well-versed with other Adobe products. I'm working on quiz questions in Captivate 7, but maybe (hopefully?) I'm doing it all wrong. Outlined below: Need questions sprinkled throughout the module, we call them "Check Y