Pages

This tutorial covers the basics of the science of cryptography. It explains how programmers and network professionals can use cryptography to maintain the privacy of computer data. Starting with the origins of cryptography, it moves on to explain cryptosystems, various traditional and modern ciphers, public key encryption, data integration, message authentication, and digital signatures.
Showing posts with label SHA-256 Java. Show all posts
Showing posts with label SHA-256 Java. Show all posts

Sunday, 19 April 2020

[SOLVED] java.io.IOException: keystore password was incorrect

PROBLEM
Exception in thread "main" java.io.IOException: keystore password was incorrect
at sun.security.pkcs12.PKCS12KeyStore.engineLoad(PKCS12KeyStore.java:2059)
at sun.security.provider.KeyStoreDelegator.engineLoad(KeyStoreDelegator.java:238)
at sun.security.provider.JavaKeyStore$DualFormatJKS.engineLoad(JavaKeyStore.java:70)
at java.security.KeyStore.load(KeyStore.java:1445)
at getprivatekeyfrompkcs12.GetPrivateKeyFromPKCS12.main(GetPrivateKeyFromPKCS12.java:21)

Caused by: java.security.UnrecoverableKeyException: failed to decrypt safe contents entry: javax.crypto.BadPaddingException: Given final block not properly padded. Such issues can arise if a bad key is used during decryption.

SOLVED
you must enter the passphrase correctly.

Friday, 10 April 2020

(SOLVED) MessageDigest.getInstance("SHA256") java.security.NoSuchAlgorithmException: SHA256

PROBLEM :
MessageDigest.getInstance("SHA256") java.security.NoSuchAlgorithmException: SHA256 MessageDigest not available

java.security.NoSuchAlgorithmException: SHA256 MessageDigest not available
 at sun.security.jca.GetInstance.getInstance(GetInstance.java:159)
 at java.security.Security.getImpl(Security.java:730)
 at java.security.MessageDigest.getInstance(MessageDigest.java:167)

SOLVED : 

Rename MessageDigest.getInstance("SHA256")  with MessageDigest.getInstance("SHA-256")

Friday, 11 October 2019

SHA 256 With Java

What is SHA-256?

The SHA (Secure Hash Algorithm) is one of several cryptographic hash functions. A cryptographic hash is like a signature for a text or a data file. SHA-256 algorithm generates an almost-unique, fixed-size 256-bit (32-byte) hash. Hash is a one-way function – it cannot be decrypted back. This makes it suitable for password validation, challenge hash authentication, anti-tamper, digital signatures.

SHA-256 is one of the successor hash functions to SHA-1 and is one of the strongest hash functions available.