Encrypt in C - Decrypt in Java

Hi,
I need to encrypt a message in C and decrypt it in Java using DES algorithm. When trying to decrypt the message im getting :
javax.crypto.BadPaddingException: Given final block not properly padded
at com.sun.crypto.provider.DESCipher.engineDoFinal(DashoA6275)
at com.sun.crypto.provider.DESCipher.engineDoFinal(DashoA6275)
I'm using the same key for encryption and decryption(maybe the C program using the key differently than the Java program).
Is it possible to encrypt a message in C and decrypt it in Java ?
Thanks in advance for your help.
Nir.

Can you decrypt in C? It sounds as if the encryption hasn't been performed correctly in C or like the key being used doesn't correspond to the decryption key. I'd initially get it working in C first both encryption and decryption then try to get it working in Java. I don't see any problem with getting C to encrypt and Java to decrypt as they should both be working to the same standard practices.
The last time I had a problem with a bad padding exception the answer lay in the key I was using and the keystore I was retrieving the key from.

Similar Messages

  • Re: encrypting in c#, decrypting in java

    Hello,
    I am trying to use RSA so I can encrypt in c# (encrypt a password) and decrypt it in my web service to check the password.
    But, I am having some problems when I try to read in the file with my private key. I am currently getting an error of: too much data for RSA block.
    I am using bouncycastle for the algorithms.
    Has anyone seen any example of encrypting in C# and decrypting in Java?
    Thanx.

    Your C# may be using padding without your knowledge...
    This is from the docs for C# RSACryptoServiceProvider:
    public byte[] Encrypt(
    byte[] rgb,
    bool fOAEP
    rgb The data to be encrypted
    fOAEP true to perform direct RSA encryption using OAEP padding (only available on a computer running Microsoft Windows XP or later); otherwise, false to use PKCS#1 v1.5 padding.
    It looks like Bouncy Castle's RSA can use either no padding or OAEP (please correct me if Im wrong,
    I couldnt find documentation for this). So you'll have to figure out how to sync the two up.

  • One file  Encrypt in VB using 3DES how to  Decrypt in Java ?

    one file Encrypt in VB using 3DES how to Decrypt in Java ?
    plese give me code
    shrinath

    My problem is something similar to him, but mine is in Tandem C. I have a encrypted text, which was encrypted in Tandem C using OpenSSL. I used CBC mode with no padding, i just wrote the encrypted text to a file & i tried reading the cipher from a Java program, so as to decrypt using the same CBC mode & no padding mode. but it is not decrypted as intended to be.
    can u pls give ur comment? if u have any code can u pls share it here?

  • Weblogic.security.internal.encryption.EncryptionServiceException: Error decrypting Secret Key

    Hi all,
    I have one admin server 8 managed servers in cluster environment. I am using node
    manager to start managed servers. I used the demo certificate and private key
    file provided by BEA before getting my real certificate, but when I got the real
    certificate the node manager can't no more. The error I am getting is this :
    <Dec 24, 2002 10:01:27 AM EST> <Info> <NodeManager> <NodeManager: for information
    on command line options, try "java weblogic.nodemanager.NodeManager help">
    <Dec 24, 2002 10:01:27 AM EST> <Info> <NodeManager> <Starting NodeManager >
    Exception in thread "main" weblogic.security.internal.encryption.EncryptionServiceException:
    Error decrypting Secret Key
         at weblogic.security.internal.encryption.JSafeSecretKeyEncryptor.decryptSecretKey(JSafeSecretKeyEncryptor.java:119)
         at weblogic.security.internal.encryption.JSafeEncryptionServiceImpl.<init>(JSafeEncryptionServiceImpl.java:205)
         at weblogic.security.internal.encryption.JSafeEncryptionServiceFactory.getEncryptionService(JSafeEncryptionServiceFactory.java:23)
         at weblogic.nodemanager.NodeManager.initializeEncryptionService(NodeManager.java:727)
         at weblogic.nodemanager.NodeManager.init(NodeManager.java:425)
         at weblogic.nodemanager.NodeManager.main(NodeManager.java:649)
    --------------- nested within: ------------------
    weblogic.security.internal.encryption.EncryptionServiceException - with nested
    exception:
    [weblogic.security.internal.encryption.EncryptionServiceException: Error decrypting
    Secret Key]
         at weblogic.security.internal.encryption.JSafeEncryptionServiceImpl.<init>(JSafeEncryptionServiceImpl.java:226)
         at weblogic.security.internal.encryption.JSafeEncryptionServiceFactory.getEncryptionService(JSafeEncryptionServiceFactory.java:23)
         at weblogic.nodemanager.NodeManager.initializeEncryptionService(NodeManager.java:727)
         at weblogic.nodemanager.NodeManager.init(NodeManager.java:425)
         at weblogic.nodemanager.NodeManager.main(NodeManager.java:649)
    here is the setting of node manager
    # Set user-defined variables.
    BEA_HOME="/opt/app/weblogic"
    WL_HOME=${BEA_HOME}/weblogic700
    NODEMGR_HOME=${BEA_HOME}/common/nodemanager/config
    JAVA_HOME=${BEA_HOME}/software/j2sdk1_3_1_06
    #Set NODEMANAGER variables
    NODEMANAGER_CERTIFICATEFILE=${NODEMGR_HOME}/uxmwpr01_nam_pwcinternal_com-cert.pem
    NODEMANAGER_KEYFILE=${NODEMGR_HOME}/uxmwpr01_nam_pwcinternal_com-key.der
    NODEMANAGER_KEYPASSWORD="wR2DfgiHjF0m4"
    NODEMANAGER_LISTENADDRESS="uxmwpr01"
    NODEMANAGER_LISTENPORT="5501"
    NODEMANAGER_REVERSEDNS="true"
    NODEMANAGER_SSLVERIFICATION="true"
    NODEMANAGER_STARTTEMPLATE=${NODEMGR_HOME}/startManagedWeblogic
    NODEMANAGER_SSLTRUSTED=${WL_HOME}/server/lib/cacerts
    NODEMANAGER_JAVASECURITY=${WL_HOME}/server/lib/weblogic.policy
    NODEMANAGER_TRUSTEDHOSTS=${NODEMGR_HOME}/nodemanager.hosts
    NODEMANAGER_NATIVEIO="true"
    ${JAVA_HOME}/bin/java ${JAVA_VM} ${MEM_ARGS} ${JAVA_OPTIONS} -classpath "${CLASSPATH}"
    -Dbea.home=${BEA_HOME} -Dweblogic.security.SSL.trustedCAKeyStore=${NODEMANAGER_SSLTRUSTED}
    -Djava.security.policy=${NODEMANAGER_JAVASECURITY} -Dweblogic.nodemanager.javaHome=${JAVA_HOME}
    -Dweblogic.ListenAddress=${NODEMANAGER_LISTENADDRESS} -Dweblogic.ListenPort=${NODEMANAGER_LISTENPORT}
    -Dweblogic.nodemanager.certificateFile=${NODEMANAGER_CERTIFICATEFILE} -Dweblogic.nodemanager.keyFile=${NODEMANAGER_KEYFILE}
    -Dweblogic.nodemanager.keyPassword=${NODEMANAGER_KEYPASSWORD} -Dweblogic.nodemanager.reverseDnsEnabled=${NODEMANAGER_REVERSEDNS}
    -Dweblogic.nodemanager.startTemplate=${NODEMANAGER_STARTTEMPLATE} -Dweblogic.nodemanager.sslHostNameVerificationEnabled=${NODEMANAGER_SSLVERIFICATION}
    -Dweblogic.nodemanager.trustedHosts=${NODEMANAGER_TRUSTEDHOSTS} -Dweblogic.nodemanager.nativeVersionEnabled=${NODEMANAGER_NATIVEIO}
    weblogic.nodemanager.NodeManager

    "Jas" <[email protected]> wrote in message news:<3e657be5$[email protected]>...
    Hi,
    I am wondering if anyone has tried creating a domain on a weblogic server by copying
    and pasting an entire domain directory. ie. Copying %bea_home%\config\DomainName
    to the new installation %bea_home%\config\DomainName.
    When I do this I get the following error when starting up the weblogic server:
    "The WebLogic Server did not start up properly. Exception raised:
    weblogic.security.internal.encryption.EncryptionServiceException:Error decrypting
    Secret Key" when loading config.xml
    I assume this is because the weblogic system password is encrypted in the config.xml
    file. Is there anyway I can get around this so I can easily clone weblogic servers?
    Thanks,
    JasJas,
    Yeah the security key is tied to the server, what exactly are you
    trying to accomplish? Do you want seperate domains or servers? Are
    they on different physical servers?
    Also what version of wls? 6 or 7?
    Will try to help you if I can
    Steve

  • Error decrypting with Java Cipher

    My program encrypts properly, but while decrypting I get this error:
    Error Input length (with padding) not multiple of 8 bytes
    Any idea??? Please, HELP!
    protected byte[] decrypt(byte[] buffer,char[] passwd)
             byte[] salt={(byte)0xd4,(byte)0xa3,(byte)0xff,(byte)0x9e,(byte)0x12,(byte)0xc7,(byte)0xd0,(byte)0x84};
             byte[] plainTxt=null;
             Cipher c=null;
             PBEParameterSpec paramSpec=null;
             SecretKey passwordKey=null;
             try
                 paramSpec=new PBEParameterSpec(salt,20);
                 PBEKeySpec keySpec=new PBEKeySpec(passwd);
                 SecretKeyFactory kf=SecretKeyFactory.getInstance("PBEWithMD5AndDES");
                 passwordKey=kf.generateSecret(keySpec);
                 c=Cipher.getInstance("PBEWithMD5AndDES");
                 c.init(Cipher.DECRYPT_MODE, passwordKey, paramSpec);
                 plainTxt=c.doFinal(buffer);  
             catch (Exception e)
                 System.out.println("Error "+ e.getMessage());
                 System.exit(0);
             return plainTxt;
        }

    Below is the test harness I wrapped round your code and for me it works without the errors you say you get!
    Your code could be made much more rugged and efficient but it works.
    import javax.crypto.*;
    import javax.crypto.spec.*;
    import java.security.*;
    import java.security.spec.*;
    public class Test4 {
      protected byte[] decrypt(byte[] buffer,char[] passwd) {
        byte[] salt={(byte)0xd4,(byte)0xa3,(byte)0xff,(byte)0x9e,(byte)0x12,(byte)0xc7,(byte)0xd0,(byte)0x84};
        byte[] plainTxt=null;
        Cipher c=null;
        PBEParameterSpec paramSpec=null;
        SecretKey passwordKey=null;
        try {
          paramSpec=new PBEParameterSpec(salt,20);
          PBEKeySpec keySpec=new PBEKeySpec(passwd);
          SecretKeyFactory kf=SecretKeyFactory.getInstance("PBEWithMD5AndDES");
          passwordKey=kf.generateSecret(keySpec);
          c=Cipher.getInstance("PBEWithMD5AndDES");
          c.init(Cipher.DECRYPT_MODE, passwordKey, paramSpec);
          plainTxt=c.doFinal(buffer);
        } catch (Exception e) {
          System.out.println("Error "+ e.getMessage());
          System.exit(0);
        return plainTxt;
      protected byte[] encrypt(byte[] buffer,char[] passwd) {
        byte[] salt={(byte)0xd4,(byte)0xa3,(byte)0xff,(byte)0x9e,(byte)0x12,(byte)0xc7,(byte)0xd0,(byte)0x84};
        byte[] cipherTxt=new byte[buffer.length];
        Cipher c=null;
        PBEParameterSpec paramSpec=null;
        SecretKey passwordKey=null;
        try {
          paramSpec=new PBEParameterSpec(salt,20);
          PBEKeySpec keySpec=new PBEKeySpec(passwd);
          SecretKeyFactory kf=SecretKeyFactory.getInstance("PBEWithMD5AndDES");
          passwordKey=kf.generateSecret(keySpec);
          c=Cipher.getInstance("PBEWithMD5AndDES");
          c.init(Cipher.ENCRYPT_MODE,passwordKey,paramSpec);
          cipherTxt=c.doFinal(buffer);
        } catch (Exception e) {
          System.out.println("Error "+ e.getMessage());
          System.exit(0);
        return cipherTxt;
      public static void main(String[] args) {
        try {
          // Make sure SUN are a valid provider
          Security.addProvider(new com.sun.crypto.provider.SunJCE());
          char[] passphrase = "sabre150".toCharArray();
          Test4 agent = new Test4();
          // Get the dataString to encrypt from the command line
          String dataString = "The quick brown fox jumps over the lazy dog.";
          byte[] dataBytes = dataString.getBytes("UTF8");
          System.out.println("Data string ....................[" + dataString + "]");
          // Encrypt the data
          byte[] encryptedBytes = agent.encrypt(dataBytes, passphrase);
          // Decrypt the data
          byte[] recoveredDataBytes = agent.decrypt(encryptedBytes, passphrase);
          String recoveredDataString = new String(recoveredDataBytes, "UTF8");
          System.out.println("Recovered data string ..........[" + recoveredDataString + "]");    
        } catch (Exception e) {
          e.printStackTrace();
    }

  • How to save encrypted mail in decrypted form?

    This should not be so difficult on a Mac. Searching archives found a locked thread in 10.4 which was not properly resolved.
    How to to save an encrypted email in decrypted form?
    The wrong answer is to say, "You don't have to, only a certificate's ability to encrypt expires." As to why this is wrong, 1) I want to. And 2) Because the US Government in their infinite infallible wisdom deletes my prior certificate from CAC when issuing a new CAC. Can't copy certificates off a smart card.
    So once the integrity of the email has been verified I want to strip the encryption off so it will be accessible in the future and accessible without having to dig for the CAC, have a smart card reader, and have the necessary software installed.
    Using redirect shift-option-E to send the email back to myself only changed the certificate (to mine) but with the original From address so it was flagged as broken. All the while I thought I was forwarding it w/out encryption. And if thats not bad enough the original disappeared. The good news is a copy was left in my Send folder in the format desired, no encryption.

    Once the cert expires, you will no longer be able to use it to encrypt or sign mail. However, you can still use it to decrypt messages that you have received. Just leave it in your keychain, and everything will continue to work without changes. If you look at your keychain, you will see it listed, but marked expired.
    Likewise, other people that have the expired public key will be able to use that key to verify the signature or decrypt your messages; they will be notified as appropriate that the key has expired.
    If you do not want to spend money on a new cert, you may be able to get a free one from Thawte, or perhaps use the one available from Apple. Enable encryption in iChat, which generates a .Mac cert for you. Once that process has completed, open Keychain Access, go to preferences, and set "Search .Mac for certificates" and restart mail. That should allow you to use the iChat certificate for mail.

  • Encrypt in javascript and decrypt in java

    hi guys,
    iam in a strange situation, my requirement is to encrypt the user entered details thr javascript and decrypt in those in java.
    i need some ideas
    thanku

    Why don't you just use SSL? Then the entire communication is encrypted.

  • Encryption in javascript and how to decrypt in java

    Hi all,
    I have encrypted password entered by user in javascript using the code shown below and then how can i decrypt the password in java to move further.
    function Encrypt(theText) {
    alert("---");
    output = new String;
    Temp = new Array();
    Temp2 = new Array();
    TextSize = theText.length;
    for (i = 0; i < TextSize; i++) {
    rnd = Math.round(Math.random() * 122) + 68;
    Temp[i] = theText.charCodeAt(i) + rnd;
    Temp2[i] = rnd;
    for (i = 0; i < TextSize; i++) {
    output += String.fromCharCode(Temp, Temp2[i]);
    return output;
    thanks in advance.

    Could you please tell me which algorithm can i use can you suggest me with the code .
    My requirement is
    I want to encrypt password before submitting the form and then i want to pass the decrypted value into the scriptlets java code of same jsp could you please suggest me.

  • RSA with Cryptix: can encrypt but not decrypt? Please help.. :)

    Hi all,
    I've been trying to do RSA encryption/decryption using a pair of keys created with keytool. I've been able to encrypt some bytes, but when I attempt to decrypt the results immediately using the private key, I received the following exception:
    IllegalBlockSizeException: RSA: Cipher in DECRYPT state with an incomplete final block
    Please can anyone save me out of my misery and shed some light on this problem? Thanks a great deal in advance.
    Best Regards,
    Kenshin
    Here are the code snippets:
    // 1. imported APIs:
    import javax.net.ssl.*;
    import java.io.*;
    import java.security.*;
    import java.security.interfaces.*;
    import java.security.spec.*;
    import java.security.cert.*;
    import java.security.cert.Certificate;
    import javax.crypto.*;
    import javax.crypto.spec.*;
    import cryptix.provider.Cryptix;
    import xjava.security.Cipher;
    import xjava.security.CipherInputStream;
    import xjava.security.CipherOutputStream;
    import xjava.security.interfaces.*;
    import cryptix.provider.rsa.*;
    // 2. Getting the Public Key from the created cert:
    File certFile = new File("c:/keystore/jbossSSL.cer");
    FileInputStream certFileInStream = new FileInputStream(certFile);
    CertificateFactory cf = CertificateFactory.getInstance("X509");
    Certificate cert = (Certificate)cf.generateCertificate(certFileInStream);
    RSAPublicKey serverPublicKey = (RSAPublicKey)cert.getPublicKey();
    // 3. Doing the encryption:
    Security.addProvider( new cryptix.provider.Cryptix());
    Cipher cipherInstance = Cipher.getInstance("RSA/ECB/PKCS7", "Cryptix");
    CryptixRSAPublicKey vCryptixRSAPubKey = (CryptixRSAPublicKey) new RawRSAPublicKey(serverPublicKey.getPublicExponent());
    cipherInstance.initEncrypt(vCryptixRSAPubKey);
    System.out.println("String to be encypted: " + sRandomString);
    // Sample of what is printed: String to be encypted: 2201162506010696613
    ByteArrayInputStream clearTextInStream = new ByteArrayInputStream(sRandomString.getBytes());
    CipherInputStream cInStream = new CipherInputStream(clearTextInStream, cipherInstance);
    ByteArrayOutputStream cipherTextOutStream = new ByteArrayOutputStream();
    CipherOutputStream cOutStream = new CipherOutputStream(cipherTextOutStream, cipherInstance);
    byte[] buffer = new byte[8192];
    int length;
    while((length= cInStream.read(buffer))!=-1)
    cOutStream.write(buffer, 0, length);
    cOutStream.close();
    cInStream.close();
    cipherTextOutStream.close();
    clearTextInStream.close();
    String sEncodedString = new String(cipherTextOutStream.toByteArray());
    System.out.println("String encrpted: " + sEncodedString);
    // Sample of what is printed: String to encrpted: 2 2 01 1 6 25 0 6 01 0 6 96 6 1 3&#9786; &#9787;&#9787;
    // 4. Getting the Private key from the keystore
    FileInputStream in = new FileInputStream("C:/keystore/jbossSSL.keystore");
    KeyStore catalinaKeyStore = KeyStore.getInstance("jks");
    catalinaKeyStore.load(in, "jbossSSL".toCharArray());
    RSAPrivateKey privateK = (RSAPrivateKey)catalinaKeyStore.getKey("jbossSSL", "jbossSSL".toCharArray());
    CryptixRSAPrivateKey vCryptixRSAPriKey = (CryptixRSAPrivateKey) new RawRSAPrivateKey(privateK.getPrivateExponent(), privateK.getModulus());
    cipherInstance.initDecrypt(vCryptixRSAPriKey);
    // 5. Doing the decryption:
    ByteArrayInputStream cipherTextInStream = new ByteArrayInputStream(sEncodedString.getBytes());
    cInStream = new CipherInputStream(cipherTextInStream,cipherInstance);
    ByteArrayOutputStream clearTextOutStream = new ByteArrayOutputStream();
    cOutStream = new CipherOutputStream(clearTextOutStream,cipherInstance);
    while((length= cInStream.read(buffer))!=-1)
    cOutStream.write(buffer, 0, length); >> exception thrown here
    cOutStream.close();
    cInStream.close();
    clearTextOutStream.close();
    cipherTextInStream.close();
    String sDecodedString = new String(clearTextOutStream.toByteArray());
    System.out.println("Stringdecrpted: " + sDecodedString);

    Here is working RSA example Maybe will help you. (may has a few typing errors becosu I rmoved some confidential data ;) )
    import java.util.*;
    import javax.swing.*;
    import java.io.*;
    import java.security.*;
    import javax.crypto.Cipher;
    import xjava.security.*;
    import cryptix.provider.Cryptix;
    import xjava.security.interfaces.CryptixRSAPublicKey;
    import xjava.security.interfaces.CryptixRSAPrivateKey;
    import xjava.security.KeyGenerator;
    import xjava.security.SecretKey;
    public class testcipher extends javax.swing.JFrame{
        /** Creates new test */
        public testcipher() throws Exception {
        * @param args the command line arguments
        public static void main(String [] args) throws Exception  {
            Provider pd = new cryptix.provider.Cryptix();
            Security.addProvider(pd);
            KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA", "Cryptix");
            kpg.initialize(1024, new java.security.SecureRandom());
            System.out.println("Generating key pair...");
            KeyPair kp = kpg.genKeyPair();
            System.out.println("Key pair generated...");
            xjava.security.Cipher cp = xjava.security.Cipher.getInstance("RSA/ECB/PKCS7", "Cryptix");
            cp.initEncrypt(kp.getPublic());
            FileInputStream fis = new FileInputStream("c:\\temp\\b2b\\index.htm");
            CipherInputStream cin = new CipherInputStream(fis, cp);
            FileOutputStream fout = new FileOutputStream("C:\\temp\\b2b\\enc.htm");
            CipherOutputStream cout = new CipherOutputStream(fout, cp);
            byte[] buffer = new byte[8192];
            int length;
            while((length=cin.read(buffer))!=-1)
                cout.write(buffer, 0, length);
            cout.close();
            cin.close();
            fout.close();
            fis.close();
            cp.initDecrypt(kp.getPrivate());
            fis = new FileInputStream("c:\\temp\\b2b\\enc.htm");
             cin = new CipherInputStream(fis, cp);
             fout = new FileOutputStream("C:\\temp\\b2b\\dec.htm");
             cout = new CipherOutputStream(fout, cp);
                    while((length=cin.read(buffer))!=-1)
                cout.write(buffer, 0, length);
            cout.close();
            cin.close();
            fout.close();
            fis.close();
    }

  • Convert Data encryption code from VB to Java.

    Can anyone help me in converting the following code from VB to Java?
    'Purpose: This function decrypts the password of the user in the database so that
    ' it can be matched accurately with the inputted password of the user in
    ' the Log-In form (Case-sensitive)
    'Function to decrypt password
    Public Function Decrypt(ByVal Encrypted As String)
    On Error GoTo ErrorRoutine
    For intEncryptDecrypt = 1 To Len(Encrypted)
    strLetter = Mid(Encrypted, intEncryptDecrypt, 1)
    Mid(Encrypted, intEncryptDecrypt, 1) = Chr(Asc(strLetter) - 1)
    Next
    Decrypt = Encrypted
    Exit Function
    ErrorRoutine:
    Err.Raise Err.Number, , Err.Description
    Exit Function
    End Function

    hi,
    try this
    public String decrypt(String a){
        for(int i=0;i<a.length();i++){
          char c=a.charAt(i);
          c--;
          a=a.substring(0,i)+c+a.substring(i+1);
      return a;
    }regards

  • Encrypt on CLR decrypt in SQL?

    Hi folks,
    I'm trying to encrypt a small token of data on my client c# application and have it decrypted by SQL on the server side, the problem is i cannot find articles on the subject. I don;t really want to get involved with certificates but base the system on a simple symmetric key that is shared by both parties.
    I'm attempting to use the TRIPLE_DES algorithm on both sides and thus far have used the decryptbypassphrase on the server side with the data encrypted on the client side by .Net with no initialization vector setup.
    If anyone can recommend any articles or have example (client and server side) code for this situation it would be greatly appreciated.
    Many thanks in advance
    Simon

    I tried doing the exact same thing and so far didn't find a way of doing it. Even though both .net and sql server uses Triple DES algorithm I can not decrypt the string generated in .net from SQL Server.
    I .net i use simple provider with a key and a vector. I assume the key corresponds to a passphrase in SQL Server, but unfortunetely I do not know what vector corresponds to.
    .NET CODE
    public static string Encrypt(string strPlainText)
    string strKey16 = "123456789012345";
    TripleDESCryptoServiceProvider crp = new TripleDESCryptoServiceProvider();
    UnicodeEncoding uEncode = new UnicodeEncoding();
    ASCIIEncoding aEncode = new ASCIIEncoding();
    // Store plaintext as a byte array
    byte[] bytPlainText = uEncode.GetBytes(strPlainText);
    // Create a memory stream for holding encrypted text
    MemoryStream stmCipherText = new MemoryStream();
    // Private key
    crp.Key = aEncode.GetBytes(strKey16.Substring(0, 16));
    // Initialization vector is the encryption seed
    crp.IV = aEncode.GetBytes(strKey16.Substring(8, 8));
    // Create a crypto-writer to encrypt a bytearray into a stream
    CryptoStream csEncrypted = new CryptoStream(stmCipherText, crp.CreateEncryptor(), CryptoStreamMode.Write);
    csEncrypted.Write(bytPlainText, 0, bytPlainText.Length);
    csEncrypted.FlushFinalBlock();
    // Return result as a Base64 encoded string
    return Convert.ToBase64String(stmCipherText.ToArray());
    SQL 2005 CODE
    DECLARE @cipherText varbinary(1000)
    set @cipherText = CAST(N'4hRbT6QDk30DfyHbGyRqfA==' as varbinary(1000))
    SELECT CAST(DecryptByPassphrase('WOhPorN5VIKZl$Eqcz4CR104O', @cipherText) AS nvarchar)
    The SQL statement returns null.

  • Payload Encryption SAP PO 7.4 Java stack only

    Hi Folks,
    I am trying to implement Payload encryption in SAP PO 7.4 Java stack only. I implemented the encryption as suggested by SAP as per the following links
    Encrypted Message content on database level (AAE) :
    Encrypting Message Content on Database Level (AAE) - Advanced Adapter Engine - SAP Library
    and then configured Service interfaces for encrption:
    Configuring Service Interfaces for Encryption - SAP NetWeaver Process Integration - SAP Library
    But I am still seeing the payload in the message monitor. Is it because of the roles that I has been assigned to me. If so what are the roles that needs to be taken out from my profile to not see the payload?
    Regards
    Kalyan.

    >>>Encrypted Message content on database level (AAE) :
    This encrypts the message content at the database level not at the monitoring level.
    If you would like to restrict the access to "view payload" for specific interfaces, then refer to below blog -
    Michal's PI tips: Authorizations for viewing payload of messages on Java stack - implementation

  • Need pl/sql code to Encrypted data to decryption formate

    Hi All,
    I have Encrypted data 64 bit formate like
    encrypt
    780D0287
    FA57C55510D258C73DE93059E3DC49EC
    need output as a Decryption data..kindly give me output

    This is your duplicate post...
    Re: Need pl/sql code to decryption
    *009*

  • Encrypted machine keeps decrypting for no reason

    I have a machine with a encryption policy assigned and recently it has
    started to decrypt and then re-encrypt. I look at the "Emergency Recovery"
    tab on the device in ZCC and see 16 recovery entries where on most other
    machines I see the one from when I first encrypted it. Nothing in message
    log on the policy or the device. What can I check to see why this one
    machine keeps doing this?
    Jim Koerner
    Server - ZCM 11.2.1 w/MU1 and Internal Database on Win2008R2x64
    Client - ZCM 11.2.1 w/MU1 on Win7SP1x64

    My second SR for this finally got moved along to backline. Was kind of told
    this may be a known issue and hope to have more info shortly.
    Jim Koerner
    "Jim Koerner" wrote in message
    news:0MZ5s.162$[email protected]..
    Dropped in a SR yesterday. I'll post back the outcome.
    Jim
    "bbeachem" <[email protected]> wrote in message
    news:[email protected]..
    >
    > Open a SR and attached FDE Diagnostics package.... Start
    > Menu->Programs->Novell->ZENworks->FDE About Box->Diagnostics button...
    > it will create it on the desktop.
    >
    >
    > --
    > bbeachem
    > ------------------------------------------------------------------------
    > bbeachem's Profile: http://forums.novell.com/member.php?userid=103657
    > View this thread: http://forums.novell.com/showthread.php?t=459635
    >

  • [solved] Encrypted root partition decrypts, not recognised on boot

    Hello everyone
    As per the wiki entry on system encryption with LUKS, I have an unencrypted boot partition (sda1) and a second encrypted partition (sda2) containing everything else, including root. This is on an eeepc 901 (I'm posting here, though, as I understand this as a mounting issue rather than laptop/netbook specific).
    I have just done a full system upgrade, including moving to kernel 2.6.34-ARCH. Now, although I am prompted for the passphrase, which is accepted. I subsequently see the following:
    ::Checking Filesystems [BUSY] fsck.ext2: No such file or directory while trying to open /dev/mapper/root
    /dev/mapper/root:
    The superblock could not be read or does not describe a correct ext2 filesystem.
    If the device is valid and it really does contain an ext2 filesystem (and not swap or
    ufs or something else), then the superblock is corrupt, and you might try running
    e2fsck with an alternate superblock:
    e2fsck -b 8193 <device>
    Runnig ecfsck -b 8193 /dev/mapper/root simply results in that error message being repeated. Googling and searching the forum only really found this thread to be anything similar. As per the suggestions there, the encrypted partition is last in /etc/fstab and the <options> value is populated:
    /dev/sda1 /boot ext2 defaults 0 1
    /dev/sdb1 /mnt/sdb1 vfat rw #This is an sdhc card permanently inserted
    /dev/mapper/root / ext2 defaults 0 1
    /etc/crypttab is entirely commented out, as it advises the root partition needs to be defined in the initramfs.
    I can decrypt and open the partition using systemrescuecd, and fsck confirms the partition is clean. Equally, I can access the decrypted partition from the maintenance shell I get dumped into.
    I'd be very grateful for any suggestions.
    Last edited by Sagittar (2010-07-17 03:40:49)

    Thanks for responding. I can confirm /dev/sda2 is ext2: after mounting both partitions with the -r flag, df -T reports ext2 file systems. (The theory is that ext2 helps prolong the life of the SSD in the eee pc. Not that that's entirely relevant here.)
    I can't see a way of booting off sysresccd with root=/dev/sda2 without decrypting /dev/sda2 first. I am able to do that from Grub. Is there something I'm missing?
    However, when I pay more attention to what happens on sysresccd when I decrypt the partition, I get the following:
    % cryptsetup luksOpen /dev/sda2 root
    Enter passphrase for /dev/sda2:
    device-mapper: remove ioctl failed: Device or resource busy
    Key slot 0 unlocked.
    So, although I can then mount /dev/sda2 (or, to be precise, /dev/mapper/root) as normal, my guess is that the third line is a big clue as to why my normal boot process fails. I am pursuing that now.

Maybe you are looking for

  • Error When creating a new Global Calculated Key Figure or RKF

    Hi, Coming across this problem with NW2004s BI 7 query designer. When i create a new CKF or RKF with the query designer, i get a error message. Currently the SAP GUI is on SP 8 and the problem exists after applying the collective note recently releas

  • Error using BAPI_PO_CREATE1 for creating PO with services

    Hi, I'm getting an error saying 'EnTER account assignment data for item' when I use BAPI_PO_CREATE1 and try to create POs with Service Items. I have filled all the required details, even then the system throws up this error message. Thanks for any he

  • How to set column width in OBIEE

    hi , I want to set the coumn width in table, my version is obiee 10. any one know how adjust the width of column? thanks.

  • String size limitations, HTML table

    Post Author: Jeff Kulbeth CA Forum: General I am currently using CR 8.5 and am aware of string size limitations... 254 characters max.  I'm looking at CR XI and can't find any data on string size limitations.  A few questions: 1) We're considering da

  • No colouring in Statement Coverage

    Hello, Im using EHP6 for SAP ERP 6.0. In the Unit Tests there are some Codes that arent highlighted in red or green in the coverage Analyzer. Does anybody know why this is so? And if there´s a Workaround for this? The Codes have a lot of comments in