Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the cipher padding strings in java

Tags:

java

padding

jce

Everyone talks about the padding schemes in ciphers but what are the actual strings one needs to pass in to the cipher? I don't care if they are symmetric or asymmetric, I just want a list of the possible values.

like image 443
Roy Hinkley Avatar asked Jun 07 '12 15:06

Roy Hinkley


People also ask

What is Cypher in Java?

It forms the core of the Java Cryptographic Extension (JCE) framework. In order to create a Cipher object, the application calls the Cipher's getInstance method, and passes the name of the requested transformation to it. Optionally, the name of a provider may be specified.

Is cipher thread safe Java?

Cipher is not thread safe. If you use multithreading for performance and don't want to do synchronization, you can use Jasypt (http://www.jasypt.org/general-usage.html) it has pooled encryptors: PooledPBEByteEncryptor, PooledPBEStringEncryptor.

What is AES CBC NoPadding?

>AES/CBC/NoPadding. >AES/CBC/PKCS5Padding. Using the “AES” transformation, the Cipher will default to ECB and NoPadding. If the NoPadding mode is selected, the input data must be a multiple of 8 bytes; otherwise, the encrypted or decrypted result will be truncated.


1 Answers

There are many types of padding, PKCS-7, Zero, ISO 10126, ANSI X.923, etc.
I suggest you read up on padding since you seem not to fully understand the concept.

Then there's the possibility you are referring to cryptographic salt.

Edit
Every implementation of the Java platform is required to support the following standard Cipher transformations with the keysizes in parentheses:

  • AES/CBC/NoPadding (128)
  • AES/CBC/PKCS5Padding (128)
  • AES/ECB/NoPadding (128)
  • AES/ECB/PKCS5Padding (128)
  • DES/CBC/NoPadding (56)
  • DES/CBC/PKCS5Padding (56)
  • DES/ECB/NoPadding (56)
  • DES/ECB/PKCS5Padding (56)
  • DESede/CBC/NoPadding (168)
  • DESede/CBC/PKCS5Padding (168)
  • DESede/ECB/NoPadding (168)
  • DESede/ECB/PKCS5Padding (168)
  • RSA/ECB/PKCS1Padding (1024, 2048)
  • RSA/ECB/OAEPWithSHA-1AndMGF1Padding (1024, 2048)
  • RSA/ECB/OAEPWithSHA-256AndMGF1Padding (1024, 2048)

You can find a list here.

Edit 2
You can find the Bouncy Castle specification here. It lists all available padding schemes.

like image 86
Sani Singh Huttunen Avatar answered Sep 29 '22 20:09

Sani Singh Huttunen