3DES decryption with SHA1 hashed key

Hello all,
I've been given the task of rewriting an existing VB application in Java, and one routine makes use of the Microsoft Cryptography API.
The VB code decrypts a string using TripleDES decryption, using a string key that's been hashed with a SHA1 has algorithm.
Most of the java DESede encryption/decryption examples I've worked through generate keys with a KeyGenerator instance, but I have not yet found any examples that use a key that's been SHA1 hashed.
My attempts at using a hashed byte[] array of my key phrase with a DESede Crypto instance always return a "wrong key size" error.
Can anyone provide some help? Example code fragments or anything would help.

Thanks for the reply, and you're right in that this might be a more appropriate question to ask on a VB forum or on a MS cryptography API forum.
Nevertheless, I've been able to make some headway on the VB side by getting the bytes of the SHA-1 hash map through some API calls.
The hex representation of the SHA-1 hashed keyword:
"3EC10CE885353DCD23B912860C2B91885CD3D6D1"
A keyword to use as a test:
"logins"
Hex representation of the 3DES encrypted result of "logins" using the hashed keyword:
"FB158A921E3C4CDB"
Currently, my problem is with the length of the key. As you pointed out, SHA is 20 bytes, while 3DES is looking for 24 bytes. I'll experiment with your suggested 2-key approach, but here's my test code at the moment:
import java.security.*;
import javax.crypto.*;
import javax.crypto.Cipher;
import javax.crypto.Mac;
import javax.crypto.SecretKey;
import javax.crypto.spec.DESedeKeySpec;
import javax.crypto.spec.SecretKeySpec;
public class EncryptionTest {
public static void main(String[] args) {
String hashedKey = "3EC10CE885353DCD23B912860C2B91885CD3D6D1";
String textToCode = "logins";
byte[] keyBytes = hexStringToBytes( hashedKey );
byte[] source = textToCode.getBytes();
SecretKey key = new SecretKeySpec(keyBytes, "DESede");
try {
Cipher cipher = Cipher.getInstance("DESede");
cipher.init(Cipher.ENCRYPT_MODE, key);
byte[] result = cipher.doFinal(source);
String sresult = hex( result );
System.out.println( result );
} catch ( NoSuchPaddingException e ) {
e.printStackTrace();
} catch ( BadPaddingException e ) { 
e.printStackTrace();
} catch ( NoSuchAlgorithmException e ) {
e.printStackTrace();
} catch ( InvalidKeyException e ) {
e.printStackTrace();
} catch (IllegalBlockSizeException e ) {
e.printStackTrace();
static byte[] hexStringToBytes( String s ) {
int iLength = s.length();
int iBuff = iLength / 2;
byte[] buff = new byte[ iBuff ];
int j = 0;
for(int i = 0; i < iLength; i+=2) {
try {
String s1 = s.substring(i, i+2);
buff[j++] = (byte) Integer.parseInt(s1, 16);
} catch ( Exception e ) {
e.printStackTrace();
return buff;
static String hex(byte[] data) {
StringBuilder sb = new StringBuilder();
for (byte b : data) {
sb.append(Character.forDigit((b & 240) >> 4, 16));
sb.append(Character.forDigit((b & 15), 16));
return sb.toString();
}

Similar Messages

  • Decrypting with 2 differents keys

    Hi (I�am new to encryption), I'm using DES/CBC/NoPadding with a blank iVBytes array and BoucyCastle as provider. I don't know why I can encrypt a text using a key and I can decrypt it with a similar key. For example:
    1) I encrypt "AAAAFAFAFAEEEEEE" using "54177127" as key, then I decrypt it using "54177126" (the last digit differs in one)
    2) I encrypt "AAAAFAFAFAEEEEEE" using "99999999" as key, then I decrypt it using "8888888" (the same happens if I use two's, three�s, four�s, etc)
    How can this be possible?
    Thanks. Ramiro.

    Ok I get it: I'll always have many keys. Thanks Sabre.
    Edited by: rlaso on Apr 1, 2008 6:19 AM
    Edited by: rlaso on Apr 1, 2008 6:37 AM

  • Do HMAC with SHA1 derived key?

    I'm trying to create a MAC for a PKCS12. I have successfully generated key bytes according to the PKCS12 standard, section B.2. The PKCS12 standard defines
    I'm supposed to do an HMAC using SHA-1 as the digest algorithm (so I do Mac.getInstance("HmacSHA1")). To initialize the Mac object I need to provide a key. At this point I have a 20 byte array representing the key, but no way to initialize the Mac as I need to convert those bytes into a Key object. The SecretKeyFactory doesn't have any algorithms listed for SHA1 or PKCS12 related so I don't know how to create a Key from the bytes (using a KeySpec...). The BouncyCastle provider also doesn't list sha1 in its list of supported algorithms for keyfactory.
    I imagine this functionality is buried somewhere in the JRE as the KeyStore class can load a PKCS12 and (I would hope) it is verifying the Mac on the P12 before it uses it.

    I must be missing something because I generate the key and initialise the Mac using            final byte[] keyBytes = ...;
                final String mode = "HmacSHA1";
                final SecretKey key = new SecretKeySpec(keyBytes, mode);
                final mac = Mac.getInstance(mode);
                mac.init(key);I have never tried using an invalid 'mode' in the key generation.

  • UK iMac Keyboard . . . . Hash Key?

    Morning folks.
    If from the title you havent realised, Im from the UK.
    A little over a year ago I purchased a 12inch ibook g4 and im loving it. now its time for me to turn my PC into a door stop (no really!). I waste far to much time on windows playing games I cant play on a mac.
    How ever when I ordered my iBook impretty sure I selected a UK keyboard and when I got it it didnt have a Hash key (#). This is kind of a tricky objective to over come when your a web designer and programmer. How ever I manage, some how.
    Can anyone confirm for me if a Ukmac with this option: "Keyboard & Mighty Mouse + Mac OS X" comes with a hash key.
    Many thanks
    Adam
    ibook g4   Mac OS X (10.4.6)  

    828/3274
    Hi Adam,
    Welcome to Apple Discussions!
    The UK layout has the £ sign where the US has #.
    To get the # with your UK layout, type option+3.
    To get the £ with a US layout, type option+3.
    If you ordered a UK iBook, as opposed to an International iBook, then you rightly got the £ model.
    Tip:
    In System Preferences > International > Input Menu,
    you can enable any layout that you would wish to use. Enable the input menu in the menubar too, and the keyboard viewer/character palette, a very handy small flag to have in your status bar.
    Enjoy your Mac!
    Axl

  • Failed to decrypt protected XML node "DTS:Password" with error 0x8009000B "Key not valid for use in specified state

    we have developed packages to do the followings
    Extract data from DB2 Source and put it in MS Sql Server 2008 database (Lets Say DatabaseA).From MS Sql Server 2008 (DatabaseA)
    we will process the data and place it in another database MS Sql Server 2008 (DatabaseB)
    We have created packages in BIDS..We created datasource connection in Datasource folder in BIDS..Which has DB2 Connection and both Ms Sql Server connection (Windows authentication-Let
    say its pointing to the server -ServerA which has DatabaseA and DatabaseB).The datasource connections will be used in packages during development.
    For deployment we have created Package Configuration which will have both DB2 Connection and MS SqlServer connection in the config
    We deployed the packages in different MS SqlServer by changing the connectionstring in the config for DB2 and MS SqlServer...
    While runing the package we are getting the following error message
    Code: 0xC0016016     Source:       Description: Failed to decrypt protected XML node "DTS:Password" with error 0x8009000B "Key not valid for
    use in specified state.". You may not be authorized to access this information. This error occurs when there is a cryptographic error. Verify that the correct key is available.
    ilikemicrosoft

    Hi Surendiran,
    This is because the package has been created by somebody else and the package is being deployed under sombody else's account. e.g. If you are the creator then the package is encryption set according to your account and the package setup in SQL server is
    under a different user account.
    This happens because the package protection level is set to EncryptSensitiveWithUserKey which encrypts
    sensitive information using creator's account name.
    As a solution:
    Either you have to set up the package in SQL server under your account (which some infrastructures do not allow).
    OR
    Set the package property Protection Level to "DontSaveSensitive" and add a configuration file
    to the package and set the initial values for all the variables and all the connection manager in that configuration file (which might be tedious of-course).
    OR
    The third options (which I like do) is to open the package file and delete the password encryption entries from the package. Do note that this is not supported by designer and every time you make changes to the connection managers these encryption entries come
    back.
    Hope this helps. 
    Please mark the post as answered if it answers your question

  • Generate Unique Hash Key in PL/SQL

    I have a document that i want to send to certain customers. What I've decided to do is send the customer a link to the document that will be stored locally on our server. Obviously for security reasons i don't want to simply send the sequential doc ID allowing customers to change the query string to get other information.
    What would be the best way in pl/sql to generate a unique hash key to include in the url? The key would have to be both unique and not easily edited by customers to view other documents.
    Any help would be much appreciated.
    Faoilean.

    faoilean wrote:
    I've been experimenting with SHA-1 and it works very well in producing a 40 character hash. My one concern is that for example hashing '1025' produces the following hash 'B74E9CAD775D997FC742B45E1BA7BD5295D63D13'.
    Would someone not just simply be able to use SHA-1 to create a hash for '1026' (since i'm using a sequential number for my input) and consequently retrieve somebody elses information and leave my system vulnerable?
    Might i be better off to encrytp the input?I thought the point was that the "user" would only be provided with the hash value as a reference to the document and they would not have a clue how to alter that hash value to another value in order to retrieve a different document. Surely they don't know that the hash value they have relates to '1025' so a) how would they know that they can obtain the hash for '1026' to get the next document and b) how would they go about creating their own hash values unless you somehow give them access to Oracle's DBMS_CRYPTO package?
    If you really want to be sure then you could also also incorporate the date/time of the document into the string that you hash, so they would have to a) have access to the dbms_crpto package, b) know the filename and the date/time of the document and c) know what order to combine those things (and the format mask you've used on the date/time etc.) to provide the correct hash to obtain the document.
    If you use encryption then you leave yourself open to decryption.
    If you use hash then this is generally a 1 way mechanism, hence details are better hidden.
    I think you'll find when it comes to things like password storage, most will use a 1 way hash (or similar) algorithm rather than an encrypted password so that the stored passwords can never be reverse engineered. Also, such password algorithms usually combine the username or some other feature to prevent two users with the same password getting the same hash value.

  • SHA1 Hash

    Hi, 
    I have been trying to generate the HASH Key based on the SHA1 
    encryption :
    select HASHBYTES('SHA1','myKey12'+'ZW1haWxAZW1haWwuY29t'+cast (1234 as varchar)) as HashEmailReferenceKey
    I'm getting : 0x26027CBC659B4ED769E13A0AA7827BF26D859843
    select HASHBYTES('SHA1','mykey12'+'ZW1haWxAZW1haWwuY29t'+ cast (1234 as varchar)) as HashEmailReferenceKey
    I'm getting : 0xD4F5C7DA8F530D619EC92DDDD35766CA8AEC624A
    I'm supposed to get : b232dc87ad2a699763720a29f5b3db2df6f80dfd
    1) Why am I getting two different Hash Values for essentially the same code ?
    2) Why would both answers wouldn't match with the expected Hash output ?
    Please guide as to what I may be missing while generating these Hashes
    Thanks
    EVA05

    1, Its not the same code the casing of string is different in second case. its mykey in second against myKey in first string.
    2. How did you come to the conclusion that your expected output should be b232dc87ad2a699763720a29f5b3db2df6f80dfd?
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Encrypt/Decrypt data, multiple public keys using Bouncy castle api?

    Hi all.
    I need to implement encrypt/decrypt functionality of some data with many public keys using bouncy castle api and EnvelopedData class in java 1.4 SE.
    Could someone give me examples how to do it. I searched whole the internet and i could not find simple example.

    Hi thanks very much.
    I had a quick look at the examples. I will see if they could help me.
    Here is more specific what i want:
    Encrypt data with multiple public keys that are kept in .pkcs12 file.
    And decrypt the data using coresponding private key after that.
    I must use bouncy castle api for java 1.4 se.
    Best regards
    Edited by: menchev on Nov 13, 2008 8:26 AM

  • Problem in enc/dec with DSA-Elgamal (keys generated using GNUPG utility)

    Hi all
    Facing the problem in encryption/decryption using DSA-Elgamal (keys generated using GNUPG utility)
    Steps followed
    Generated a key pair using DSA and Elgamal (default) form GNUPG utility (size 1024)
    Placed generated keys pubring.gpg & secring.gpg in the source directory where the code is executing but am getting the error
    D:\test>c:\jdk\bin\java BouncyCastlePGPTest
    Creating a temp file...
    Temp file created at
    D:\test\pgp
    Reading the temp file to make sure that the bits were written
    the message I want to encrypt
    Get Public Key
    Key Strength = 1024
    Algorithm = 17
    mohankumar (start) <[email protected]>
    Key Count = 1
    In Ecrypt File
    creating comData...
    comData created...
    using PGPEncryptedDataGenerator...
    111...
    java.lang.IllegalArgumentException: passed in key not an encryption key!f
    D:\test>
    but the same code works fine if we try to encrypt using RSA generated keys
    D:\test>c:\jdk\bin\java BouncyCastlePGPTest
    Creating a temp file...
    Temp file created at
    D:\test\pgp
    Reading the temp file to make sure that the bits were written
    the message I want to encrypt
    Get Public Key
    Key Strength = 1024
    Algorithm = 1
    sriganesh (sriganesh) <[email protected]>
    Key Count = 1
    In Ecrypt File
    creating comData...
    comData created...
    using PGPEncryptedDataGenerator...
    used PGPEncryptedDataGenerator...
    wrote bOut to byte array...
    Reading the encrypted file
    -----BEGIN PGP MESSAGE-----
    Version: BCPG v1.31
    hIwD7qqzP41CKpUBBACOnQE265ud3AuJ8zGx9TjUFyeSwZH+PZJhjGLBTkI7gKdh
    /hIF1u/sCzubw+9Mt8dbS0V2uHiqQgkCHAYIQKoVmiN65s8sUsIS0q3cTtBudUnd
    xIEiyegtvB8LEpzldU/XrSglh8h6MdhhcPql46BG+0vs6p/bUAOygNv5e/DGzck2
    1wNvc2/u2ffBgEP4qfrJUcF9OlvVAm03aB0S6gP8cH4LVdo5K9Bwu3d71qNKsryP
    mML16rkA
    =lfxf
    -----END PGP MESSAGE-----
    Decrypted Data= the message I want to encrypt
    no message integrity check
    Code As follows
    import java.io.BufferedReader;
    import java.io.ByteArrayOutputStream;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.FileReader;
    import java.io.FileWriter;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.security.NoSuchProviderException;
    import java.security.SecureRandom;
    import java.security.Security;
    import org.bouncycastle.bcpg.ArmoredOutputStream;
    import org.bouncycastle.jce.provider.BouncyCastleProvider;
    import org.bouncycastle.openpgp.PGPCompressedDataGenerator;
    import org.bouncycastle.openpgp.PGPEncryptedDataGenerator;
    import org.bouncycastle.openpgp.PGPException;
    import org.bouncycastle.openpgp.PGPLiteralData;
    import org.bouncycastle.openpgp.PGPPublicKey;
    import org.bouncycastle.openpgp.PGPPublicKeyRing;
    import org.bouncycastle.openpgp.PGPUtil;
    import org.bouncycastle.openpgp.*;
    import java.util.Iterator;
    public class BouncyCastlePGPTest {
    private static PGPPrivateKey findSecretKey(
                                                      InputStream keyIn,
                                                      long keyID,
                                                      char[] pass)
                                                      throws IOException, PGPException, NoSuchProviderException {
    PGPSecretKeyRingCollection pgpSec = new PGPSecretKeyRingCollection(PGPUtil.getDecoderStream(keyIn));
    PGPSecretKey pgpSecKey = pgpSec.getSecretKey(keyID);
    if (pgpSecKey == null) {
    return null;
    return pgpSecKey.extractPrivateKey(pass, "BC");
    private static void decryptFile(InputStream in, InputStream keyIn, char[] passwd) throws Exception
    in = PGPUtil.getDecoderStream(in);
    try {
    PGPObjectFactory pgpF = new PGPObjectFactory(in);
    PGPEncryptedDataList enc;
    Object o = pgpF.nextObject();
    // the first object might be a PGP marker packet.
    if (o instanceof PGPEncryptedDataList)
    enc = (PGPEncryptedDataList)o;
    else
    enc = (PGPEncryptedDataList)pgpF.nextObject();
    // find the secret key
    Iterator it = enc.getEncryptedDataObjects();
    PGPPrivateKey sKey = null;
    PGPPublicKeyEncryptedData pbe = null;
    while (sKey == null && it.hasNext())
    pbe = (PGPPublicKeyEncryptedData)it.next();
    sKey = findSecretKey(keyIn, pbe.getKeyID(), passwd);
    if (sKey == null)
    throw new IllegalArgumentException("secret key for message not found.");
    InputStream clear = pbe.getDataStream(sKey, "BC");
    PGPObjectFactory plainFact = new PGPObjectFactory(clear);
    Object message = plainFact.nextObject();
    if (message instanceof PGPCompressedData)
    PGPCompressedData cData = (PGPCompressedData)message;
    PGPObjectFactory pgpFact = new PGPObjectFactory(cData.getDataStream());
    message = pgpFact.nextObject();
    if (message instanceof PGPLiteralData)
    PGPLiteralData ld = (PGPLiteralData)message;
    FileOutputStream fOut = new FileOutputStream(ld.getFileName());
    InputStream unc = ld.getInputStream();
    int ch;
    System.out.print("\n\n\nDecrypted Data= ");
    while ((ch = unc.read()) >= 0)
                             System.out.print(""+(char)ch);
    fOut.write(ch);
    System.out.println("\n\n\n");
    else if (message instanceof PGPOnePassSignatureList)
    throw new PGPException("encrypted message contains a signed message - not literal data.");
    else
    throw new PGPException("message is not a simple encrypted file - type unknown.");
    if (pbe.isIntegrityProtected())
    if (!pbe.verify())
    System.err.println("message failed integrity check");
    } else
    System.err.println("message integrity check passed");
    else
    System.err.println("no message integrity check");
    catch (PGPException e) {
    System.err.println(e);
    if (e.getUnderlyingException() != null) {
    e.getUnderlyingException().printStackTrace();
         public static void main(String[] args) {
              // the keyring that holds the public key we're encrypting with
              String publicKeyFilePath = "D:\\test\\pubring.gpg"; //D:\\test\\pubring.pkr;
              // init the security provider
              Security.addProvider(new BouncyCastleProvider());
              try {
                   System.out.println("Creating a temp file...");
                   // create a file and write the string to it
                   File outputfile = new File("pgp");//File.createTempFile("pgp", null);
                   FileWriter writer = new FileWriter(outputfile);
                   writer.write("the message I want to encrypt".toCharArray());
                   writer.close();
                   System.out.println("Temp file created at ");
                   System.out.println(outputfile.getAbsolutePath());
                   System.out.println("Reading the temp file to make sure that the bits were written\n----------------------------");
                   BufferedReader isr = new BufferedReader(new FileReader(outputfile));
                   String line = "";
                   while ((line = isr.readLine()) != null) {
                        System.out.println(line + "\n");
                   // read the key
                   FileInputStream     in = new FileInputStream(publicKeyFilePath);
                   PGPPublicKey key = readPublicKey(in);
                   // find out a little about the keys in the public key ring
                   System.out.println("Key Strength = " + key.getBitStrength());
                   System.out.println("Algorithm = " + key.getAlgorithm());
                   int count = 0;
                   for (java.util.Iterator iterator = key.getUserIDs(); iterator.hasNext();) {
                        count++;
                        System.out.println((String)iterator.next());
                   System.out.println("Key Count = " + count);
                   // create an armored ascii file
                   FileOutputStream out = new FileOutputStream(outputfile.getAbsolutePath() + ".asc");
                   // encrypt the file
                   encryptFile(outputfile.getAbsolutePath(), out, key);
                   System.out.println("Reading the encrypted file\n----------------------------");
                   BufferedReader isr2 = new BufferedReader(new FileReader(new File(outputfile.getAbsolutePath() + ".asc")));
                   String line2 = "";
                   while ((line2 = isr2.readLine()) != null) {
                        System.out.println(line2);
    //FileInputStream in = new FileInputStream(args[1]);
              FileInputStream in2 = new FileInputStream("d:\\test\\pgp.asc");
         FileInputStream keyIn = new FileInputStream("d:\\test\\secring.gpg");
         decryptFile(in2, keyIn, "test123".toCharArray());
              } catch (PGPException e) {
                   System.out.println(e.toString());
                   System.out.println(e.getUnderlyingException().toString());
              } catch (Exception e) {
                   System.out.println(e.toString());
         private static PGPPublicKey readPublicKey(InputStream in) throws IOException {
              System.out.println("Get Public Key");
              try {
                   PGPPublicKeyRing pgpPub = new PGPPublicKeyRing(in);
                   Iterator itr = pgpPub.getPublicKeys();
                   PGPPublicKey pk = null;
                   return pgpPub.getPublicKey();
              } catch (IOException io) {
                   System.out.println("readPublicKey() threw an IOException");
                   System.out.println(io.toString());
                   throw io;
         private static void encryptFile(String fileName, OutputStream out, PGPPublicKey encKey)
    //     throws IOException, NoSuchProviderException, PGPException
              try {
    System.out.println("In Ecrypt File");
              out = new ArmoredOutputStream(out);
              ByteArrayOutputStream bOut = new ByteArrayOutputStream();
              System.out.println("creating comData...");
              // get the data from the original file
              PGPCompressedDataGenerator comData = new PGPCompressedDataGenerator(PGPCompressedDataGenerator.ZIP);
              PGPUtil.writeFileToLiteralData(comData.open(bOut), PGPLiteralData.BINARY, new File(fileName));
              comData.close();
              System.out.println("comData created...");
              System.out.println("using PGPEncryptedDataGenerator...");
              // object that encrypts the data
              PGPEncryptedDataGenerator cPk = new PGPEncryptedDataGenerator(PGPEncryptedDataGenerator.CAST5, new SecureRandom(), "BC");
              cPk.addMethod(encKey);
              System.out.println("used PGPEncryptedDataGenerator...");
              // take the outputstream of the original file and turn it into a byte array
              byte[] bytes = bOut.toByteArray();
              System.out.println("wrote bOut to byte array...");
              // write the plain text bytes to the armored outputstream
              OutputStream cOut = cPk.open(out, bytes.length);
              cOut.write(bytes);
              // cOut.close();
              cPk.close();
              out.close();
              } catch (IOException ex) {
                   System.out.println("IOException\t" +ex.toString());
              } catch (NoSuchProviderException ex1) {
                   System.out.println("NoSuchProviderException\t" +ex1.toString());
              } catch (PGPException ex2) {
                   System.out.println("PGPException\t" +ex2.toString());
    }

    First - you're responding to a year-old message. I doubt the OP is still around.
    Second - DSA is a Digital Signature Algorithm. The error tells you exactly what the problem is - DSA is not an encryption algorithm, and can't be used as one.
    Grant

  • Query with non partition key in partitioning table

    i compare query select with non-partition key condition in table partition with 3, 4 and 6 partition.
    time execution for 3 partition faster then 4 partition, time execution for 4 partition faster than 6 partition.
    i know processing query select is selection all partition, but i don't know what make time execution different between 3, 4 and 6 partition??
    whether the transfer from one partition to another partition takes time?
    this example sql trace query select for 3,4 and 6 partition
    3 partition
    SELECT *
    FROM
    EQU_PARAM_MONITORINGHASH WHERE TO_CHAR(time_stamp,'mm/yy')=('02/09')
    call          cpu    elapsed       disk        rows
    Parse        0.00       0.00          0           0
    Execute      0.00       0.00          0           0
    Fetch        5.70       7.57      25291     1157583
    total        5.70       7.57      25291     1157583
    Parsing user id: 61  (SKENARIO1)
    Rows     Execution Plan
          0  SELECT STATEMENT   MODE: ALL_ROWS
          0   PARTITION HASH (ALL) PARTITION: START=1 STOP=3
          0    TABLE ACCESS   MODE: ANALYZED (FULL) OF
                   'EQU_PARAM_MONITORINGHASH' (TABLE) PARTITION: START=1 STOP=34 partition
    SELECT *
    FROM
    EQU_PARAM_MONITORINGHASH WHERE TO_CHAR(time_stamp,'mm/yy')=('02/09')
    call          cpu    elapsed       disk        rows
    Parse        0.00       0.00          0           0
    Execute      0.00       0.00          0           0
    Fetch        5.46       8.03      25126     1157583
    total        5.46       8.03      25126     1157583
    Parsing user id: 62  (SKENARIO2)
    Rows     Execution Plan
          0  SELECT STATEMENT   MODE: ALL_ROWS
          0   PARTITION HASH (ALL) PARTITION: START=1 STOP=4
          0    TABLE ACCESS   MODE: ANALYZED (FULL) OF
                   'EQU_PARAM_MONITORINGHASH' (TABLE) PARTITION: START=1 STOP=46 partition
    SELECT *
    FROM
    EQU_PARAM_MONITORINGHASH WHERE TO_CHAR(time_stamp,'mm/yy')=('02/09')
    call          cpu    elapsed       disk        rows
    Parse        0.00       0.00          0           0
    Execute      0.00       0.00          0           0
    Fetch        5.73       9.13      25190     1157583
    total        5.73       9.13      25190     1157583
    Parsing user id: 63  (SKENARIO3)
    Rows     Execution Plan
          0  SELECT STATEMENT   MODE: ALL_ROWS
          0   PARTITION HASH (ALL) PARTITION: START=1 STOP=6
          0    TABLE ACCESS   MODE: ANALYZED (FULL) OF
                   'EQU_PARAM_MONITORINGHASH' (TABLE) PARTITION: START=1 STOP=6thanks
    best regards
    eko

    ekopur wrote:
    i compare query select with non-partition key condition in table partition with 3, 4 and 6 partition.
    time execution for 3 partition faster then 4 partition, time execution for 4 partition faster than 6 partition.
    i know processing query select is selection all partition, but i don't know what make time execution different between 3, 4 and 6 partition??
    whether the transfer from one partition to another partition takes time?
    this example sql trace query select for 3,4 and 6 partition
    3 partition
    SELECT *
    FROM
    EQU_PARAM_MONITORINGHASH WHERE TO_CHAR(time_stamp,'mm/yy')=('02/09')
    call          cpu    elapsed       disk        rows
    Parse        0.00       0.00          0           0
    Execute      0.00       0.00          0           0
    Fetch        5.70       7.57      25291     1157583
    total        5.70       7.57      25291     1157583
    Parsing user id: 61  (SKENARIO1)
    Rows     Execution Plan
    0  SELECT STATEMENT   MODE: ALL_ROWS
    0   PARTITION HASH (ALL) PARTITION: START=1 STOP=3
    0    TABLE ACCESS   MODE: ANALYZED (FULL) OF
    'EQU_PARAM_MONITORINGHASH' (TABLE) PARTITION: START=1 STOP=34 partition
    SELECT *
    FROM
    EQU_PARAM_MONITORINGHASH WHERE TO_CHAR(time_stamp,'mm/yy')=('02/09')
    call          cpu    elapsed       disk        rows
    Parse        0.00       0.00          0           0
    Execute      0.00       0.00          0           0
    Fetch        5.46       8.03      25126     1157583
    total        5.46       8.03      25126     1157583
    Parsing user id: 62  (SKENARIO2)
    Rows     Execution Plan
    0  SELECT STATEMENT   MODE: ALL_ROWS
    0   PARTITION HASH (ALL) PARTITION: START=1 STOP=4
    0    TABLE ACCESS   MODE: ANALYZED (FULL) OF
    'EQU_PARAM_MONITORINGHASH' (TABLE) PARTITION: START=1 STOP=46 partition
    SELECT *
    FROM
    EQU_PARAM_MONITORINGHASH WHERE TO_CHAR(time_stamp,'mm/yy')=('02/09')
    call          cpu    elapsed       disk        rows
    Parse        0.00       0.00          0           0
    Execute      0.00       0.00          0           0
    Fetch        5.73       9.13      25190     1157583
    total        5.73       9.13      25190     1157583
    Parsing user id: 63  (SKENARIO3)
    Rows     Execution Plan
    0  SELECT STATEMENT   MODE: ALL_ROWS
    0   PARTITION HASH (ALL) PARTITION: START=1 STOP=6
    0    TABLE ACCESS   MODE: ANALYZED (FULL) OF
    'EQU_PARAM_MONITORINGHASH' (TABLE) PARTITION: START=1 STOP=6
    I'm assuming you recreated the table a couple of times with different numbers of hash partitions. (Tip: always use a power of two for the number of hash partitions - it keeps them all around the same size if you are using the feature on an appropriate data set.)
    There isn't really enough difference in time within the database to make any sensible comment about the difference in times. I note that you have also edited out the fetch count for the 1.1 million rows fetched, and have not captured (or perhaps just not printed) the wait times, so we don't know where you spent the time inside and outside the database.
    For all we can tell, the difference you are worried about might simply be network time on the fetch calls, and have nothing to do with the extract you've published.
    Regards
    Jonathan Lewis

  • Digital signature does not validate with the given key

    We are switching our single-signon provider from openssl to Weblogic's SAML. I am trying to create a test application that will send mock SAML assertions to our test Weblogic SAML server before we begin integration with the client that will send real SAML assertions.
    I have configured a Weblogic 10.3.5 instance to be a SAML Service Provider as well as created an application that creates test SAML assertions to post to the SAML server. I'm currently using a self-signed certificate to sign the SAML assertion. I've imported the self-signed cert into both the DemoIdentiy.jks and cacerts on the Weblogic SAML server.
    The Weblogic SAML server is giving the following error when trying to validate the signature of the assertion:
    <SAML2Assert: Start verify assertion signature>
    <SAML2Assert: The assertion is signed.>
    <SAML2Assert: Digital signature does not validate with the given key
    org.opensaml.xml.validation.ValidationException: Digital signature does not validate with the given key
    at org.opensaml.xml.signature.SignatureValidator.validate(SignatureValidator.java:68)
         at com.bea.security.saml2.util.SAML2Utils.verifySamlObjectSignature(SAML2Utils.java:229)
         at com.bea.security.saml2.providers.SAML2Assert.verifySignature(SAML2Assert.java:285)
    >
    I get this error when the SAML assertion includes both the cert and the public key, just the cert, just the public key or neither.
    I'm pretty sure I've configured the SAML instance correctly since I followed the steps provided by another group who got this working with a different client. The only difference is they are using a real signed certificate (Verisign i believe) instead of a self signed cert.
    I'm looking for any help to track down which step in the process I've missed or implemented incorrectly.
    Thanks!
    Edited by: 911967 on Feb 6, 2012 12:26 PM

    So I found my own answer to the issue. The error was being caused by an the following xml in the assertion:
    <ds:Reference URI="">
    The value of URI attribute must have a '#' followed by the same value of the ID attribute in the parent 'Assertion' element (in our case a random string):
    <saml:Assertion xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" ID="a5k42vnhsywezqzyufq15c4bb9xuzeozrmbppj38xe" IssueInstant="2012-03-12T14:33:25.986Z" Version="2.0">
    <saml:Issuer>ISSUER_NAME</saml:Issuer>
    <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
    <ds:SignedInfo>
    <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
    <ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
    *<ds:Reference URI="#a5k42vnhsywezqzyufq15c4bb9xuzeozrmbppj38xe">*
    How this is related to the digital signature is beyond me, though I admit I'm very new to saml and digital signing. However I spent a great deal of time investigating my certs and how I was creating the signature, which it seems is unrelated to the actual issue. I also wasn't able to find any docs specifying that this attribute was required, though I might have just missed it.

  • Hash key doesn't work :(

    Guys this is doing my head in.
    I am using a UK keyboard and a UK Macbook Pro 2008 (Late). I can't use a hash key at all using ALT + 3 or SHIFT + 3. It shows hash on they keyboard viewer but it never does output the icon on the screen
    At the minute my only option is to use the US keyboard, but quite simply I don't as I have a UK physical keyboard. Any ideas?
    Cheers

    I've been struggling with this same problem for a while before realising that I'd mapped ALT+number to another application, specifically to change desktops using Spaces in OSX. 
    Having removed this new key binding, I can now use ALT+3 to create # for the first time in months; a classic case of operator error.
    Just wondered if you'd checked similar settings which might ave over-ridden the default settings?
    Good luck.

  • Hi! on the keypad for the Macbook is there a button with the hash sign, I can't find it anywhere??, Hi! on the keypad for the Macbook is there a button with the hash sign, I can't find it anywhere??

    Hi! on the keypad for the Macbook is there a button with the hash sign, I can't find it anywhere??, Hi! on the keypad for the Macbook is there a button with the hash sign, I can't find it anywhere??

    System Preferences > Keyboard > Keyboard tab; tick "show keyboard and character viewers in menu bar"
    If you open Keyboard Viewer and press the alt (option) key, the location of the diacritical marks and other common symbols will be revealed. Note that five of them are highlighted in orange; these are the ones which can be used with multiple  letters (acute, umlaut, gràve, circumflex and tilde)
    Shift and Shift+Alt will show more.
    Note that # is alt+3 on a keyboard with the £ sign.

  • AAS 10.8.2 SHA1 Hash

    Hi,
    can someone please check the SHA1 hash value of the InstallESD.dmg file coming with the download of Mountain Lion 10.8.2 from the Apple App Store? I'd really appreciate your help .
    m_chris

    http://www.apple.com/support/mac/app-store/contact.html?form=account

  • C++ programming (missing hash key)

    My Mac Mini was supplied with an Apple keyboard. It's about 450mm x 100mm, made from brushed aluminium with flat, white keys. Unfortunately, there's no hash key AFAICT. This is going to be a problem for me since I'm a C++ programmer and the hash key is pretty important in C++ programming!
    I found out that a hash symbol can be generated by using Option+3. However, this only seems to work for OS-X. I've dual installed Windows (using Boot Camp) but Option+3 doesn't work there.
    Can anyone suggest an alternative keyboard that might offer a working hash key for both OS's? Or would a standard PC keyboard work?

    Have you installed the Boot Camp drivers for Windows to match the hardware with the OS? Have you configured Windows to use a UK keyboard profile?
    Just an idea for you. There is an entire Apple Discussion forum dedicated to Boot Camp and Windows.
    Whereas, not everyone here with an Intel Mac mini has installed, tried to install or has experience with BC & Windows, everyone there has or at least has an interest. You may attract help more quickly there.
    The Forums are at the bottom of the main Apple Discussions page under Windows Compatible Technology. Here is a link;
    Boot Camp: Installation and Storage
    Dah•veed

Maybe you are looking for

  • CATM transaction_System error: quantity not completely distributed

    Hello, When i execute the transcation CATM(entering of time), system was displaying the error in SM12/SM13 as "System error: quantity not completely distributed". but when i checked the accounts and the cost were transferred. so shall i repeat the tr

  • What exactly do I put in next-Login help

    Well I made a JSP...but now I'm stuck.. I don't what to do here is the code           <%@page import = "java.sql.*" %>           <%                Connection  conn;                Statement   command;                ResultSet   rs;                Str

  • Cannot connect to iTunes store - error -3212

    iTunes is telling me that I cannot connect to their store or to my account. But I am connected to the internet as writing this support request should prove. The message says 'an unknown error occured - error (-3212)'  This error only happened yesterd

  • Hi All, Mac Pro 2008 will not start after shutdown straight from sleep! Help!

    WILL A NEW LOGIC BOARD SOLVE MY PROBLEM? My early 2008 Mac Pro (2.8, 8-core 22 gigs ram) was shutting down from sleep both when I activated it, and then later by itself. Recently it refused to turn on, shuts down after about 3 seconds, light goes off

  • How do i get new tabs back to firefox

    when i open a new tab it opens as bing...how do i get firefox back?