i am conmfused about digital signature using assymetric key cryptography [duplicate] - java

This question already has answers here:
What is the difference between encrypting and signing in asymmetric encryption? [closed]
(12 answers)
Closed 3 years ago.
in DIGITAL SIGNATURE in RSA approach most people and you tuber have told PRIVATE KEY is used for encryption and PUBLIC KEY for decryption . When I searched about working mechanism of RSA algorithm. I found that public key are used for encryption and private key are used for decryption. I am confused. so please someone help me?

PRIVATE KEY is used for encryption and PUBLIC KEY for decryption
It is exacly the other way around. Public key encrypts, private key decrypts.

Related

Decode/encode Java [duplicate]

This question already has answers here:
Is it possible to decrypt MD5 hashes?
(24 answers)
Closed 3 years ago.
My problem is revert operation encode .
String computedLtpaTokenMd5 = new String(Base64.encodeBase64(MessageDigest.getInstance("MD5").digest(ltpaToken.getBytes())));
how to recover the token ltpaToken by computedLtPaTOkenMD5?
You cannot.
That is the whole point of a cryptographic hash function (which MD5 is, or rather was, you should not use it anymore): It is one-way.
All you can do is check if a given token matches that hashed value (by running the same hash function again and either getting the same output or not).
(You can reverse the Base64 encoding, but not the MD5 hashing)

AES-GCM-256 encryption [duplicate]

This question already has answers here:
Source and importance of nonce / IV for protocol using AES-GCM
(2 answers)
How to obtain different cipher text for same plain text using AES
(2 answers)
Closed 6 years ago.
We need to encrypt a UUID string using AES-GCM-256 and consumer will decrypt it using the same AES-GCM-256.As per the recommendation (RFC) the IV(initialization vector) must be unique for each invocation,I am confused how IV values will be common or shared between encrypter and decrypter.

How to pass SSL keystore password? [duplicate]

This question already has answers here:
Why is char[] preferred over String for passwords?
(17 answers)
Closed 7 years ago.
I am writing a little web framework and I want to enable SSL encryption with a SSL key which will be supplied by the user.
This might seem overly cautious, but is it common to pass the password for the keystore file as a String passed in the parameters of a method?
This is what I had in mind:
public void enableSSL(String keystorePath, String keystorePassword) {
// ... do things
}
It is always safer to store the password into character array than a string.
Please refer below query:
Why is char[] preferred over String for passwords?
Also refer the below coding guide lines from oracle site:
http://www.oracle.com/technetwork/java/seccodeguide-139067.html#2

Java - How to encrypt passwords for wordpress? [duplicate]

This question already has answers here:
What type of hash does WordPress use?
(11 answers)
Closed 8 years ago.
How can i encrypt password to get the same output like wordpress to compare it later with my db ?
As mentioned here WordPress uses the PasswordHash class from the phpass for generating the password hashes. According to the links, the default implementation used involves the use of a salt, and 8 rounds of MD5 hashing. Exactly how and when the salt is applied, and what goes into the MD5 don't seem to be readily available. However, there seem to be a java port of phpass here.
As I stated in the comments, WordPress uses MD5 to encrypt its passwords. Here's a link to some code about password hashing in PHP, which I think might be what you're looking for:
Password Hashing In PHP

How do I use my own password with aes in java [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
How do I use my own custom key(password) with aes in java? I want to use a file as a password to encrypt another file I know you normally use a SecretKeyGenerator but I want to use my own key/password. I read about using something called SALT but I can't find an example anywhere would someone show me some code to encrypt /decrypt or just what line to replace from a normal aes encryption
You just need to create a SecretKeySpec instance:
SecretKey key = new SecretKeySpec(bytesOfTheKey, "AES");
Just make sure to pass a byte array with the appropriate number of bytes (16 for AES-128)
Use new SecretKeySpec(byte[], "AES") - this can be directly used as a SecretKey of type "AES". If the file has enough entropy you may want to generate a SHA-256 hash over the file and use that as first parameter of the SecretKeySpec constructor. If the other file is lacking entropy then you might want to use the SHA-256 over the file as input for password based encryption.
If the files exist next to each other, you will have accomplished obscurity at best, of course. The cipher to use and the use of additional integrity checks on the cipher text depends on your use case.

Categories