MessageDigest.update

Hello,
I'm currently writing an iPhone app which connects and authenticates with a server written in Java. Due to security, I want to send the user data encrypted.
On the server I use:
byte[] bSalt = base64ToByte(salt);
MessageDigest digest = MessageDigest.getInstance("SHA-256");
digest.reset();
digest.update(bSalt);
byte[] bToHash = digest.digest(toHash.getBytes("UTF-8"));
for (int i = 0; i < 3; i++) {
System.out.println(byteToBase64(bToHash));
digest.reset();
digest.update(bSalt); // More secure?
bToHash = digest.digest(bToHash);
By now, I managed to hash in Objective C, too, but the salt is the problem. For getting the same hashing results in ObjC, I need to know what MessageDigest.update does. Does it simply compute an OR with the current digest and the salt or what does it do? Thanks for your help.
Greetings
Naznaz

MessageDigest digest = MessageDigest.getInstance("SHA-256");
digest.reset();The reset() is unnecessary here. You've just created the MessageDigest object. Resetting it won't change anything - there is nothing to change yet.
digest.update(bSalt);
byte[] bToHash = digest.digest(toHash.getBytes("UTF-8"));
for (int i = 0; i < 3; i++) {There is little to gain from repeating the digesting algorithm three times.
System.out.println(byteToBase64(bToHash));
digest.reset();Almost certainly wrong. You are throwing away all prior state here, including the salt.
digest.update(bSalt); // More secure?More secure than what? I suspect you can omit this too.
bToHash = digest.digest(bToHash);That should almost certainly be update(), not digest(). digest() is the last thing you call, when you get to the last piece of input.
I need to know what MessageDigest.update does.It's algorithm-dependent, obviously. In this case you are using SHA-256 so you would need to look up that algorithm. It's lengthy!
Does it simply compute an OR with the current digest and the saltDefinitely not. It applies the specified digest algorithm to its current state and the next piece of input you provide. This code should mirror the code you say you already have working in Objective-C.
But none of this is encryption. It is message-digesting. The result cannot be decrypted.

Similar Messages

  • MessageDigest update/digest method

    Hi everyone!
    I'd like to know if there's a way to invert operations of update/digest methods.
    See the code belove:
    byte b[] = ...;
    byte d[];
    MessageDigest md;
              try {
                   md = MessageDigest.getInstance ("MD5");
              } catch (NoSuchAlgorithmException a) {
                   md = null;
                   md.update (b, 0, 7);
                   d = md.digest ();
    .....Having d byte array, can I obtain original array b from which I started.
    Thank you very much all in advance
    Diego

    thank you

  • Exception in thread "Thread-4" java.lang.IllegalAccessError

    Hi All,
    I am getting this error at run-time while trying to run below code
    Exception in thread "Thread-4" java.lang.IllegalAccessError
    CODE:
    ================================
    * FileName : UMAC.java *
    * Program Details : For getting Signed data. *
    * Invoked From : SignedDataImpl.java *
    package sfmsbr.bankapi;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.IOException;
    import java.security.InvalidKeyException;
    import java.security.Key;
    import java.security.KeyPair;
    import java.security.KeyStore;
    import java.security.MessageDigest;
    import java.security.NoSuchAlgorithmException;
    import java.security.NoSuchProviderException;
    import java.security.PrivateKey;
    import java.security.PublicKey;
    import java.security.Security;
    import java.security.Signature;
    import java.security.cert.Certificate;
    import java.security.cert.X509Certificate;
    import java.util.Date;
    import java.util.Enumeration;
    import javax.crypto.BadPaddingException;
    import javax.crypto.Cipher;
    import javax.crypto.IllegalBlockSizeException;
    import javax.crypto.NoSuchPaddingException;
    import com.ibm.misc.BASE64Decoder;
    import com.ibm.misc.BASE64Encoder;
    import sun.security.pkcs.ContentInfo;
    import sun.security.pkcs.PKCS7;
    import sun.security.pkcs.PKCS9Attribute;
    import sun.security.pkcs.PKCS9Attributes;
    import sun.security.pkcs.SignerInfo;
    import com.ibm.security.util.DerOutputStream;
    /*import sun.security.x509.AlgorithmId;*/
    import com.ibm.security.x509.AlgorithmId;
    /*import sun.security.x509.X500Name;*/
    import com.ibm.security.x509.X500Name;
    /*import com.ibm.jsse.IBMJSSEProvider;*/
    import org.apache.harmony.security.asn1.DerInputStream;
    import com.cs.common.Utilities;
    import com.sun.net.ssl.internal.ssl.Provider;
    /*import javax.net.ssl.*;*/
    import sun.security.pkcs.*;
    public class UMAC
    private static String storetype = null;
    private static String storepath = null;
    private static char keyPassword[] = null;
    private static char filePassword[] = null;
    private static String alias = null;
    private static X509Certificate x509 = null;
    private static Certificate certs[] = null;
    private static final String digestAlgorithm = "SHA256";
    private static final String signingAlgorithm = "SHA256withRSA";
    private static Key key = null;
    private static KeyPair pair = null;
    private static KeyStore keystore = null;
    private static PrivateKey priv = null;
    private static PublicKey pub = null;
    private static String signedData = null;
    File certificateFile;
    private static String fileName = "";
    private static final String ALGORITHM = "PBEWithSHA256AndDes";
    private String characterEncoding;
    private Cipher encryptCipher;
    private Cipher decryptCipher;
    private BASE64Encoder base64Encoder = new BASE64Encoder();
    private BASE64Decoder base64Decoder = new BASE64Decoder();
    * Constructor to initialize the Parameters used
    * @param s file name/path
    * @param s1 is file password
    * @param s2 is key password
    * @param s3 is alias name
    * @throws IOException
    public UMAC(String s, String s1, String s2, String s3) throws IOException
    try {
    String dkeyPassword = Utilities.decodeDBPwd(s2);
    String dFilePassword = Utilities.decodeDBPwd(s1);
    keyPassword = (new String(dkeyPassword)).toCharArray();
    filePassword = (new String(dFilePassword)).toCharArray();
    alias = s3;
    fileName = s;
    } catch (Exception e) {
    e.printStackTrace();
    * method will prepare the digital signature for the message received as argument and returns the digital signature
    * @param s the message to prepare signed data
    * @return signed data prepard for the message received
    * @throws NoSuchAlgorithmException
    * @throws InvalidKeyException
    * @throws IllegalBlockSizeException
    * @throws NoSuchProviderException
    * @throws BadPaddingException
    * @throws NoSuchPaddingException
    * @throws Exception
    public String getSingedData(String s) throws NoSuchAlgorithmException, InvalidKeyException, IllegalBlockSizeException, NoSuchProviderException, BadPaddingException, NoSuchPaddingException, Exception
    Security.addProvider(new Provider()); // addProvider(Provider provider).. Adds a provider to the next position available.
    System.out.println("reached here a");
    certificateFile = new File(fileName);
    /*keystore = KeyStore.getInstance("pkcs12", "SunJSSE");*/
    keystore = KeyStore.getInstance("pkcs12", "IBMJCE");
    System.out.println("reached here b");
    BASE64Encoder base64encoder = new BASE64Encoder();
    System.out.println("reached here ba");
    keystore.load(new FileInputStream(certificateFile), filePassword);
    System.out.println("reached here bb");
    Enumeration enumeration = keystore.aliases();
    do {
    if(!enumeration.hasMoreElements())
    break;
    String s1 = enumeration.nextElement().toString();
    if(keystore.isKeyEntry(s1))
    alias = s1;
    } while(true);
    System.out.println("reached here c");
    pair = getPrivateKey(keystore, alias, keyPassword);
    priv = pair.getPrivate();
    String s2 = base64encoder.encode(priv.getEncoded());
    if(keystore.isKeyEntry(alias))
    certs = keystore.getCertificateChain(alias);
    if(certs[0] instanceof X509Certificate)
    x509 = (X509Certificate)certs[0];
    if(certs[certs.length - 1] instanceof X509Certificate)
    x509 = (X509Certificate)certs[certs.length - 1];
    } else
    if(keystore.isCertificateEntry(alias))
    Certificate certificate = keystore.getCertificate(alias);
    if(certificate instanceof X509Certificate)
    x509 = (X509Certificate)certificate;
    certs = (new Certificate[] {
    x509
    } else {
    throw new Exception(alias + " Wrong alias, Please Check");
    AlgorithmId aalgorithmid[] = {
    AlgorithmId.get("SHA256")
    byte abyte0[] = s.getBytes("UTF8");
    System.out.println("reached here d");
    MessageDigest messagedigest = MessageDigest.getInstance("SHA256");
    messagedigest.update(abyte0);
    byte abyte1[] = messagedigest.digest();
    PKCS9Attribute apkcs9attribute[] = {
    new PKCS9Attribute(PKCS9Attribute.CONTENT_TYPE_OID, ContentInfo.DATA_OID), new PKCS9Attribute(PKCS9Attribute.SIGNING_TIME_OID, new Date()), new PKCS9Attribute(PKCS9Attribute.MESSAGE_DIGEST_OID, abyte1)
    PKCS9Attributes pkcs9attributes = new PKCS9Attributes(apkcs9attribute);
    Signature signature = Signature.getInstance("SHA256withRSA", "SunJSSE");
    signature.initSign(priv);
    signature.update(pkcs9attributes.getDerEncoding());
    byte abyte2[] = signature.sign();
    ContentInfo contentinfo = null;
    contentinfo = new ContentInfo(ContentInfo.DATA_OID, null);
    X509Certificate ax509certificate[] = {
    x509
    java.math.BigInteger biginteger = x509.getSerialNumber();
    SignerInfo signerinfo = new SignerInfo(new X500Name(x509.getIssuerDN().getName()), biginteger, AlgorithmId.get("SHA256"), pkcs9attributes, new AlgorithmId(AlgorithmId.RSAEncryption_oid), abyte2, null);
    SignerInfo asignerinfo[] = {
    signerinfo
    PKCS7 pkcs7 = new PKCS7(aalgorithmid, contentinfo, ax509certificate, asignerinfo);
    DerOutputStream deroutputstream = new DerOutputStream();
    pkcs7.encodeSignedData(deroutputstream);
    byte abyte3[] = deroutputstream.toByteArray();
    String s3 = new String(abyte3);
    BASE64Encoder base64encoder1 = new BASE64Encoder();
    String s4 = base64encoder1.encodeBuffer(abyte3);
    BASE64Decoder base64decoder = new BASE64Decoder();
    System.out.println("reached here e");
    byte abyte4[] = base64decoder.decodeBuffer(s4);
    PKCS7 pkcs7_1 = new PKCS7(abyte4);
    SignerInfo asignerinfo1[] = null;
    if(pkcs7_1.getContentInfo().getContentBytes() == null)
    byte abyte5[] = s.getBytes("UTF8");
    asignerinfo1 = pkcs7_1.verify(abyte5);
    } else
    asignerinfo1 = pkcs7.verify();
    if(asignerinfo1 == null) {
    throw new Exception("Signature failed verification, data has been tampered");
    } else {
    Utilities.log(3, "asignerinfo1 is not null Verification OK>>" + new Date(System.currentTimeMillis()), "UMAC", "run");
    return s4;
    * gets the private key for opening the signing file
    * @param keystore1
    * @param s is file path
    * @param ac
    * @return keypair
    * @throws Exception
    public KeyPair getPrivateKey(KeyStore keystore1, String s, char ac[]) throws Exception
    PublicKey publickey;
    System.out.println("inside UMAC.getPrivateKey");
    key = keystore1.getKey(s, ac);
    System.out.println("key --->" +key);
    if(!(key instanceof PrivateKey))
    return null;
    Certificate certificate = keystore1.getCertificate(s);
    publickey = certificate.getPublicKey();
    System.out.println("Returning from UMAC.getPrivateKey : publickey is --->" +publickey);
    return new KeyPair(publickey, (PrivateKey)key);
    ===========================================
    Its compiling properly but at run-time it's showing below error
    OUTPUT:
    ===========================================
    reached here a
    reached here b
    reached here ba
    Exception in thread "Thread-4" java.lang.IllegalAccessError
    at sun.security.util.DerInputStream.init(Unknown Source)
    at sun.security.util.DerInputStream.<init>(Unknown Source)
    at sun.security.rsa.RSAPublicKeyImpl.parseKeyBits(Unknown Source)
    at sun.security.x509.X509Key.decode(X509Key.java:396)
    at sun.security.x509.X509Key.decode(X509Key.java:408)
    at sun.security.rsa.RSAPublicKeyImpl.<init>(Unknown Source)
    at sun.security.rsa.RSAKeyFactory.generatePublic(Unknown Source)
    at sun.security.rsa.RSAKeyFactory.engineGeneratePublic(Unknown Source)
    at java.security.KeyFactory.generatePublic(KeyFactory.java:145)
    at com.ibm.security.x509.X509Key.buildX509Key(X509Key.java:278)
    at com.ibm.security.x509.X509Key.parse(X509Key.java:189)
    at com.ibm.security.x509.X509Key.parse(X509Key.java:215)
    at com.ibm.security.x509.CertificateX509Key.<init>(CertificateX509Key.java:112)
    at com.ibm.security.x509.X509CertInfo.parse(X509CertInfo.java:966)
    at com.ibm.security.x509.X509CertInfo.<init>(X509CertInfo.java:236)
    at com.ibm.security.x509.X509CertInfo.<init>(X509CertInfo.java:222)
    at com.ibm.security.x509.X509CertImpl.parse(X509CertImpl.java:2285)
    at com.ibm.security.x509.X509CertImpl.<init>(X509CertImpl.java:227)
    at com.ibm.security.x509.X509CertImpl.<init>(X509CertImpl.java:213)
    at com.ibm.security.pkcs12.CertBag.decode(CertBag.java:599)
    at com.ibm.security.pkcsutil.PKCSDerObject.decode(PKCSDerObject.java:251)
    at com.ibm.security.pkcs12.CertBag.<init>(CertBag.java:76)
    at com.ibm.security.pkcs12.BasicPFX.getCertificates(BasicPFX.java:1422)
    at com.ibm.security.pkcs12.PFX.getCertificates(PFX.java:549)
    at com.ibm.crypto.provider.PKCS12KeyStore.engineLoad(Unknown Source)
    at java.security.KeyStore.load(KeyStore.java:414)
    at sfmsbr.bankapi.UMAC.getSingedData(UMAC.java:137)
    at sfmsbr.bankapi.SignedDataImpl.getSingedData(SignedDataImpl.java:42)
    at com.cs.sfms.SFMSMessageSender.run(SFMSMessageSender.java:226)
    at java.lang.Thread.run(Thread.java:736)
    18:10:05 10-Feb-2012 AFTER JAVA Execution
    Please share your valuable inputs to resolve this
    Regards,
    Haris

    java version
    java version "1.6.0"
    Java(TM) 2 Runtime Environment, Standard Edition (build pap32devifx-20110211b (SR12 FP3 +IZ94331))
    IBM J9 VM (build 2.3, J2RE 1.6.0 IBM J9 2.3 AIX ppc-32 j9vmap3223ifx-20101130 (JIT enabled)
    J9VM - 20101129_69669_bHdSMr
    JIT - 20100623_16197ifx1_r8
    GC - 20100211_AA)
    JCL - 20110208
    Regards
    Haris
    Edited by: user12848704 on Feb 10, 2012 3:27 AM

  • Problem signing PDF from smart card - BouncyCastle, IAIK Wrapper, iText

    Hello!
    I need to sign and timestamp a PDF document with a smartcard. I'm using Java 1.6, iText to manage PDF, BouncyCastle to deal with cryptography and the free IAIK WRAPPER to access the smartcard.
    I've already searched the Internet to solve my problem, read the PDF specifications about the signature and followed snippets that should've worked, but after a couple of weeks I still don't have working code, not even for the signature. All the tries I made yield messages like "Signature has been corrupted" or "Invalid signature" (I can't remember the exact messages, but they're not in English anyway :D ) when I verify the signature in Adobe Reader.
    My first goal was to use an encapsulated signature, using filter Adobe.PPKLITE, subfilter adbe.pkcs7.sha1 and a DER-Encoded PKCS#7 object as content.
    Among the tries I made, I used code such as (I don't include all modifications, just the ones I deem closer to the right approach):
         // COMMON - START
         ///// selectedKey is a iaik.pkcs.pkcs11.objects.Key instance of the private key I'm taking from the SC
         RSAPrivateKey signerPrivKey=(RSAPrivateKey)selectedKey;
         CertificateFactory certificateFactory=CertificateFactory.getInstance("X.509");
         ///// correspondingCertificate is a iaik.pkcs.pkcs11.objects.X509PublicKeyCertificate instance of the certificate I'm taking from the SC
         byte[] derEncodedCertificate=correspondingCertificate.getValue().getByteArrayValue();
         X509Certificate signerCert=(X509Certificate)certificateFactory.generateCertificate(new ByteArrayInputStream(derEncodedCertificate));
         Provider provider=new BouncyCastleProvider();
         Security.addProvider(provider);
         ///// session is an instance of iaik.pkcs.pkcs11.Session
         session.signInit(Mechanism.SHA1_RSA_PKCS, signerPrivKey);
         File theFile = new File("C:\\toSign.pdf");
         FileInputStream fis = new FileInputStream(theFile);
         byte[] contentData = new byte[(int) theFile.length()];
         fis.read(contentData);
         fis.close();          
         PdfReader reader = new PdfReader(contentData);
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         PdfStamper stp = PdfStamper.createSignature(reader, baos, '\0');
         PdfSignatureAppearance sap = stp.getSignatureAppearance();
         // COMMON - END
         java.security.cert.X509Certificate[] certs=new java.security.cert.X509Certificate[1];
         CertificateFactory factory=CertificateFactory.getInstance("X.509");          
         certs[0]=(X509Certificate)factory.generateCertificate(new ByteArrayInputStream(correspondingCertificate.getValue().getByteArrayValue()));
         sap.setSignDate(new GregorianCalendar());
         sap.setCrypto(null, certs, null, null);
         sap.setReason("This is the reason");
         sap.setLocation("This is the Location");
         sap.setContact("This is the Contact");
         sap.setAcro6Layers(true);
         PdfSignature dic = new PdfSignature(PdfName.ADOBE_PPKLITE, PdfName.ADBE_PKCS7_SHA1);
         dic.setDate(new PdfDate(sap.getSignDate()));
         dic.setName(PdfPKCS7.getSubjectFields((X509Certificate)certs[0]).getField("CN"));
         sap.setCryptoDictionary(dic);
         int csize = 4000;
         HashMap exc = new HashMap();
         exc.put(PdfName.CONTENTS, new Integer(csize * 2 + 2));
         sap.preClose(exc);
         MessageDigest md = MessageDigest.getInstance("SHA1");
         InputStream s = sap.getRangeStream();
         int read = 0;
         byte[] buff = new byte[8192];
         while ((read = s.read(buff, 0, 8192)) > 0)
              md.update(buff, 0, read);
         byte[] signature=session.sign(buff);
         CMSSignedDataGenerator generator = new CMSSignedDataGenerator();
         ArrayList list = new ArrayList();
         for (int i = 0; i < certs.length; i++)
              list.add(certs);
         CertStore chainStore = CertStore.getInstance("Collection", new CollectionCertStoreParameters(list), provider);
         generator.addCertificatesAndCRLs(chainStore);
         CMSProcessable content = new CMSProcessableByteArray(md.digest());
         CMSSignedData signedData = generator.generate(CMSSignedDataGenerator.ENCRYPTION_RSA, content, true, provider);
         byte[] pk = signedData.getEncoded();
         byte[] outc = new byte[csize];
         PdfDictionary dic2 = new PdfDictionary();
         System.arraycopy(pk, 0, outc, 0, pk.length);
         dic2.put(PdfName.CONTENTS, new PdfString(outc).setHexWriting(true));
         sap.close(dic2);
         File newOne = new File("C:\\signed.pdf");
         FileOutputStream fos = new FileOutputStream(newOne);
         fos.write(baos.toByteArray());
         fos.close();
    I figured this is the right approach, but I need a way to generate the CMSSignedData instance, which can't be done using addSigner (the only documented way I found), since the private key is not extractable from a smart card...
    Then I decided to give up and try with a detached signature:
         // COMMON - START
         // Same as above
         // COMMON - END
         sap.setSignDate(new GregorianCalendar());
         java.security.cert.X509Certificate[] certs=new java.security.cert.X509Certificate[1];
         CertificateFactory factory=CertificateFactory.getInstance("X.509");          
         certs[0]=(X509Certificate)factory.generateCertificate(new ByteArrayInputStream(correspondingCertificate.getValue().getByteArrayValue()));
         sap.setCrypto(null, certs, null, PdfSignatureAppearance.SELF_SIGNED);
         sap.setSignDate(java.util.Calendar.getInstance());
         sap.setExternalDigest (new byte[8192], new byte[20], "RSA");
         sap.preClose();
         MessageDigest messageDigest = MessageDigest.getInstance ("SHA1");
         byte buff[] = new byte[8192];
         int n;
         InputStream inp = sap.getRangeStream ();
         while ((n = inp.read (buff)) > 0)
              messageDigest.update (buff, 0, n);
         byte hash[] = messageDigest.digest();
         byte[] signature=session.sign(hash);
         PdfSigGenericPKCS sg = sap.getSigStandard ();
         PdfLiteral slit = (PdfLiteral)sg.get (PdfName.CONTENTS);
         byte[] outc = new byte[(slit.getPosLength () - 2) / 2];
         PdfPKCS7 sig = sg.getSigner ();
         sig.setExternalDigest (session.sign(hash), hash, "RSA");
         PdfDictionary dic = new PdfDictionary ();
         byte[] ssig = sig.getEncodedPKCS7();
         System.arraycopy (ssig, 0, outc, 0, ssig.length);
         dic.put (PdfName.CONTENTS, new PdfString (outc).setHexWriting(true));
         sap.close (dic);
         File newOne = new File("C:\\signed.pdf");
         FileOutputStream fos = new FileOutputStream(newOne);
         fos.write(baos.toByteArray());
         fos.close();
    I'm still stuck to the signature process, can anyone please tell me what I'm doing wrong and help me (snippets would be deeply appreciated), maybe even changing approach in order to be able to add a digital timestamp?
    Thank you very much in advance!
    PS: I had also tried to use the SunPKCS11 provider to access the smart card, I gave up for similar problems, but if someone has suggestions using it, they're welcome! :D

    Hello!
    I need to sign and timestamp a PDF document with a smartcard. I'm using Java 1.6, iText to manage PDF, BouncyCastle to deal with cryptography and the free IAIK WRAPPER to access the smartcard.
    I've already searched the Internet to solve my problem, read the PDF specifications about the signature and followed snippets that should've worked, but after a couple of weeks I still don't have working code, not even for the signature. All the tries I made yield messages like "Signature has been corrupted" or "Invalid signature" (I can't remember the exact messages, but they're not in English anyway :D ) when I verify the signature in Adobe Reader.
    My first goal was to use an encapsulated signature, using filter Adobe.PPKLITE, subfilter adbe.pkcs7.sha1 and a DER-Encoded PKCS#7 object as content.
    Among the tries I made, I used code such as (I don't include all modifications, just the ones I deem closer to the right approach):
         // COMMON - START
         ///// selectedKey is a iaik.pkcs.pkcs11.objects.Key instance of the private key I'm taking from the SC
         RSAPrivateKey signerPrivKey=(RSAPrivateKey)selectedKey;
         CertificateFactory certificateFactory=CertificateFactory.getInstance("X.509");
         ///// correspondingCertificate is a iaik.pkcs.pkcs11.objects.X509PublicKeyCertificate instance of the certificate I'm taking from the SC
         byte[] derEncodedCertificate=correspondingCertificate.getValue().getByteArrayValue();
         X509Certificate signerCert=(X509Certificate)certificateFactory.generateCertificate(new ByteArrayInputStream(derEncodedCertificate));
         Provider provider=new BouncyCastleProvider();
         Security.addProvider(provider);
         ///// session is an instance of iaik.pkcs.pkcs11.Session
         session.signInit(Mechanism.SHA1_RSA_PKCS, signerPrivKey);
         File theFile = new File("C:\\toSign.pdf");
         FileInputStream fis = new FileInputStream(theFile);
         byte[] contentData = new byte[(int) theFile.length()];
         fis.read(contentData);
         fis.close();          
         PdfReader reader = new PdfReader(contentData);
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         PdfStamper stp = PdfStamper.createSignature(reader, baos, '\0');
         PdfSignatureAppearance sap = stp.getSignatureAppearance();
         // COMMON - END
         java.security.cert.X509Certificate[] certs=new java.security.cert.X509Certificate[1];
         CertificateFactory factory=CertificateFactory.getInstance("X.509");          
         certs[0]=(X509Certificate)factory.generateCertificate(new ByteArrayInputStream(correspondingCertificate.getValue().getByteArrayValue()));
         sap.setSignDate(new GregorianCalendar());
         sap.setCrypto(null, certs, null, null);
         sap.setReason("This is the reason");
         sap.setLocation("This is the Location");
         sap.setContact("This is the Contact");
         sap.setAcro6Layers(true);
         PdfSignature dic = new PdfSignature(PdfName.ADOBE_PPKLITE, PdfName.ADBE_PKCS7_SHA1);
         dic.setDate(new PdfDate(sap.getSignDate()));
         dic.setName(PdfPKCS7.getSubjectFields((X509Certificate)certs[0]).getField("CN"));
         sap.setCryptoDictionary(dic);
         int csize = 4000;
         HashMap exc = new HashMap();
         exc.put(PdfName.CONTENTS, new Integer(csize * 2 + 2));
         sap.preClose(exc);
         MessageDigest md = MessageDigest.getInstance("SHA1");
         InputStream s = sap.getRangeStream();
         int read = 0;
         byte[] buff = new byte[8192];
         while ((read = s.read(buff, 0, 8192)) > 0)
              md.update(buff, 0, read);
         byte[] signature=session.sign(buff);
         CMSSignedDataGenerator generator = new CMSSignedDataGenerator();
         ArrayList list = new ArrayList();
         for (int i = 0; i < certs.length; i++)
              list.add(certs);
         CertStore chainStore = CertStore.getInstance("Collection", new CollectionCertStoreParameters(list), provider);
         generator.addCertificatesAndCRLs(chainStore);
         CMSProcessable content = new CMSProcessableByteArray(md.digest());
         CMSSignedData signedData = generator.generate(CMSSignedDataGenerator.ENCRYPTION_RSA, content, true, provider);
         byte[] pk = signedData.getEncoded();
         byte[] outc = new byte[csize];
         PdfDictionary dic2 = new PdfDictionary();
         System.arraycopy(pk, 0, outc, 0, pk.length);
         dic2.put(PdfName.CONTENTS, new PdfString(outc).setHexWriting(true));
         sap.close(dic2);
         File newOne = new File("C:\\signed.pdf");
         FileOutputStream fos = new FileOutputStream(newOne);
         fos.write(baos.toByteArray());
         fos.close();
    I figured this is the right approach, but I need a way to generate the CMSSignedData instance, which can't be done using addSigner (the only documented way I found), since the private key is not extractable from a smart card...
    Then I decided to give up and try with a detached signature:
         // COMMON - START
         // Same as above
         // COMMON - END
         sap.setSignDate(new GregorianCalendar());
         java.security.cert.X509Certificate[] certs=new java.security.cert.X509Certificate[1];
         CertificateFactory factory=CertificateFactory.getInstance("X.509");          
         certs[0]=(X509Certificate)factory.generateCertificate(new ByteArrayInputStream(correspondingCertificate.getValue().getByteArrayValue()));
         sap.setCrypto(null, certs, null, PdfSignatureAppearance.SELF_SIGNED);
         sap.setSignDate(java.util.Calendar.getInstance());
         sap.setExternalDigest (new byte[8192], new byte[20], "RSA");
         sap.preClose();
         MessageDigest messageDigest = MessageDigest.getInstance ("SHA1");
         byte buff[] = new byte[8192];
         int n;
         InputStream inp = sap.getRangeStream ();
         while ((n = inp.read (buff)) > 0)
              messageDigest.update (buff, 0, n);
         byte hash[] = messageDigest.digest();
         byte[] signature=session.sign(hash);
         PdfSigGenericPKCS sg = sap.getSigStandard ();
         PdfLiteral slit = (PdfLiteral)sg.get (PdfName.CONTENTS);
         byte[] outc = new byte[(slit.getPosLength () - 2) / 2];
         PdfPKCS7 sig = sg.getSigner ();
         sig.setExternalDigest (session.sign(hash), hash, "RSA");
         PdfDictionary dic = new PdfDictionary ();
         byte[] ssig = sig.getEncodedPKCS7();
         System.arraycopy (ssig, 0, outc, 0, ssig.length);
         dic.put (PdfName.CONTENTS, new PdfString (outc).setHexWriting(true));
         sap.close (dic);
         File newOne = new File("C:\\signed.pdf");
         FileOutputStream fos = new FileOutputStream(newOne);
         fos.write(baos.toByteArray());
         fos.close();
    I'm still stuck to the signature process, can anyone please tell me what I'm doing wrong and help me (snippets would be deeply appreciated), maybe even changing approach in order to be able to add a digital timestamp?
    Thank you very much in advance!
    PS: I had also tried to use the SunPKCS11 provider to access the smart card, I gave up for similar problems, but if someone has suggestions using it, they're welcome! :D

  • Calculating hash values for really big files

    I am using the following code to calculate the hash values of files
    public static String hash(File f, String algorithm)
                throws IOException, NoSuchAlgorithmException {
            if (!f.isFile()) {
                throw new IOException("Not a file");
            RandomAccessFile raf = new RandomAccessFile(f, "r");
            byte b[] = new byte[(int) raf.length()];
            raf.readFully(b);
            raf.close();
            MessageDigest messageDigest = MessageDigest.getInstance(algorithm);
            messageDigest.update(b);
            return toHexString(messageDigest.digest());
        }Now the problem is, for really big files, 100 MB or over, I get an OutOfMemoryError.
    I have used the -Xms and -Xms options to increase the JVM heap size, and untimately made it to work. However, I think this is lame and there is also a limit to the -Xmx option.
    Is there any other way I can calculate the hash values of these really big files?
    Thanks a lot in advance.

    why do u open the file the way u do ?
    why to u upload ALL the file AT ONCE into the memory ?
    i would do it like this:
    FileInputStream fis = new FileInputStream (f);
    int fileSize = f.available();
    byte buffer[] = new byte[1000];
    MessageDigest messageDigest = MessageDigest.getInstance(algorithm);
    for(int read = 0;read < fileSize;read +=1000;)
    if(fis.available() > 1000)
    fis.read(buffer, read, 1000);
    else if(fis.available() > 0)
    fis.read(buffer, read, fis.available());
    else
    break;
    messageDigest.update(b);
    fis.close();
    return toHexString(messageDigest.digest());

  • Bug in 'sun.security.provider.MD5'

    I have created a non-blocking server and a blocking client using NIO and SSLEngine.
    I have put the two in an endless read/write loop, i.e
    - the client writes to the server
    - the server reads
    - the server writes to the client
    - the client reads
    and so on...
    Everything works fine for a while, the "while" being almost constant, the I get the following exception:
    Exception in thread "Thread-0" java.lang.StackOverflowError
            at sun.security.provider.MD5.implCompress(MD5.java:129)
            at sun.security.provider.MD5.implDigest(MD5.java:92)
            at sun.security.provider.DigestBase.engineDigest(DigestBase.java:169)
            at sun.security.provider.DigestBase.engineDigest(DigestBase.java:148)
            at java.security.MessageDigest$Delegate.engineDigest(MessageDigest.java:545)
            at java.security.MessageDigest.digest(MessageDigest.java:323)
            at com.sun.crypto.provider.HmacCore.b(DashoA13*..)
            at com.sun.crypto.provider.HmacMD5.engineDoFinal(DashoA13*..)
            at javax.crypto.Mac.doFinal(DashoA13*..)
            at com.sun.net.ssl.internal.ssl.MAC.compute(MAC.java:172)
            at com.sun.net.ssl.internal.ssl.MAC.compute(MAC.java:136)
            at com.sun.net.ssl.internal.ssl.EngineInputRecord.checkMAC(EngineInputRecord.java:193)
            at com.sun.net.ssl.internal.ssl.SSLEngineImpl.readRecord(SSLEngineImpl.java:881)
            at com.sun.net.ssl.internal.ssl.SSLEngineImpl.readNetRecord(SSLEngineImpl.java:791)
            at com.sun.net.ssl.internal.ssl.SSLEngineImpl.unwrap(SSLEngineImpl.java:667)
            at javax.net.ssl.SSLEngine.unwrap(SSLEngine.java:607)
            at pt.jmdsc.coms.SSLChannel.read(SSLChannel.java:126)This seems to be a bug in the MD5 class of the provider, has anyone come across the same issue?

    Yip I did shorten the post, the last 4 lines below keep repeating
    Exception in thread "Thread-0" java.lang.StackOverflowError
            at sun.security.provider.MD5.implCompress(MD5.java:129)
            at sun.security.provider.DigestBase.engineUpdate(DigestBase.java:116)
            at java.security.MessageDigestSpi.engineUpdate(MessageDigestSpi.java:97)
            at java.security.MessageDigest$Delegate.engineUpdate(MessageDigest.java:541)
            at java.security.MessageDigest.update(MessageDigest.java:311)
            at com.sun.crypto.provider.HmacCore.a(DashoA13*..)
            at com.sun.crypto.provider.HmacMD5.engineUpdate(DashoA13*..)
            at javax.crypto.Mac.update(DashoA13*..)
            at com.sun.net.ssl.internal.ssl.MAC.compute(MAC.java:167)
            at com.sun.net.ssl.internal.ssl.MAC.compute(MAC.java:136)
            at com.sun.net.ssl.internal.ssl.EngineInputRecord.checkMAC(EngineInputRecord.java:193)
            at com.sun.net.ssl.internal.ssl.SSLEngineImpl.readRecord(SSLEngineImpl.java:881)
            at com.sun.net.ssl.internal.ssl.SSLEngineImpl.readNetRecord(SSLEngineImpl.java:791)
            at com.sun.net.ssl.internal.ssl.SSLEngineImpl.unwrap(SSLEngineImpl.java:667)
            at javax.net.ssl.SSLEngine.unwrap(SSLEngine.java:607)
            at pt.jmdsc.coms.SSLChannel.read(SSLChannel.java:126)
            at pt.jmdsc.coms.Client.read(Client.java:92)
            at pt.jmdsc.coms.Client.write(Client.java:85)
            at pt.jmdsc.coms.Client.read(Client.java:92)
            at pt.jmdsc.coms.Client.write(Client.java:85)
            ....

  • Plugin and https - problems

    Hy,
    i tried to load an applet via https from server.
    without https applet starts working correctly.
    with https following printout in plugin 1.4.1 - console is done and I
    dont know were to search the problem for.
    it seems not to be my code - because there is no package of my used
    packages written out.
    I hope that anyone can help me. problem is not iexplorer-specific
    netscape is same behaviour.
    Java(TM) Plug-in: Version 1.4.0_01
    Verwendung der JRE-Version 1.4.0_01 Java HotSpot(TM) Client VM
    java.lang.ExceptionInInitializerError
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at java.net.URL.getURLStreamHandler(Unknown Source)
    at java.net.URL.<init>(Unknown Source)
    at java.net.URL.<init>(Unknown Source)
    at java.net.URL.<init>(Unknown Source)
    at sun.plugin.AppletViewer.getDocumentBase(Unknown Source)
    at sun.plugin.AppletViewer.getCodeBase(Unknown Source)
    at sun.plugin.AppletViewer.appletInit(Unknown Source)
    at sun.plugin.viewer.LifeCycleManager.initAppletPanel(Unknown Source)
    at sun.plugin.viewer.IExplorerPluginObject$Initer.run(Unknown Source)
    Caused by: java.lang.NullPointerException
    at java.security.MessageDigest.update(Unknown Source)
    at sun.plugin.security.WSecureRandom.<init>(Unknown Source)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
    Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown
    Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown
    Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at java.lang.Class.newInstance0(Unknown Source)
    at java.lang.Class.newInstance(Unknown Source)
    at java.security.Security.doGetImpl(Unknown Source)
    at java.security.Security.doGetImpl(Unknown Source)
    at java.security.Security.getImpl(Unknown Source)
    at java.security.SecureRandom.getInstance(Unknown Source)
    at java.security.SecureRandom.<init>(Unknown Source)
    at sun.plugin.services.WIExplorerBrowserService.getSecureRandom(Unknown
    Source)
    at sun.plugin.net.protocol.https.Handler$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.plugin.net.protocol.https.Handler.<clinit>(Unknown Source)
    ... 11 more
    java.lang.NoClassDefFoundError
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at java.net.URL.getURLStreamHandler(Unknown Source)
    at java.net.URL.<init>(Unknown Source)
    at java.net.URL.<init>(Unknown Source)
    at sun.plugin.AppletViewer.getCodeBase(Unknown Source)
    at sun.plugin.AppletViewer.appletInit(Unknown Source)
    at sun.plugin.viewer.LifeCycleManager.initAppletPanel(Unknown Source)
    at sun.plugin.viewer.IExplorerPluginObject$Initer.run(Unknown Source)

    Getting the exact same error when trying to instantiate an applet over https with IE6, using 1.4.1_03, anyone got round this???
    load: class xms.EntryApplet.class not found.
    java.lang.ClassNotFoundException: xms.EntryApplet.class
         at sun.applet.AppletClassLoader.findClass(Unknown Source)
         at sun.plugin.security.PluginClassLoader.findClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.applet.AppletClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.applet.AppletClassLoader.loadCode(Unknown Source)
         at sun.applet.AppletPanel.createApplet(Unknown Source)
         at sun.plugin.AppletViewer.createApplet(Unknown Source)
         at sun.applet.AppletPanel.runLoader(Unknown Source)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Caused by: java.io.IOException: open HTTP connection failed.
         at sun.applet.AppletClassLoader.getBytes(Unknown Source)
         at sun.applet.AppletClassLoader.access$100(Unknown Source)
         at sun.applet.AppletClassLoader$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         ... 11 more

  • Java MD5 for Linux

    Hi @all
    I'm trying to write a method in Java, that receives a String and should return the MD5 hash of this String.
    This hash should be usable to change the password of a user in linux with usermod -p "hash" user.
    Here is my method:
    <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<BEGIN>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    public String createMD5HashCode(String text) throws NoSuchAlgorithmException, NoSuchProviderException {
    String result = text;
    if (text != null) {
    StringBuffer code = new StringBuffer(); //the hash code
    String plain = text;
    byte bytes[] = plain.getBytes();
    MessageDigest messageDigest = MessageDigest.getInstance("MD5", "SUN");
    messageDigest.update(bytes);
    byte digest[] = messageDigest.digest(bytes); //create code
    System.out.println(digest.length);
    for (int i = 0; i < digest.length; ++i) {
    code.append(Integer.toHexString(0x0100 + (digest & 0x00FF)).substring(1));
    result = code.toString();
    return result;
    <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<END>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    And if i try to change the password with "usermod -p 'returned hash' user", it works, but i can't login anymore :-(
    Are there any proposals?
    Thanks for your help in advance.
    Regards
    daenu

    public String createMD5HashCode(String text) throws
    NoSuchAlgorithmException, NoSuchProviderException {
    String result = text;
    if (text != null) {
    StringBuffer code = new StringBuffer(); //the hash
    code
    String plain = text;
    byte bytes[] = plain.getBytes();You should realy specify the encoding here eg plain.getBytes("ASCII")
    MessageDigest messageDigest =
    MessageDigest.getInstance("MD5", "SUN");
    messageDigest.update(bytes);This will add 'bytes' to the digest.
    >
    byte digest[] = messageDigest.digest(bytes); //createand this will add them again! You don't need the update.
    code
    System.out.println(digest.length);
    for (int i = 0; i < digest.length; ++i) {
    code.append(Integer.toHexString(0x0100 + (digest &
    0x00FF)).substring(1));Very interesting! It took me some time to work out what this was doing!
    result = code.toString();
    return result;

  • Installing the OpenSSO STS Server On Tomcat but have error

    hello everyone ,
    I try to install the OpenSSO STS Server On Tomcat , but not successful.
    softwares:
    tomcat 6.0.32
    jdk1.6.0_18
    openssosts.war
    i Deploy the OpenSSO STS WAR File on Tomcat is ok and it works
    but at the Welcome page configure the configuration time , error is like that:
    設定ディレクトリ C:/temp/openssosts をチェックしています。...成功しました。
    OpenSSO 設定ストアのインストール...成功しました RSA/ECB/OAEPWithSHA1AndMGF1Padding。
    C:/temp/openssosts/opends での OpenSSO 設定ストアのインストールAMSetupServlet.processRequest: errorjava.lang.NullPointerException
         at java.security.MessageDigest.update(MessageDigest.java:293)
         at java.security.MessageDigest.digest(MessageDigest.java:368)
         at org.opends.server.crypto.CryptoManagerImpl.getInstanceKeyID(CryptoManagerImpl.java:628)
         at org.opends.server.crypto.CryptoManagerImpl.publishInstanceKeyEntryInADS(CryptoManagerImpl.java:644)
         at org.opends.server.crypto.CryptoManagerSync.<init>(CryptoManagerSync.java:126)
         at org.opends.server.core.DirectoryServer.startServer(DirectoryServer.java:1446)
         at org.opends.server.util.EmbeddedUtils.startServer(EmbeddedUtils.java:89)
         at com.sun.identity.setup.EmbeddedOpenDS.startServer(EmbeddedOpenDS.java:266)
         at com.sun.identity.setup.EmbeddedOpenDS.setup(EmbeddedOpenDS.java:200)
         at com.sun.identity.setup.AMSetupServlet.setupEmbeddedDS(AMSetupServlet.java:537)
         at com.sun.identity.setup.AMSetupServlet.setupSMDatastore(AMSetupServlet.java:573)
         at com.sun.identity.setup.AMSetupServlet.configure(AMSetupServlet.java:649)
         at com.sun.identity.setup.AMSetupServlet.processRequest(AMSetupServlet.java:379)
         at com.sun.identity.setup.AMSetupServlet.doPost(AMSetupServlet.java:323)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
         at com.sun.identity.setup.AMSetupFilter.doFilter(AMSetupFilter.java:120)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
         at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:864)
         at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)
         at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1665)
         at java.lang.Thread.run(Thread.java:619)
    help , thanks.

    thanks.
    my OpenSSO STS's version is Oracle OpenSSO STS 11.1.1.3.0. Is that Ok?
    PC's locale language is japanese. Now try to change to English to see.
    The same error happned ,and log is like this:
    Checking configuration directory C:/temp/openssosts....Success.
    Installing OpenSSO configuration store...Success RSA/ECB/OAEPWithSHA1AndMGF1Padding.
    Installing OpenSSO configuration store in C:/temp/openssosts/opendsAMSetupServlet.processRequest: errorjava.lang.NullPointerException
         at java.security.MessageDigest.update(MessageDigest.java:293)
         at java.security.MessageDigest.digest(MessageDigest.java:368)
         at org.opends.server.crypto.CryptoManagerImpl.getInstanceKeyID(CryptoManagerImpl.java:628)
         at org.opends.server.crypto.CryptoManagerImpl.publishInstanceKeyEntryInADS(CryptoManagerImpl.java:644)
         at org.opends.server.crypto.CryptoManagerSync.<init>(CryptoManagerSync.java:126)
         at org.opends.server.core.DirectoryServer.startServer(DirectoryServer.java:1446)
         at org.opends.server.util.EmbeddedUtils.startServer(EmbeddedUtils.java:89)
         at com.sun.identity.setup.EmbeddedOpenDS.startServer(EmbeddedOpenDS.java:266)
         at com.sun.identity.setup.EmbeddedOpenDS.setup(EmbeddedOpenDS.java:200)
         at com.sun.identity.setup.AMSetupServlet.setupEmbeddedDS(AMSetupServlet.java:537)
         at com.sun.identity.setup.AMSetupServlet.setupSMDatastore(AMSetupServlet.java:573)
         at com.sun.identity.setup.AMSetupServlet.configure(AMSetupServlet.java:649)
         at com.sun.identity.setup.AMSetupServlet.processRequest(AMSetupServlet.java:379)
         at com.sun.identity.setup.AMSetupServlet.doPost(AMSetupServlet.java:323)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
         at com.sun.identity.setup.AMSetupFilter.doFilter(AMSetupFilter.java:120)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
         at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:864)
         at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)
         at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1665)
         at java.lang.Thread.run(Thread.java:619)
    Edited by: user13705486 on 2011/02/08 17:36

  • ADF Mobile: Deployment Error: MessageDigest SHA-1 implementation not found

    Hi,
    I was trying to create and deploy a test application as outlined in the online tutorial for ADF Mobile:Android
    http://docs.oracle.com/cd/E18941_01/tutorials/MobileTutorial/jdtut_11r2_54_2.html
    After I hit Deploy to emulator, it fails with the following exception:
    trouble writing output:
    [07:01:26 AM] java.lang.RuntimeException: java.security.NoSuchAlgorithmException: MessageDigest SHA-1 implementation not found.
    I have successfully deployed applications developed from Eclipse with Android extension on the same emulator.
    I tried manual cmd line deployment of the generated apk file
    I got [INSTALL_PARSE_FAILED_NO_CERTIFICATES] error first.
    I then followed the instructions in the below post to create a keystore, sign the application and again deploy the application
    signing error with abt deployment with ADF Mobile and java 1.7
    I got the following error.
    C:\Program Files\Android\android-sdk\platform-tools>adb -e install -r C:\Jwork\TestApp\deploy\ANDROID_MOBILE_NATIVE_archive3/testapp.apk
    100 KB/s (21928920 bytes in 212.281s)
    pkg: /data/local/tmp/testapp.apk
    Failure [INSTALL_FAILED_DEXOPT]
    Is it a BUG or am I missing something? Appreciate if someone can help me out.
    Specs. Win XP
    Android 4.1.2 (API 16)
    Jdev
    Studio Edition Version 11.1.2.3.0
    Build JDEVADF_11.1.2.3.0_GENERIC_120914.0223.6276.1
    ADF Mobile Framework     oracle.adf.mobile     11.1.2.3.39.62.94     Fully Loaded
    Deployment Log:
    [06:58:00 AM] Updating Android profile dependencies with FAR profiles created from application projects...
    [06:58:01 AM] ---- Deployment started. ----
    [06:58:01 AM] Target platform is (Android).
    [06:58:01 AM] Beginning deployment of ADF Mobile application "TestApp" to Android using profile "ANDROID_MOBILE_NATIVE_archive3".
    [06:58:03 AM] Checking state of Android Debug Bridge server...
    [06:58:04 AM] Android Debug Bridge server already running.
    [06:58:11 AM] Verifying a single Android emulator is online and connected to the ADB server...
    [06:58:11 AM] Beginning deployment of ADF Mobile application "TestApp" to Android using profile "ANDROID_MOBILE_NATIVE_archive3".
    [06:58:11 AM] Running dependency analysis...
    [06:58:11 AM] Building...
    [06:58:11 AM] Deploying 3 profiles...
    [06:58:18 AM] Wrote Archive Module to C:\Jwork\TestApp\ApplicationController\deploy\ApplicationController.jar
    [06:58:18 AM] WARNING: No Resource Catalog enabled ADF components found to package
    [06:58:18 AM] Wrote Archive Module to C:\Jwork\TestApp\ViewController\deploy\ViewController.jar
    [06:58:18 AM] Starting to prepare the packaging...
    [06:58:18 AM] Verifying Application Controller project exists...
    [06:58:18 AM] Verifying application dependencies...
    [06:58:18 AM] Validating application XML files...
    [06:58:18 AM] Validating XML files in project ApplicationController...
    [06:58:18 AM] Validating XML files in project ViewController...
    [06:58:19 AM] Copying FARs to the ADF Mobile Framework application...
    [06:58:19 AM] Copying FAR from source: ViewController...
    [06:58:19 AM] Copying FAR from source: ApplicationController...
    [06:58:19 AM] Copying Android template...
    [06:59:19 AM] Copying framework resource files...
    [06:59:20 AM] Copying framework java resource files...
    [06:59:43 AM] Copying common javascript files...
    [07:00:01 AM] Deploying skinning files...
    [07:00:01 AM] Copying application image files...
    [07:00:02 AM] Copying ADF Mobile configuration files...
    [07:00:02 AM] Copying .adf files...
    [07:00:02 AM] Copying security related files to the ADF Mobile Framework application...
    [07:00:02 AM] Creating Android preferences XML files...
    [07:00:02 AM] Creating AndroidManifest.xml file...
    [07:00:02 AM] Creating unsigned Android application file...
    [07:00:58 AM] Compiling Android Resource Identifier file...
    [07:01:01 AM] Creating Android classes.dex file from class files...
    [07:01:26 AM] Command-line executed: ["C:\Program Files\Android\android-sdk\platform-tools\dx.bat", dex, debug, keep-classes, output="C:\Jwork\TestApp\deploy\ANDROID_MOBILE_NATIVE_archive3\classes.dex", C:\Jwork\TestApp\deploy\ANDROID_MOBILE_NATIVE_archive3\classes, C:\Jwork\TestApp\deploy\ANDROID_MOBILE_NATIVE_archive3\framework\build\jar\AND_ksoap.jar, C:\Jwork\TestApp\deploy\ANDROID_MOBILE_NATIVE_archive3\framework\build\jar\Container.jar, C:\Jwork\TestApp\deploy\ANDROID_MOBILE_NATIVE_archive3\framework\build\jar\IDMMobileSDK.jar, C:\Jwork\TestApp\deploy\ANDROID_MOBILE_NATIVE_archive3\framework\build\jar\logging_dalvik_release.jar, C:\Jwork\TestApp\deploy\ANDROID_MOBILE_NATIVE_archive3\framework\build\jar\phonegap.jar, C:\Jwork\TestApp\deploy\ANDROID_MOBILE_NATIVE_archive3\framework\build\jar\vmchannel_dalvik_release.jar]
    [07:01:26 AM]
    [07:01:26 AM] trouble writing output:
    [07:01:26 AM] java.lang.RuntimeException: java.security.NoSuchAlgorithmException: MessageDigest SHA-1 implementation not found
    [07:01:26 AM] at com.android.dx.dex.file.DexFile.calcSignature(DexFile.java:631)
    [07:01:26 AM] at com.android.dx.dex.file.DexFile.toDex0(DexFile.java:591)
    [07:01:26 AM] at com.android.dx.dex.file.DexFile.toDex(DexFile.java:216)
    [07:01:26 AM] at com.android.dx.command.dexer.Main.writeDex(Main.java:574)
    [07:01:26 AM] at com.android.dx.command.dexer.Main.run(Main.java:218)
    [07:01:26 AM] at com.android.dx.command.dexer.Main.main(Main.java:174)
    [07:01:26 AM] at com.android.dx.command.Main.main(Main.java:91)
    [07:01:26 AM] Caused by: java.security.NoSuchAlgorithmException: MessageDigest SHA-1 implementation not found
    [07:01:26 AM] at org.apache.harmony.security.fortress.Engine.getInstance(Engine.java:137)
    [07:01:26 AM] at java.security.MessageDigest.getInstance(MessageDigest.java:75)
    [07:01:26 AM] at com.android.dx.dex.file.DexFile.calcSignature(DexFile.java:629)
    [07:01:26 AM] ... 6 more
    [07:01:26 AM] Command-line execution failed (Return code: 2)
    [07:01:26 AM] Command-line executed: "C:\Program Files\Android\android-sdk\platform-tools\dx.bat" dex debug keep-classes output="C:\Jwork\TestApp\deploy\ANDROID_MOBILE_NATIVE_archive3\classes.dex" C:\Jwork\TestApp\deploy\ANDROID_MOBILE_NATIVE_archive3\classes C:\Jwork\TestApp\deploy\ANDROID_MOBILE_NATIVE_archive3\framework\build\jar\AND_ksoap.jar C:\Jwork\TestApp\deploy\ANDROID_MOBILE_NATIVE_archive3\framework\build\jar\Container.jar C:\Jwork\TestApp\deploy\ANDROID_MOBILE_NATIVE_archive3\framework\build\jar\IDMMobileSDK.jar C:\Jwork\TestApp\deploy\ANDROID_MOBILE_NATIVE_archive3\framework\build\jar\logging_dalvik_release.jar C:\Jwork\TestApp\deploy\ANDROID_MOBILE_NATIVE_archive3\framework\build\jar\phonegap.jar C:\Jwork\TestApp\deploy\ANDROID_MOBILE_NATIVE_archive3\framework\build\jar\vmchannel_dalvik_release.jar
    [07:01:26 AM] Deployment cancelled.
    [07:01:26 AM] ---- Deployment incomplete ----.
    [07:01:26 AM] Deployment failed due to one or more errors returned by 'C:\Program Files\Android\android-sdk\platform-tools\dx.bat'. The following is a summary of the returned error(s):
    Command-line execution failed (Return code: 2)
    - Thanks
    Sujith
    Edited by: user11272928 on Oct 30, 2012 7:28 PM

    Hi,
    At this point, we really have not fully tested out JDK 1.7, and we rely on Android SDK to actually compile the app. Any way you can add JDK 1.6 to your machine, and configure the Android SDK to use JDK 1.6?
    Thanks,
    Joe Huang

  • How to use MessageDigest

    Hi, all
    I am newbie to java security. I am updating a application. The application was running on JDK1.1. Now I updated the application codes and compiled them. When i run it. I found a problem in MessageDigest call, it returen different result from previous version. The diff occurs in the following codes:
    MessageDigest ms5 = new MessageDigest("MD5");
    md5.update(password.getBytes());
    byte[] md5Password = md5.digest();
    md5Password is different result for same password in two version.
    I have looked at the java,security file. I set the security.provider.1=sun.security.provider.Sun
    it is same as java 1 security file of my application.
    But the system.scope is different in two jdk version.
    jdk 1.X is system.scope=sun.security.provider.IdentityDatabase
    and jdk1.3 is:
    system.scope=sun.security.provider.policyFile
    Any idea?\
    Thanks in advance.
    Oliver

    Don't make you confuse for the previous post.
    byte[] md5Password = md5.digest();
    md5Password value is same when we run it in different jdk version. but the md5.toString() is different. When we print the md5.toString() object:
    System.out.println(md5.toString());
    it prints different result:
    jdk1.1 version prints: sun.security.provider.MD5 Message Digest <sdf34gg545454hjspepkvmblww45fe6a>
    jdk1.3 prints: MD5 Message Digest from SUN, <initialized>
    What MessageDigest.toString return?
    We used the toString result for password encoded result and took the second part "sdf34gg545454hjspepkvmblww45fe6a" and store it in db. Now, in version 1.3, we can't get the characters. It always is "initialized" How can we do? some thing wrong in our codes?
    HELP!!!!!!!!!!!!!!

  • MessageDigest problem

    Hi All!
    I've tried to use the MessageDigest this way:
    private short getMD5Hash(APDU apdu, byte[] msg, short msgOffset, short msgLength, byte[] hash) {
      try {
        MessageDigest MD = MessageDigest.getInstance(MessageDigest.ALG_MD5, false);
        if (MD.getLength() > hash.length) { return 1;}
        MD.doFinal(msg, msgOffset, msgLength, hash, (short) 0);
      } catch (CryptoException e) {
        return e.getReason();
      return 0;
    }In the line with "getInstance()" I get "6F 00 Status: No precise diagnosis" (not absence of algorithm implementation!)
    Google suggested me to move the getInstance into constructor - didn't help.
    Using of javacard.security.Signature instead of MessageDigest had also no impact.
    When I run it in simulator (JCTools) everything is working perfectly. On real cards (Global platform 2.1.1) does not.
    Where is the source of the problem?
    Kindest regards.

    Im testing my applet with the Jcop 20 card and using Java Card 2.1.1 and OpenPlatform 2.0.1'. The result is 01 01 which means MD5 and SHA works while the RIPEMD160 does not.
    I used the same applet code as previously posted.
    resetCard with timeout: 0 (ms)
    --Waiting for card...
    ATR=3B 69 00 FF 00 64 4A 10 04 32 05 90 00             ;i...dJ..2...
    ATR: T=0, N=-1, Hist=00644A100432059000
    => 00 A4 04 00 08 A0 00 00 00 03 00 00 00 00          ..............
    (78574 usec)
    <= 6F 19 84 08 A0 00 00 00 03 00 00 00 A5 0D 9F 6E    o..............n
        06 40 51 21 82 20 0F 9F 65 01 FF 90 00             .@Q!. ..e....
    Status: No Error
    cm>  set-key 255/1/DES-ECB/404142434445464748494a4b4c4d4e4f 255/2/DES-ECB/404142434445464748494a4b4c4d4e4f 255/3/DES-ECB/404142434445464748494a4b4c4d4e4f
    cm>  init-update 255
    => 80 50 00 00 08 6A 84 89 4F 99 F8 F2 29 00          .P...j..O...).
    (113083 usec)
    <= 00 00 50 60 01 90 93 90 71 66 01 01 62 DC D6 E3    ..P`....qf..b...
        76 A5 8B 8D 35 CD 3A 50 2B 56 24 92 90 00          v...5.:P+V$...
    Status: No Error
    cm>  ext-auth plain
    => 84 82 00 00 10 71 C4 B8 55 7D 2E 9D 35 A7 2B EB    .....q..U}..5.+.
        63 27 E2 01 86                                     c'...
    (60917 usec)
    <= 90 00                                              ..
    Status: No Error
    cm>  delete a00000000002
    => 80 E4 00 00 08 4F 06 A0 00 00 00 00 02 00          .....O........
    (58494 usec)
    <= 6A 80                                              j.
    Status: Wrong data
    jcshell: Error code: 6a80 (Wrong data)
    jcshell: Wrong response APDU: 6A80
    Ignoring expected error
    cm>  delete a00000000001
    => 80 E4 00 00 08 4F 06 A0 00 00 00 00 01 00          .....O........
    (58125 usec)
    <= 6A 80                                              j.
    Status: Wrong data
    jcshell: Error code: 6a80 (Wrong data)
    jcshell: Wrong response APDU: 6A80
    Ignoring expected error
    cm>  upload -b 250 "C:\Documents and Settings\Jeffrey Chu\workspace\hashjcop20\bin\hashjcop20\javacard\hashjcop20.cap"
    => 80 E6 02 00 13 06 A0 00 00 00 00 01 08 A0 00 00    ................
        00 03 00 00 00 00 00 00 00                         .........
    (89735 usec)
    <= 00 90 00                                           ...
    Status: No Error
    => 80 E8 00 00 FA C4 82 01 D6 01 00 10 DE CA FF ED    ................
        01 02 04 00 01 06 A0 00 00 00 00 01 02 00 1F 00    ................
        10 00 1F 00 0A 00 1F 00 3A 00 0C 00 FA 00 0A 00    ........:.......
        19 00 00 00 7F 00 00 00 00 00 00 03 01 00 04 00    ................
        1F 03 00 01 07 A0 00 00 00 62 01 01 01 01 07 A0    .........b......
        00 00 00 62 01 02 00 01 07 A0 00 00 00 62 00 01    ...b.........b..
        03 00 0A 01 06 A0 00 00 00 00 02 00 4B 06 00 0C    ............K...
        00 80 03 03 00 03 07 01 00 00 00 57 07 00 FA 07    ...........W....
        00 8B 00 0B 00 98 00 08 00 8B 80 0F 00 9C 00 00    ................
        00 AC 80 03 00 9C 00 00 00 AF 00 0B 00 BC 00 08    ................
        00 AF 80 0F 00 C0 00 00 00 D0 80 03 00 C0 00 00    ................
        00 D3 80 0B 00 E0 00 08 05 40 18 8C 00 0D 18 19    .........@......
        1E 04 41 19 1E 25 8B 00 06 7A 04 30 8F 00 09 18    ..A..%...z.0....
        1D 1E 8C 00 05 7A 03 25 19 8B 00 07 2D 18 8B 00    .....z.%....-...
        03 60 03 7A 1A 03 25 60 08 11 6E 00 8D 00 0A 1A    .`.z..%`..n.....
        04 25 10 AA 6A 08 11 6D 00 8D 00 0A 1A 05 25 00    .%..j..m......%.
    (635254 usec)
    <= 90 00                                              ..
    Status: No Error
    => 80 E8 80 01 E0 73 00 73 00 01 00 01 00 09 03 32    .....s.s.......2
        18 05 03 8D 00 0C 87 02 59 03 01 70 16 28 04 70    ........Y..p.(.p
        12 28 06 71 00 06 15 06 93 28 05 1F 07 4D 32 72    .(.q.....(...M2r
        05 71 FF F8 18 06 03 8D 00 0C 87 01 59 03 01 70    .q..........Y..p
        16 28 04 70 12 28 06 71 00 06 15 06 93 28 05 1F    .(.p.(.q.....(..
        07 4D 32 72 05 71 FF F8 18 04 03 8D 00 0C 87 00    .M2r.q..........
        59 03 01 70 04 28 04 19 8B 00 07 03 1F 8D 00 04    Y..p.(..........
        3B 19 03 05 8B 00 0B 7A 11 6B 00 8D 00 0A 7A 08    ;......z.k....z.
        00 0A 00 00 00 00 00 00 00 00 00 00 05 00 3A 00    ..............:.
        0E 02 00 00 02 02 00 00 01 02 00 00 00 03 80 03    ................
        03 06 80 10 06 06 00 00 39 03 80 03 02 03 80 0A    ........9.......
        01 01 82 02 00 01 00 00 00 06 80 07 01 03 80 0A    ................
        08 06 81 0B 00 06 80 03 00 09 00 19 00 03 92 24    ...............$
        24 00 12 07 18 18 06 0B 06 06 07 05 0E 0D 14 24    $..............$
        24 0D 05 07 07 00                                  $.....
    (683281 usec)
    <= 00 90 00                                           ...
    Status: No Error
    Load report:
      474 bytes loaded in 1.3 seconds
      effective code size on card:
          + package AID       6
          + applet AIDs       13
          + classes           15
          + methods           253
          + statics           0
          + exports           0
            overall           287  bytes
    cm>  install -i a00000000002  -q C9#() a00000000001 a00000000002
    => 80 E6 0C 00 1B 06 A0 00 00 00 00 01 06 A0 00 00    ................
        00 00 02 06 A0 00 00 00 00 02 01 00 02 C9 00 00    ................
        00                                                 .
    (184931 usec)
    <= 00 90 00                                           ...
    Status: No Error
    cm>  card-info
    => 80 F2 80 00 02 4F 00 00                            .....O..
    (51384 usec)
    <= 08 A0 00 00 00 03 00 00 00 07 9E 90 00             .............
    Status: No Error
    => 80 F2 40 00 02 4F 00 00                            [email protected]..
    (50714 usec)
    <= 06 A0 00 00 00 00 02 07 00 90 00                   ...........
    Status: No Error
    => 80 F2 10 00 02 4F 00 00                            .....O..
    (25768 usec)
    <= 6A 86                                              j.
    Status: Incorrect parameters (P1,P2)
    => 80 F2 20 00 02 4F 00 00                            .. ..O..
    (154709 usec)
    <= 07 A0 00 00 00 62 00 01 01 00 07 A0 00 00 00 62    .....b.........b
        01 01 01 00 07 A0 00 00 00 62 01 02 01 00 07 A0    .........b......
        00 00 00 62 02 01 01 00 07 A0 00 00 00 03 00 00    ...b............
        01 00 05 31 50 41 59 2E 01 00 07 A0 00 00 00 03    ...1PAY.........
        60 10 01 00 06 A0 00 00 00 00 01 01 00 90 00       `..............
    Status: No Error
    Card Manager AID   :  A000000003000000
    Card Manager state :  INITIALIZED
        Application:  SELECTABLE (--------) A00000000002   
        Load File  :      LOADED (--------) A0000000620001   (java.lang)
        Load File  :      LOADED (--------) A0000000620101   (javacard.framework)
        Load File  :      LOADED (--------) A0000000620102   (javacard.security)
        Load File  :      LOADED (--------) A0000000620201   (javacardx.crypto)
        Load File  :      LOADED (--------) A0000000030000   (visa.openplatform)
        Load File  :      LOADED (--------) "1PAY."          (PSE)
        Load File  :      LOADED (--------) A0000000036010   (VisaCash)
        Load File  :      LOADED (--------) A00000000001   
    cm>  /select A00000000002
    => 00 A4 04 00 06 A0 00 00 00 00 02 00                ............
    (26504 usec)
    <= 90 00                                              ..
    Status: No Error
    cm>  /send 00AA010000
    => 00 AA 01 00 00                                     .....
    (223202 usec)
    <= 01 01 90 00                                        ....
    Status: No Error

  • MessageDigest MD5 does not match up with PHP md5

    Hello Java Developers,
    Quite simply, I am generating an MD5 fingerprint from Java and wanting to verify it in PHP on a remote web site. No matter what I've tried and despite all my trouble-shooting, the results always come out differently.
    I understand that PHP's md5 function returns the result as a hex string. I've written my own Java toHexString function, but the result still comes out different (slightly different in fact). I will paste both my Java code and PHP code, let me know if you see anything wrong:
    Java Code:
         MessageDigest     md5 = MessageDigest.getInstance("MD5");
         Date          dt = Calendar.getInstance().getTime();
         Random          r = new Random (dt.getTime ());
         int          nRandom;
         String          s;
         nRandom = sr.nextInt();
         s = (nRandom + ":" + nCode + ":" + (nRandom ^ 426473384));
         // I've also tried "US-ASCII" here
         md5.update (s.getBytes ("UTF-8"));
         // Returns URL fingerprint and ingredients to be sent to PHP script
         return "fp=" + toHexString (md5.digest()) + "&r=" + nRandom;The toHexString function:
         private String toHexString (byte [] v)
              StringBuffer     sb = new StringBuffer ();
              byte          n1, n2;
              for (int c = 0; c < v.length; c++)
                   n1 = (byte)((v[c] < 0 ? -v[c] + 127 : v[c]) / 0x10);
                   n2 = (byte)((v[c] < 0 ? -v[c] + 127 : v[c]) % 0x10);
                   sb.append (n1 >= 0xA ? (char)(n1 - 0xA + 'a') : (char)(n1 + '0'));
                   sb.append (n2 >= 0xA ? (char)(n2 - 0xA + 'a') : (char)(n2 + '0'));
              return sb.toString();
         }PHP Code:
    $s = $_GET['r'] . ":" . $_GET['code'] . ":" . ((int)$_GET['r'] ^ 426473384);
    echo $s . "<BR>";
    echo $_GET['fp'] . " == " . md5($s);
    The results always differ, and I have verified that the XOR mathematical expression is consistent between Java and PHP. Thanks for your time, any help would be greatly appreciated.
    Jonathan Neufeld
    Software Engineer
    http://www.extollit.com

    Use this simpler version:
        private static String toHexString(byte[] v) {
            StringBuffer sb = newStringBuffer(v.length * 2);
            for (int i = 0; i < v.length; i++) {
                 int b = v[i] & 0xFF;
                 sb.append(HEX_DIGITS.charAt(b >>> 4))
                   .append(HEX_DIGITS.charAt(b & 0xF));
            return sb.toString();
        private static final String HEX_DIGITS = "0123456789abcdef";Note also that PHP strings have an internal 8-bit encoding depending on the platform on which it runs and it was compiled. Prior to interpreting which byte values will be stored in PHP strings, you need to determine the origin of the encoded string to determine also its encoding. PHP Strings may contain UTF-8 strings or other 8-bit encodings.
    It's up to you in your PHP script to provide the encoding conversion before using te PHP MD5 implementation (which ignores all encoding differences as it just considers byte values stored in the PHP string value). There's no problem in the PHP implementation of MD5. The complexity comes from the difficulty to trace the encoding effectively used in the source PHP string value.
    In Java you would have exactly the same difficulties if all your strings were stored only in arrays of bytes. Java adds a UCS2 semantic to char values, and UTF-16 semantic to string values, so that you can perform conversion from Java UTF-16 "Strings" to any other encoding made for streams of 8-bit bytes...

  • Help with MessageDigest.digest()

    I have the following:
      MessageDigest sha = MessageDigest.getInstance("SHA-1");
      byte[] strRaw = str.getBytes();
      sha.update(strRaw, 0, strRaw.length);My understanding is that update() will hash strRaw starting from byte 0 for the whole length of strRaw. Is this correct?
    Now how do I complete the hash by using digest(byte[] hashed, int offset, int len)?
    byte[] hashed will hold the final hashed value, correct? But what would i put for len? How could I know what the length of hashed is before hand. Don't I want digest() to handle the length of hashed?
    Finally, if I wanted to hash something x number of times, do I call update() for digest() x number of times?
    Thank you

    I'm trying to achieve the same hash two different ways but I am unable to for some reason. Anyone see why?
    First:
    String str="test";
    MessageDigest sha = MessageDigest.getInstance("SHA-1");
    byte[] strBytes = str.getBytes("UTF-8");
    sha.update(pwdBytes, 0, pwdBytes.length);
    byte[] hash= new byte[20];
    int size=0;
    for(int i=0; i<100; i++) {
         size = sha.digest(hash, 0, 20);
         sha.update(hash, 0, size);
    }   Second:
    String str="test";
    MessageDigest sha = MessageDigest.getInstance("SHA-1");
    byte[] strBytes = str.getBytes("UTF-8");
    for(int i=0; i<100; i++) {
         hash = sha.digest(strBytes);
         sha.update(hash);
    }the two resulting hash variables have the same length, but don't contain the same values.
    Edited by: black_lotus on 16-Apr-2008 9:11 PM

  • Tecra M9-136 - BSOD during Vista SP2 update

    Tecra M9-136 asked this morning to update to Vista SP2 and during the process the BSOD 0x0000007E arrived. Restarted in Safe Mode and the installer continued and then finally reported that the update had failed - and reverted to SP1. This took most of the morning.
    It will start in Safe Mode but on a normal boot-up, Vista SP1 gets through the fingerprint recognition and then fails with the same BSOD (it doesn't get as far as displaying the desktop).
    The laptop has BIOS level 1.80. I've tried in Safe mode to install 1.90 but it tells me that the battery has insufficient charge and the power adapter isn't attached. Both untrue.
    Stuck - need advice. Could this be a hard fault? Can't see how I can update anything if it's a soft fault.
    thanks

    The message with the BSOD mentioned checking BIOS and driver versions. Anyway, no change made to that.,
    I tried System Restore but the only available restore point was the SP2 installation. I thought Vista was supposed to save a restore point every 24 hours even if nothing new had been installed.
    I've now found in System Information / Windows Error Reporting several messages like this:
    28/09/2009 12:08 Windows Error Reporting Fault bucket 0x7E_NULL_IP_DRVNDDM+57bd, type 0&#x000d;&#x000a;Event Name: BlueScreen&#x000d;&#x000a;Response: None&#x000d;&#x000a;Cab Id: 0&#x000d;&#x000a;&#x000d;&#x000a;Problem signature:&#x000d;&#x000a;P1: &#x000d;&#x000a;P2: &#x000d;&#x000a;P3: &#x000d;&#x000a;P4: &#x000d;&#x000a;P5: &#x000d;&#x000a;P6: &#x000d;&#x000a;P7: &#x000d;&#x000a;P8: &#x000d;&#x000a;P9: &#x000d;&#x000a;P10: &#x000d;&#x000a;&#x000d;&#x000a;Attached files:&#x000d;&#x000a;C:\Windows\Minidump\Mini0928 09-04.dmp&#x000d;&#x000a;C:\Users\me\AppData\Local\Te mp\WER-75660-0.sysdata.xml&#x000d;&#x000a;C:\Users\me\AppData\L ocal\Temp\WER7D78.tmp.version.txt&#x000d;&#x000a;& #x000d;&#x000a;These files may be available here:&#x000d;&#x000a;C:\Users\me\AppData\Local\Mic rosoft\Windows\WER\ReportArchive\Report06d1c4b5

Maybe you are looking for

  • Black background in map VB 2.0 ( TM 9.0)

    Hi all, may anybody can help. We work on a Democase for SAP TM. VB 2.0 works with Content from TM 9.0 because the objects are shown in the map, but the Background is black. We using the "Default" entry in VB 2.0 matched with NAVTEQ Maps ( Standard en

  • Updating to Camera Raw 7.2

    When in Lightroom and going to Photoshop to edit a photo LR says I need to update Camerea Raw to 7.2 using Help in PS. But PS help says everything is up to date and shows Camera Raw version as 6.7.0.339. So how do I update? I did just update LR to ve

  • Count the number of rows resulting from a select statement

    Hi, Is there any way of counting the number of rows resulting from a select statement. i.e I have a select distinct statement and I then want to perform an IF statement on the number of rows resulting from the select statement. Any help appreciated T

  • SAP Certification - Project Manager - C_PM_70

    Dear Friends, I m apprearing for SAP Certification exam - C_PM_70 for Associate Project Manager, in a couple of weeks and have not had any luck in finding study material yet. I request, if you have any related material, please pass it on to - "xxxxx@

  • DB2 and AIX on p570 server with Virtual I/O Server

    Hi, All We are implementing a system landscape on IBM p5 570 servers and currently are planning of 3 LPARs with dual VIO-servers on each box. Have anybody expirience for this configuration in production systems ? Is there any DB2-specific problems fo