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

Similar Messages

  • 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();
    }

  • SHA1 Hash value different

    Hi,
    I tried to use the DBMS_CRYPTO.HASH function to get the SHA1 hash value of strings
    "appleM00003A00000001411111111111111101123100MYR" which suppose to be "KN4bMOKw5nu29RLZ2xXqDr/H5Lc=" ,
    but the DBMS_CRYPTO.HASH function return a different value as "28DE1B30E2B0E67BB6F512D9DB15EA0EBFC7E4B7",
    Following are the code I use to get the SHA1 hash value
    DECLARE
    l_credit_card_no VARCHAR2(50) := 'appleM00003A00000001411111111111111101123100MYR';
    l_ccn_raw RAW(128) := utl_raw.cast_to_raw(l_credit_card_no);
    l_encrypted_raw RAW(2048);
    BEGIN
    dbms_output.put_line('CC: ' || l_ccn_raw);
    l_encrypted_raw := dbms_crypto.hash(l_ccn_raw, 3);
    dbms_output.put_line('SH1: ' || l_encrypted_raw);
    END;
    Anyone know if I using the correct function?
    Thanks
    Vincent pek

    There's an additional base64 encoding included:
    SQL>  declare
    l_credit_card_no varchar2(50) := 'appleM00003A00000001411111111111111101123100MYR';
    l_ccn_raw raw(128) := utl_raw.cast_to_raw(l_credit_card_no);
    l_encrypted_raw raw(2048);
    begin
    dbms_output.put_line('CC: ' || l_ccn_raw);
    l_encrypted_raw := dbms_crypto.hash(l_ccn_raw, 3);
    dbms_output.put_line('SH1: ' || (utl_raw.cast_to_varchar2(utl_encode.base64_encode(l_encrypted_raw))));
    end;
    CC: 6170706C654D30303030334130303030303030313431313131313131313131313131313130313132333130304D5952
    SH1: KN4bMOKw5nu29RLZ2xXqDr/H5Lc=
    PL/SQL procedure successfully completed.

  • SHA1 hashing

    There are some folks saying that SHA1 (160 bit) should not be used any longer on IPSEC implementations since it is broken.
    Can anybody comment on this? For phase 2 there is sha1 + hmac(cannot be broken yet), what about Phase1?
    Whole world is still running IKE v1 VPN IPSEC using SHA1 hash.

    Hi Ruterford,
    Indeed IKEv1 security has been improved by IKEv2.
    In order to have some more secure algorithms, then you will need to consider IKEv2, an ASA running 8.4 or later should give the following integrity algorithms:
    ciscoasa(config)# crypto ikev2 policy 10
    ciscoasa(config-ikev2-policy)# integrity ?
    ikev2-policy mode commands/options:
      md5     set hash md5
      sha     set hash sha1
      sha256  set hash sha256
      sha384  set hash sha384
      sha512  set hash sha512
    IKEv1 does not only support SHA1.
    Thanks.
    Portu.
    Please rate any helpful posts

  • 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

  • Difference in PHP an Java SHA1 Hash

    Hello,
    i wrote a Java app that uses SHA1 to compute hashes of users passwords witch are stored in a MySQL database. When i try to check PHP hashed user input against the stored value, they dont match.
    Java class:
    public class Hasher {
        private String type;
        public Hasher(String type) {
            this.type = type;
        public String encode(String pw) {
            String hash = new String("");
            try {
                MessageDigest md = MessageDigest.getInstance(type);          
                byte[] textBytes = pw.getBytes("8859_1");
                md.update(textBytes);       
                for (byte b : md.digest()) {
                    hash += Integer.toHexString(b & 0xff);
            catch (NoSuchAlgorithmException e) {           
                e.printStackTrace();
            catch (UnsupportedEncodingException ex) {
                ex.printStackTrace();
            return hash;
    }Example:
    String to hash: 1234
    Result of class shown above: 7110eda4d09e62aa5e4a390b0a572acd2c220
    Result of PHP sha1 function: 7110eda4d09e062aa5e4a390b0a572ac0d2c0220
    obviously they dont match :) but why??

    In case anyone stumbles across this post in search of Java SHA-1 tips - like I did - I would recommend using the static method DigestUtils.shaHex(String) within the same commons codec JAR mentioned above. It's use of a String as a parameter and return type make it the easiest SHA-1 method out there in my opinion.

  • Sha1 hash function (Message Digest)

    I am trying to create a program that lists the current java programs in a directory that is run through command line arguments, ( which works) however once i have populated all the java files i need to then turn the file names into sha1 message digests for the next step. I have the relevant code for this to work but i can not get it to compile is there something i have done wrong? or put the code in the wrong place?? here is my code feel free to amend it.
    Thanks Mich
    import java.io.UnsupportedEncodingException;
    import java.security.MessageDigest;
    import java.security.NoSuchAlgorithmException;
    import java.io.File;
    import java.io.FilenameFilter;
    import java.util.Scanner;
    public class ListDirectories implements FilenameFilter {
    static Scanner sc = new Scanner(System.in);
    public static void main (String [] args) throws UnsupportedEncodingException, NoSuchAlgorithmException {
    String path = args [0];
    ListDirectories ff = new ListDirectories();
    ff.process(path);
    public void process(String dir) {
    String objects[] = (new File(dir)).list(this);
    for (int i = 0; i < objects.length; i++) {
    System.out.println("TRACE:"+objects);
    public boolean accept(File dir, String s) {
    if (s.endsWith(".java")) {
    return true;
    return false;
    //public void MessageDigest(){
    MessageDigest md = MessageDigest.getInstance("SHA");
    try {
    md.update(objects);
    MessageDigest objects = md.clone();
    byte[] objectsDigest = objects.digest();
    md.update(objects);
    } catch (CloneNotSupportedException cnse) {
    throw new DigestException("couldn't make digest of partial content");

    import java.io.UnsupportedEncodingException;
    import java.security.DigestException;
    import java.security.MessageDigest;
    import java.security.NoSuchAlgorithmException;
    import java.io.File;
    import java.io.FilenameFilter;
    import java.util.Scanner;
    public class ListDirectories implements FilenameFilter {
         static Scanner sc = new Scanner(System.in);
         public static void main (String [] args) throws UnsupportedEncodingException, NoSuchAlgorithmException {
              String path = args [0];
              ListDirectories ff = new ListDirectories();
              ff.process(path);
         public void process(String dir) {
              String objects[] = (new File(dir)).list(this);
              for (int i = 0; i < objects.length; i++) {
                   System.out.println("TRACE:"+objects);
         public boolean accept(File dir, String s) {
              if (s.endsWith(".java")) {
                   return true;
              return false;
         public void MessageDigest(){
              MessageDigest md = MessageDigest.getInstance("SHA");
              try {
                   MessageDigest objects = md.clone();
                   md.update(objects);
                   byte[] objectsDigest = objects.digest();
                   md.update(objects);
              } catch (CloneNotSupportedException cnse) {
                   throw new DigestException("couldn't make digest of partial content");
    }this where the error occur
    MessageDigest objects = md.clone();
    md.update(objects);
    byte[] objectsDigest = objects.digest();
    md.update(objects);
    The method update(byte) in the type MessageDigest is not applicable for the argumentsListDirectories.java     line 42     1187874400500     26683
    The method update(byte) in the type MessageDigest is not applicable for the arguments ListDirectories.java     line 44     1187874400500     26684
    Type mismatch: cannot convert from Object to MessageDigest     Test2     ListDirectories.java     line 41     1187874400500     26682

  • Sha1 or MD5 hash

    Is there a SHa1 or Md5 hash check for Mountain lion like the other updated Aple provides?
    It seems Apple provides Sha1 hashes for its updates but not for a major operating system? Why?

    This is a question best asked of Apple directly; the "why" questions are often not something that non-Apple folks are in a position to answer.
    Of what's been posted and discussed about your question, "For updates delivered by Automatic Software Update, SHA-1 digest verification is performed automatically for you."  (HT1652)  
    For details on code signing used on more recent OS X releases, see the Code Signing Guide and review commands such as codesign --verify --deep-verify --verbose /applications/Install\ OS\ X\ Mountain\ Lion.app  and codesign --display -vvv  --entitlements - /applications/Install\ OS\ X\ Mountain\ Lion.app    Based on the output from those and related commands, the code-signing here is using SHA-1, and it traces back to Apple digital certificates.  
    AFAIK, the installation verifies the signatures, as it wouldn't be much value otherwise.
    US NSA and Apple security guides are among the available security-related documentation.   Apple's Gatekeeper (HT5290) might also be of some interest.
    Alternatively (and likely better), please call the Apple support center folks directly, as your requirements are clearly quite specialized, and it would appear your distribution path requirements may be equally specialized.
    FWIW, few folks are using MD5 anymore for anything more serious than detecting file transfer corruptions.

  • Using SHA1 for passwords in Solaris 10

    Does any know how to use SHA1 encryption for passwords on Solaris 10? I know I'd need to modify crypt.conf, but I don't know where to get the .so to go along with that.
    I'm moving some users from Mac OS X, and their passwords are SHA1 hashes.
    Thanks!
    Mike VanHorn
    [email protected]

    yes, no and maybe :-)
    There is a command in /usr/platform/SUNW,Sun-Fire-V210/sbin which allows you to control the LOM, the name of this command is "scadm", the LOM packages on the supplemental CD are for different (older) types of LOM and doesn't to anything useful at all on a SunFire V210.
    However, even though the scadm command let you administer the LOM, it won't display the temprature, but you can use the prtdiag -v command to display information about fans, tempratures and friends.
    Happy Easter.
    //Magnus

  • Hash created using DBMS_CRYPTO.Hash and md5sum, sha1sum not maching.

    Hi,
    I have PL/SQL script MD5SH1.sql to generate md5 and sha1 hash, but hash generated by this script and
    hash generated by md5sum and sha1sum utility not matching.
    Pl. tell me what is wrong,
    ------------------MD5SH1.sql----------------
    set serveroutput on
    DECLARE
    input_string VARCHAR2 (200) := 'Lord of the ring'';
    output_str_md5 VARCHAR2 (200);
    output_str_sh1 VARCHAR2 (200);
    hash_raw_md5 RAW(2000);
    hash_raw_sh1 RAW(2000);
    hash_algo_type1 PLS_INTEGER := DBMS_CRYPTO.HASH_MD5;
    hash_algo_type2 PLS_INTEGER := DBMS_CRYPTO.HASH_SH1;
    BEGIN
    DBMS_OUTPUT.PUT_LINE ( 'Original string: ' || input_string);
    hash_raw_md5 := DBMS_CRYPTO.Hash
    src => UTL_I18N.STRING_TO_RAW (input_string, NULL),
    --src => input_string,
    typ => hash_algo_type1
    hash_raw_sh1 := DBMS_CRYPTO.Hash
    src => UTL_I18N.STRING_TO_RAW (input_string, NULL),
    --src => input_string,
    typ => hash_algo_type2
    output_str_md5 := UTL_I18N.RAW_TO_CHAR (hash_raw_md5,'US7ASCII');
    output_str_sh1 := UTL_I18N.RAW_TO_CHAR (hash_raw_sh1,'US7ASCII');
    --output_str_md5 := hash_raw_md5;
    --output_str_sh1 := hash_raw_sh1;
    --dbms_output.put_line(hash_raw_md5);
    --dbms_output.put_line(rawtohex(hash_raw_sh1));
    DBMS_OUTPUT.PUT_LINE ('MD5 Hash: ' || output_str_md5);
    DBMS_OUTPUT.PUT_LINE ('SH1 Hash: ' || output_str_sh1);
    END;
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    The O/p of this script is
    SYS@mydb> @MD5SH1.sql
    Original string: Lord of the ring
    MD5 Hash: �����+.v�`�a_A
    SH1 Hash:
    ����E�k�[�F[c�2�
    PL/SQL procedure successfully completed.
    SYS@mydb>
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    The o/p of md5sum and sha1sum is
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    [san@sde4 ~]$ echo "Lord of the ring" |md5sum
    f3fbb6dfd8a2d6f8f6aeabc4d6e17c57 -
    [san@sde4 ~]$ echo "Lord of the ring" |sha1sum
    856f6132e23c7e335ca4188bd45c7bc9515f6905 -
    [san@sde4 ~]$
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Why these 2 hashes are not matching?
    -Santosh Mhaskar

    You should take in account, that echo command adds a carriage return by default.
    SQL> set serveroutput on
    SQL> set echo on
    SQL> declare
      2    input_string       varchar2(200) := 'Lord of the ring'||chr(10);
      3    output_str_md5  varchar2(200);
      4    output_str_sh1  varchar2(200);
      5    hash_raw_md5       raw(2000);
      6    hash_raw_sh1       raw(2000);
      7    hash_algo_type1 pls_integer := dbms_crypto.hash_md5;
      8    hash_algo_type2 pls_integer := dbms_crypto.hash_sh1;
      9
    10  begin
    11    dbms_output.put_line('Original string: ' || input_string);
    12    hash_raw_md5      := dbms_crypto.hash(src => utl_raw.cast_to_raw(input_string),
    13                                       typ => hash_algo_type1);
    14    hash_raw_sh1      := dbms_crypto.hash(src => utl_raw.cast_to_raw(input_string),
    15                                       typ => hash_algo_type2);
    16    dbms_output.put_line('MD5 Hash: ' || lower(rawtohex(hash_raw_md5)));
    17    dbms_output.put_line('SH1 Hash: ' || lower(rawtohex(hash_raw_sh1)));
    18  end;
    19  /
    Original string: Lord of the ring
    MD5 Hash: f3fbb6dfd8a2d6f8f6aeabc4d6e17c57
    SH1 Hash: 856f6132e23c7e335ca4188bd45c7bc9515f6905
    PL/SQL procedure successfully completed.
    SQL> !echo "MD5 Hash:" `echo 'Lord of the ring' | md5sum`
    MD5 Hash: f3fbb6dfd8a2d6f8f6aeabc4d6e17c57 -
    SQL> !echo "SH1 Hash:" `echo 'Lord of the ring' | sha1sum`
    SH1 Hash: 856f6132e23c7e335ca4188bd45c7bc9515f6905 -Best regards
    Maxim

  • HMAC (SHA1) key longer than 81 characters not possible?

    Not sure whether I'm in the correct forum...
    To sign a message for a specific application with HMAC-SHA1 hash I need a 83 character key.
    My problem: the function module 'SET_HMAC_KEY' throws the exception "param_length_error". After I've testet with several key length, I found out, that the maximum valid length is 81. Is there any reason for this?
    With 3rd party libraries (ie. Python and Javascript) longer keys are working.
    Code:
    CALL FUNCTION 'SET_HMAC_KEY'
      EXPORTING
        generate_random_key         = ' '
        alg                         = 'SHA1'
        keycstr                     = 'cB1phTHISISATESTVuZMDmWCz1CEMy82iBC3HgFLpE&7857T...YFqV93gRJQ'
        client_independent          = ' '
      EXCEPTIONS
        unknown_alg                 = 1
        param_length_error          = 2
        internal_error              = 3
        param_missing               = 4
        malloc_error                = 5
        abap_caller_error           = 6
        base64_error                = 7
        calc_hmac_error             = 8
        rsec_record_access_denied   = 9
        rsec_secstore_access_denied = 10
        rsec_error                  = 11
        rng_error                   = 12
        record_number_error         = 13
        OTHERS                      = 14.
    Best regards, Uwe
    Edited by: Julius Bussche on Aug 5, 2010 10:19 PM
    I truncated the key further because in a coding tag it toasts the formatting when too long.

    Hi,
    yes, we can :-). Let say that SAP implementation supports a key with size more than 81 bytes. Then according to specification if the key is longer than block size of hash function (64 bytes for SHA-1) then it would use hash function to reduce original key to new key with size equals to output size of hash function (20 bytes for SHA-1). Therefore doing this step manually before calling SET_HMAC_KEY is equal to calling SET_HMAC_KEY which supports keys longer than 81 bytes.
    The easiest way how to check this is to compare some HMAC-SHA1 implementation with the result produced by my proposed logic.
    DATA: text TYPE string,
            key_str TYPE string,
            hash TYPE hash160x,
            key TYPE xstring,
            hmac TYPE hash512_base_64.
      text = 'Hello'.
      key_str = '012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789'.
      CALL FUNCTION 'CALCULATE_HASH_FOR_CHAR'
        EXPORTING
          data  = key_str
        IMPORTING
          hashx = hash.
      key = hash.
      CALL FUNCTION 'SET_HMAC_KEY'
        EXPORTING
          generate_random_key = space
          alg                 = 'SHA1'
          keyxstr             = key
          client_independent  = space.
      CALL FUNCTION 'CALCULATE_HMAC_FOR_CHAR'
        EXPORTING
          alg        = 'SHA1'
          data       = text
        IMPORTING
          hmacbase64 = hmac.
      WRITE: / hmac.
    Javascript version
    var hmac = Crypto.HMAC(Crypto.SHA1, "Message", "Secret Passphrase");
    var hmacBytes = Crypto.HMAC(Crypto.SHA1, "Message", "Secret Passphrase", { asBytes: true });
    var hmacString = Crypto.HMAC(Crypto.SHA1, "Message", "Secret Passphrase", { asString: true });
    Both implementations return "qsXNz/wecK4PMob6VG9RyRX6DQI=".
    Cheers
    Sorry for formatting but it looks like something is broken.
    Edited by: Martin Voros on Aug 6, 2010 10:34 PM

  • Where to find MD5 or SHA1 for the JRE/JDK?

    I am trying to download the latest 1.6 JRE and JDK, but I don't see any MD5/SHA1 hashes?
    Anyone know where I can get these (from Oracle, not a third party).
    Given recent security issues, I would be surprised if they didn't offer these.
    Thanks!

    That's not completely true. It depends on where you download it from. For example you can go to http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase7-521261.html#jdk-7u17-oth-JPR which will let you choose which build of 7u17 you want. You can download Windows x86 (or x64) which will download the entire offline installation. I also use http://www.filehippo.com/download_jre_32/tech/14874/ (becuase I trust it). While I download the EXEs and MSIs from oracle's website, filehippo has MD5 hashes listed. Just an idea. If you're needing a script that can get MD5 hashes you could like at using AutoIt. It has a build hashing function. The scripting language is easy to use and it has a strong community (http://www.autoitscript.com/autoit3/docs/libfunctions/_Crypt_HashFile.htm).

  • Upgrade certificate authority to SHA256 hashes

    My SBS 2011 is running for 2 years, and the certificate authority was created (quietly as part of the installation, it seems) to use SHA1 hashes and the "Microsoft Strong Cryptographic Provider". If I understand correctly, this is considered
    obsolete by today's standards of security. However, I do not see any easy-to-use guide or how-to to perform the change(s).

    Hi,
    SHA-1 certificates are being phased out very quickly and in 2017 Microsoft will stop trusting them. However a lot of browsers will start showing warning messages on these kinds of certificates in 2016. Therefore to protect yourself, ensure that you are requesting
    SHA-2 certificates and have replaced any SHA-1 certificates by the end of 2015.
    To Check whether the certificate is SHA-1 or SHA-2.
    To do that, browse to the SSL site, then open the SSL certificate. Click on the Details tab and then look for Signature Hash Algorithm. It should NOT say SHA1. Do not confuse with Thumbprint Algorithm, which will always say SHA1, no matter the type of the certificate.
    If they are SHA1, then get them rekeyed to SHA-2
    See the following article :
    http://www.cusoon.fr/update-microsoft-certificate-authorities-to-use-the-sha-2-hashing-algorithm-2/
    Binu Kumar - MCP, MCITP, MCTS , MBA - IT , Director Aarbin Technology Pvt Ltd - Please remember to mark the replies as answers if they help and unmark them if they provide no help.

  • Powershell HASH

    I created this script in Powershell
    to read a DB record and create a
    hash of it salty and insert it back
    in a table, good script
    works fine the way I need, but
    what sticks is the delay 9 million record
    two days. I need if anyone has any
    command that could make it faster to things.
    Who has little record and want to use
    this script are comfortable it works.
    $user = "user"
    $pwd = "pws"
    $database = "bdd"
    $SqlServer = "round"
    $SqlLogs = "T_Powershll"
    $Date = (Get-Date -format g)
    $SqlConnection = New-Object system.Data.SqlClient.SqlConnection
    $SqlConnection.ConnectionString ="Server=$dataSource;uid=$user; pwd=$pwd;Database=$database;Integrated Security=False;"
    $SqlConnection2 = New-Object system.Data.SqlClient.SqlConnection("Server=$dataSource;uid=$user; pwd=$pwd;Database=$database;Integrated Security=False;")
    $seq=1
    $fim=9561421
    While ($seq -le $fim){
    $SqlCommandText = "Select Cartao from T_Powershll_base where Id_seq= $seq "
    $SqlConnection.Open()
    $SqlConnection2.Open()
    $SqlCmd = New-Object Data.SqlClient.SqlCommand($SqlCommandText, $SqlConnection)
    $sqlcmd2 = $SqlConnection2.createcommand()
    $Reader = $SqlCmd.ExecuteReader()
    $SqlData = @( )
    while ($Reader.Read())
     $SqlData += "" | Select-Object `
     @{ n = 'Cartao' ; e = { $Reader["Cartao"].ToString() } }
    $Reader.Close()
    $sha1 = New-Object System.Security.Cryptography.SHA1CryptoServiceProvider;
    $sha1.Initialize();
    $Salgado="710000hhgiiAAAhhhhooohzaqnpa
              epszx7w2soPmdfapa)gbbakkazwq
    $cart=$SqlData.Cartao
    $cart2=[System.Text.Encoding]::ASCII.GetBytes($cart.PadRight(32,'_'));
    $lim4=[System.Convert]::FromBase64String($Salgado.ToString());
    $ab =$sha1.ComputeHash($cart2+$lim4);
    $HASH="{0}" -f [system.BitConverter]::ToString($ab)-replace "-",""
    $sqlcmd2.CommandText = "INSERT INTO $SQLLogs (Cartao, Cartao_Hash) VALUES ('$($SqlData.Cartao)', '$($HASH)')"
    $Results = $SqlCmd2.ExecuteNonQuery()
    $seq++
    $SqlConnection.close()
    $SqlConnection2.close()
    TKS.

    clayman2 is correct, you can modify your code to use only a single connection without an issue.
    I have a number of thoughts on this one. You'll have to try things out to see what actually gets you speed gains, though. It all depends on the nature of the data you're working with.
    1. You can take your $SqlConnection.Open() and $SqlConnection.Close() calls outside of your while loop. That way you open your connection once, execute a bunch of commands, and then close it.
    2. Another suggestion clayman2 had - performing a smaller number of operations against the SQL Server, doing the most work possible in each, will save you time. For example, could you just run this query:
    SELECT Cartao FROM T_Powershll_base WHERE Id_seq BETWEEN 1 AND $fim
    and loop through the results? That would eliminate 9561420 additional SELECT queries.
    3. You're using a DataReader to retrieve the results line by line. There's a chance you might get better performance using a DataSet, which will handle retrieving results in batches on its own. Something like this will get you started.
    $adapter = New-Object System.Data.sqlclient.sqlDataAdapter $SqlCmd
    $dataset = New-Object System.Data.DataSet
    $adapter.Fill($dataSet) | Out-Null
    for ($row in $dataSet.Tables[0].Rows) {
    # Your logic here. Use $row.FieldName to access data
    4. The most efficient way to perform this task would be if you could create a stored procedure on the SQL Server itself and remove the network traffic and PowerShell processing from the equation. After a quick search, I found that there is the
    HASHBYTES function, which you can use to get the SHA1 hash of a string. You might consider digging into the Transact-SQL to see if you can achieve it that way.
    I know that's a lot of info, but tuning the performance of these things is often a try-it-and-see process. Good luck!

  • JDK1.2.2 and untrusted server chain and HELP

    Hi,
    I'm using JDK1.2.2 and I've downloaded and installed JSSE1.02. I have also installed the server cert in my own truststore.
    The server to whom I want to connect sends two certificates.
    One is valid and this is the one I need and I have and one that is timed out and of no importance for me...at least I guess it is.
    But my JSSE-application throws an this exception. For more detailled information I've attached the log:
    keyStore is :
    keyStore type is : jks
    init keystore
    init keymanager of type SunX509
    trustStore is: C:/NetDynamics50/java/jre/lib/security/lauerstore
    trustStore type is : jks
    init truststore
    adding as trusted cert: [
    Version: V3
    Subject: CN=inte.myaxa.de, OU=Executive Management, O=@AXA GmbH, L=Koeln, ST=NRW, C=DE
    Signature Algorithm: MD5withRSA, OID = 1.2.840.113549.1.1.4
    Key: com.sun.net.ssl.internal.ssl.JSA_RSAPublicKey@31cdcb27
    Validity: [From: Fri Jun 15 16:25:05 GMT+02:00 2001,
                   To: Sun Jun 15 16:25:05 GMT+02:00 2003]
    Issuer: [email protected], CN=Thawte Server CA, OU=Certification Services Division, O=Thawte Consulting cc, L=Cape Town, ST=Western Cape, C=ZA
    SerialNumber: [    080e20]
    Certificate Extensions: 2
    [1]: ObjectId: 2.5.29.19 Criticality=true
    BasicConstraints:[
    CA:false
    PathLen: undefined
    [2]: ObjectId: 2.5.29.37 Criticality=false
    Extension unknown: DER encoded OCTET string =
    0000: 04 17 30 15 06 08 2B 06 01 05 05 07 03 01 06 09 ..0...+.........
    0010: 60 86 48 01 86 F8 42 04 01 `.H...B..
    Algorithm: [MD5withRSA]
    Signature:
    0000: 32 D8 11 96 F5 66 CE 7A 2C DD 39 03 BB 54 41 66 2....f.z,.9..TAf
    0010: EE B7 6E 7A 95 57 73 C5 66 83 67 9C 35 B7 75 05 ..nz.Ws.f.g.5.u.
    0020: A1 6D 9D 36 A7 7A AA 12 CD AE 64 5B E5 F9 EE EF .m.6.z....d[....
    0030: 7C BB 63 7E 5A E6 9F BA 50 8F 92 A2 C6 FA B5 8B ..c.Z...P.......
    0040: 25 8B 95 37 AA C4 6D 7A C1 E6 DA 35 18 82 24 1A %..7..mz...5..$.
    0050: 9A 0D E3 A2 F1 3B 4D 35 C6 00 B7 E8 6B 14 0B 82 .....;M5....k...
    0060: BC E1 29 6E 24 10 27 B2 86 52 CD 85 C5 A9 CE 69 ..)n$.'..R.....i
    0070: D1 69 79 67 07 9E 8B A2 23 DA 97 36 F5 D8 57 57 .iyg....#..6..WW
    init context
    trigger seeding of SecureRandom
    done seeding SecureRandom
    %% No cached client session
    *** ClientHello, v3.1
    RandomCookie: GMT: 983585972 bytes = { 41, 169, 119, 141, 169, 223, 159, 184, 182, 97, 133, 56, 227, 20, 209, 115, 225, 62, 106, 169, 106, 250, 37, 25, 45, 7, 25, 215 }
    Session ID: {}
    Cipher Suites: { 0, 5, 0, 4, 0, 9, 0, 10, 0, 18, 0, 19, 0, 3, 0, 17 }
    Compression Methods: { 0 }
    [write] MD5 and SHA1 hashes: len = 59
    0000: 01 00 00 37 03 01 3B A0 55 B4 29 A9 77 8D A9 DF ...7..;.U.).w...
    0010: 9F B8 B6 61 85 38 E3 14 D1 73 E1 3E 6A A9 6A FA ...a.8...s.>j.j.
    0020: 25 19 2D 07 19 D7 00 00 10 00 05 00 04 00 09 00 %.-.............
    0030: 0A 00 12 00 13 00 03 00 11 01 00 ...........
    Thread-6, WRITE: SSL v3.1 Handshake, length = 59
    [write] MD5 and SHA1 hashes: len = 77
    0000: 01 03 01 00 24 00 00 00 20 00 00 05 00 00 04 01 ....$... .......
    0010: 00 80 00 00 09 06 00 40 00 00 0A 07 00 C0 00 00 .......@........
    0020: 12 00 00 13 00 00 03 02 00 80 00 00 11 3B A0 55 .............;.U
    0030: B4 29 A9 77 8D A9 DF 9F B8 B6 61 85 38 E3 14 D1 .).w......a.8...
    0040: 73 E1 3E 6A A9 6A FA 25 19 2D 07 19 D7 s.>j.j.%.-...
    Thread-6, WRITE: SSL v2, contentType = 22, translated length = 16310
    Thread-6, READ: SSL v3.0 Handshake, length = 1599
    *** ServerHello, v3.0
    RandomCookie: GMT: 722821779 bytes = { 190, 56, 167, 5, 198, 89, 180, 112, 96, 251, 78, 78, 144, 103, 57, 130, 219, 11, 56, 169, 199, 73, 79, 241, 241, 131, 74, 145 }
    Session ID: {0, 154, 4, 1, 195, 195, 38, 26, 66, 92, 154, 191, 59, 96, 218, 24, 81, 133, 102, 48, 169, 26, 50, 42, 10, 49, 78, 150, 71, 182, 163, 33}
    Cipher Suite: { 0, 4 }
    Compression Method: 0
    %% Created: [Session-1, SSL_RSA_WITH_RC4_128_MD5]
    ** SSL_RSA_WITH_RC4_128_MD5
    [read] MD5 and SHA1 hashes: len = 74
    0000: 02 00 00 46 03 00 2B 15 63 93 BE 38 A7 05 C6 59 ...F..+.c..8...Y
    0010: B4 70 60 FB 4E 4E 90 67 39 82 DB 0B 38 A9 C7 49 .p`.NN.g9...8..I
    0020: 4F F1 F1 83 4A 91 20 00 9A 04 01 C3 C3 26 1A 42 O...J. ......&.B
    0030: 5C 9A BF 3B 60 DA 18 51 85 66 30 A9 1A 32 2A 0A \..;`..Q.f0..2*.
    0040: 31 4E 96 47 B6 A3 21 00 04 00 1N.G..!...
    *** Certificate chain
    chain [0] = [
    Version: V3
    Subject: CN=inte.myaxa.de, OU=Executive Management, O=@AXA GmbH, L=Koeln, ST=NRW, C=DE
    Signature Algorithm: MD5withRSA, OID = 1.2.840.113549.1.1.4
    Key: com.sun.net.ssl.internal.ssl.JSA_RSAPublicKey@5f45cb24
    Validity: [From: Fri Jun 15 16:25:05 GMT+02:00 2001,
                   To: Sun Jun 15 16:25:05 GMT+02:00 2003]
    Issuer: [email protected], CN=Thawte Server CA, OU=Certification Services Division, O=Thawte Consulting cc, L=Cape Town, ST=Western Cape, C=ZA
    SerialNumber: [    080e20]
    Certificate Extensions: 2
    [1]: ObjectId: 2.5.29.19 Criticality=true
    BasicConstraints:[
    CA:false
    PathLen: undefined
    [2]: ObjectId: 2.5.29.37 Criticality=false
    Extension unknown: DER encoded OCTET string =
    0000: 04 17 30 15 06 08 2B 06 01 05 05 07 03 01 06 09 ..0...+.........
    0010: 60 86 48 01 86 F8 42 04 01 `.H...B..
    Algorithm: [MD5withRSA]
    Signature:
    0000: 32 D8 11 96 F5 66 CE 7A 2C DD 39 03 BB 54 41 66 2....f.z,.9..TAf
    0010: EE B7 6E 7A 95 57 73 C5 66 83 67 9C 35 B7 75 05 ..nz.Ws.f.g.5.u.
    0020: A1 6D 9D 36 A7 7A AA 12 CD AE 64 5B E5 F9 EE EF .m.6.z....d[....
    0030: 7C BB 63 7E 5A E6 9F BA 50 8F 92 A2 C6 FA B5 8B ..c.Z...P.......
    0040: 25 8B 95 37 AA C4 6D 7A C1 E6 DA 35 18 82 24 1A %..7..mz...5..$.
    0050: 9A 0D E3 A2 F1 3B 4D 35 C6 00 B7 E8 6B 14 0B 82 .....;M5....k...
    0060: BC E1 29 6E 24 10 27 B2 86 52 CD 85 C5 A9 CE 69 ..)n$.'..R.....i
    0070: D1 69 79 67 07 9E 8B A2 23 DA 97 36 F5 D8 57 57 .iyg....#..6..WW
    chain [1] = [
    Version: V1
    Subject: [email protected], CN=Thawte Server CA, OU=Certification Services Division, O=Thawte Consulting cc, L=Cape Town, ST=Western Cape, C=ZA
    Signature Algorithm: MD5withRSA, OID = 1.2.840.113549.1.1.4
    Key: com.sun.net.ssl.internal.ssl.JSA_RSAPublicKey@96e1cb27
    Validity: [From: Sat Jul 27 20:07:57 GMT+02:00 1996,
                   To: Mon Jul 27 20:07:57 GMT+02:00 1998]
    Issuer: [email protected], CN=Thawte Server CA, OU=Certification Services Division, O=Thawte Consulting cc, L=Cape Town, ST=Western Cape, C=ZA
    SerialNumber: [  0  ]
    Algorithm: [MD5withRSA]
    Signature:
    0000: 8B 2F 9F B8 9F 5F 74 54 22 BB D8 5E DA 48 E0 33 ./..._tT"..^.H.3
    0010: 9F 01 19 13 A2 0C 26 EA 8E CE C1 57 65 F7 7C 85 ......&....We...
    0020: 84 37 17 EE 1E 6D D1 76 75 D4 C5 00 33 38 8A 75 .7...m.vu...38.u
    0030: D7 B7 AE 64 EF CD 46 08 50 26 28 63 96 F4 DF 62 ...d..F.P&(c...b
    0040: 30 18 C4 EF 76 27 25 2B E4 93 37 A3 4F DA 6E 67 0...v'%+..7.O.ng
    0050: BC 50 0C A8 94 F9 80 2E 4E FA 3F E3 06 E6 51 43 .P......N.?...QC
    0060: 88 B4 00 C6 10 AF 91 78 95 3F 28 04 99 E1 81 A7 .......x.?(.....
    0070: F0 E8 F2 FC 68 36 36 BC C1 C6 48 F9 7D FB BB 9F ....h66...H.....
    out of date cert: [
    Version: V1
    Subject: [email protected], CN=Thawte Server CA, OU=Certification Services Division, O=Thawte Consulting cc, L=Cape Town, ST=Western Cape, C=ZA
    Signature Algorithm: MD5withRSA, OID = 1.2.840.113549.1.1.4
    Key: com.sun.net.ssl.internal.ssl.JSA_RSAPublicKey@96e1cb27
    Validity: [From: Sat Jul 27 20:07:57 GMT+02:00 1996,
                   To: Mon Jul 27 20:07:57 GMT+02:00 1998]
    Issuer: [email protected], CN=Thawte Server CA, OU=Certification Services Division, O=Thawte Consulting cc, L=Cape Town, ST=Western Cape, C=ZA
    SerialNumber: [  0  ]
    Algorithm: [MD5withRSA]
    Signature:
    0000: 8B 2F 9F B8 9F 5F 74 54 22 BB D8 5E DA 48 E0 33 ./..._tT"..^.H.3
    0010: 9F 01 19 13 A2 0C 26 EA 8E CE C1 57 65 F7 7C 85 ......&....We...
    0020: 84 37 17 EE 1E 6D D1 76 75 D4 C5 00 33 38 8A 75 .7...m.vu...38.u
    0030: D7 B7 AE 64 EF CD 46 08 50 26 28 63 96 F4 DF 62 ...d..F.P&(c...b
    0040: 30 18 C4 EF 76 27 25 2B E4 93 37 A3 4F DA 6E 67 0...v'%+..7.O.ng
    0050: BC 50 0C A8 94 F9 80 2E 4E FA 3F E3 06 E6 51 43 .P......N.?...QC
    0060: 88 B4 00 C6 10 AF 91 78 95 3F 28 04 99 E1 81 A7 .......x.?(.....
    0070: F0 E8 F2 FC 68 36 36 BC C1 C6 48 F9 7D FB BB 9F ....h66...H.....
    Thread-6, SEND SSL v3.0 ALERT: fatal, description = certificate_unknown
    Thread-6, WRITE: SSL v3.0 Alert, length = 2
    javax.net.ssl.SSLException: untrusted server cert chain
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a([DashoPro-V1.2-120198])
         at com.sun.net.ssl.internal.ssl.ClientHandshaker.a([DashoPro-V1.2-120198])
         at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage([DashoPro-V1.2-120198])
         at com.sun.net.ssl.internal.ssl.Handshaker.process_record(Compiled Code)
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(Compiled Code)
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(Compiled Code)
         at com.sun.net.ssl.internal.ssl.AppOutputStream.write(Compiled Code)
         at java.io.OutputStream.write(OutputStream.java:65)
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake([DashoPro-V1.2-120198])
         at com.sun.net.ssl.internal.www.protocol.https.HttpsClient.doConnect([DashoPro-V1.2-120198])
         at com.sun.net.ssl.internal.www.protocol.https.NetworkClient.openServer([DashoPro-V1.2-120198])
         at com.sun.net.ssl.internal.www.protocol.https.HttpClient.l([DashoPro-V1.2-120198])
         at com.sun.net.ssl.internal.www.protocol.https.HttpClient.<init>([DashoPro-V1.2-120198])
         at com.sun.net.ssl.internal.www.protocol.https.HttpsClient.<init>([DashoPro-V1.2-120198])
         at com.sun.net.ssl.internal.www.protocol.https.HttpsClient.a([DashoPro-V1.2-120198])
         at com.sun.net.ssl.internal.www.protocol.https.HttpsClient.a([DashoPro-V1.2-120198])
         at com.sun.net.ssl.internal.www.protocol.https.HttpsURLConnection.connect([DashoPro-V1.2-120198])
         at de.myaxa.application.adapter.SessionController.hitSession(Compiled Code)
         at java.lang.reflect.Method.invoke(Native Method)
         at de.myaxa.application.adapter.Command.execute(Compiled Code)
         at de.myaxa.application.adapter.MyAxaInterfaceServlet.doPost(MyAxaInterfaceServlet.java:117)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:747)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:840)
         at netdyn.servlet.CNdServletRequestHandler.handleRequest(CNdServletRequestHandler.java:132)
         at netdyn.servlet.env.CNdRequestEnvironment.executeRequest(Compiled Code)
         at netdyn.servlet.env.CNdRequestEnvironment.executeRequest(CNdRequestEnvironment.java:427)
         at netdyn.servlet.env.CNdRequestEnvironment.executeRequest(CNdRequestEnvironment.java:376)
         at netdyn.servlet.CNdServletManager.handleRequest(CNdServletManager.java:347)
         at netdyn.services.cp.worker.CNdCPWorkerOperations.webEventMessage(CNdCPWorkerOperations.java:530)
         at netdyn.services.cp.worker.CNdCPWorkerImpl.webEventMessage(CNdCPWorkerImpl.java:82)
         at netdyn.services.cp.stubs._tie_INdCPWorker.webEventMessage(_tie_INdCPWorker.java:23)
         at netdyn.services.cp.stubs._INdCPWorkerImplBase._execute(_INdCPWorkerImplBase.java:73)
         at netdyn.services.cp.stubs._INdCPWorkerImplBase._execute(_INdCPWorkerImplBase.java:48)
         at com.visigenic.vbroker.orb.SkeletonDelegateImpl.execute(Compiled Code)
         at com.visigenic.vbroker.orb.GiopProtocolAdapter.doRequest(Compiled Code)
         at com.visigenic.vbroker.orb.GiopProtocolAdapter.dispatchMessage(Compiled Code)
         at com.visigenic.vbroker.orb.ThreadPoolDispatcher.run(Compiled Code)
         at com.visigenic.vbroker.orb.WorkerThread.run(Compiled Code)
    de.myaxa.application.adapter.SessionController@89c5cb25 : javax.net.ssl.SSLException: untrusted server cert chain :

    [ O66183],
    This exception occurs because of an invalid or expired certificate within a public key certificate chain that causes the JSSE to terminate abnormally.
    If you look at your log file, you can see an 'out of date cert' message. I have extracted that part of the log with this statement:
              <SNIPPED>
    out of date cert: [
    Version: V1
    Subject: EmailAddress=[email protected],
    , CN=Thawte Server CA, OU=Certification Services
    Division, O=Thawte Consulting cc, L=Cape Town,
    ST=Western Cape, C=ZA
    Signature Algorithm: MD5withRSA, OID =
    = 1.2.840.113549.1.1.4
    Key:
    com.sun.net.ssl.internal.ssl.JSA_RSAPublicKey@96e1cb27
    Validity: [From: Sat Jul 27 20:07:57 GMT+02:00
    0 1996,
    To: Mon Jul 27 20:07:57 GMT+02:00
    7:57 GMT+02:00 1998]
    Issuer: EmailAddress=[email protected],
    , CN=Thawte Server CA, OU=Certification Services
    Division, O=Thawte Consulting cc, L=Cape Town,
    ST=Western Cape, C=ZA
    SerialNumber: [  0  ]          <SNIPPED>
    HTH.
    Allen Lai
    Developer Technical Support
    SUN Microsystems
    http://www.sun.com/developers/support/

Maybe you are looking for

  • Disk Utility wont drag drives on Mac book Pro

    I am tring to back up may system drive, and i cant drag it to the source on disk utility, acctually i cant drag anything into it, while i have no problems on my dual g5, so i guess the problem is on the intel disk utility. any ideas?

  • Session REC-0811-4 was not created via tcode(F.14)

    Hi,    We use the tcode(F.14) can't generate session. The following is the message. I put the selection is same as previous except the date. Could you pls help us check it?Thanks. =============================== Session REC-0811-4 was not created Mes

  • Can't play rented movie through quick time player

    i've rented a movie and can't watch it with quick time? Isn't this possible or am I forgetting something?

  • Is there a possibility to retreve Data from the OPC Server with the XML Interface

    Is there a possibility to connect a OPC/DA server with the help of the XML interface with Labview? I need to retrieve Data from a OPC Server running on Linux, so i got no Dcom System an I need to use XML. The server is running and with OPC client-too

  • How to use employee Skills in work center

    Dear PP Gurus, How can I map various skills employee in on work center? Example a work center consist of 10 work men out of which 4 are highly skilled, 3 are skilled and 3 are semi skilled. How can I map this in one work cnetr and use for capacity pl