PBKDF2Params (Bouncy Castle Library 1.52 API Specification)

org.bouncycastle.asn1.pkcs

## Class PBKDF2Params

- java.lang.Object
- - org.bouncycastle.asn1.ASN1Object
  - - org.bouncycastle.asn1.pkcs.PBKDF2Params

- All Implemented Interfaces:
    ASN1Encodable, Encodable

      public class PBKDF2Params
      extends ASN1Object

           PBKDF2-params ::= SEQUENCE {
                     salt CHOICE {
                            specified OCTET STRING,
                            otherSource AlgorithmIdentifier {{PBKDF2-SaltSources}}
                     },
                    iterationCount INTEGER (1..MAX),
                    keyLength INTEGER (1..MAX) OPTIONAL,
                    prf AlgorithmIdentifier {{PBKDF2-PRFs}} DEFAULT algid-hmacWithSHA1 }

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `PBKDF2Params(byte[] salt, int iterationCount)` Create a PBKDF2Params with the specified salt, iteration count, and algid-hmacWithSHA1 for the prf.
    `PBKDF2Params(byte[] salt, int iterationCount, AlgorithmIdentifier prf)` Create a PBKDF2Params with the specified salt, iteration count, and a defined prf.
    `PBKDF2Params(byte[] salt, int iterationCount, int keyLength)` Create a PBKDF2Params with the specified salt, iteration count, keyLength, and algid-hmacWithSHA1 for the prf.
    `PBKDF2Params(byte[] salt, int iterationCount, int keyLength, AlgorithmIdentifier prf)` Create a PBKDF2Params with the specified salt, iteration count, keyLength, and a defined prf.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static PBKDF2Params` | `getInstance(java.lang.Object obj)` Create PBKDF2Params from the passed in object,
    `java.math.BigInteger` | `getIterationCount()` Return the iteration count to use.
    `java.math.BigInteger` | `getKeyLength()` Return the intended length in octets of the derived key.
    `AlgorithmIdentifier` | `getPrf()` Return the algId of the underlying pseudo random function to use.
    `byte[]` | `getSalt()` Return the salt to use.
    `boolean` | `isDefaultPrf()` Return true if the PRF is the default (hmacWithSHA1)
    `ASN1Primitive` | `toASN1Primitive()` Return an ASN.1 structure suitable for encoding.

    - ### Methods inherited from class org.bouncycastle.asn1.ASN1Object

      `equals, getEncoded, getEncoded, hasEncodedTagValue, hashCode, toASN1Object`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### PBKDF2Params

          public PBKDF2Params(byte[] salt,
                      int iterationCount)

      Create a PBKDF2Params with the specified salt, iteration count, and algid-hmacWithSHA1 for the prf.
      Parameters:
        `salt` - input salt.
        `iterationCount` - input iteration count.

    - #### PBKDF2Params

          public PBKDF2Params(byte[] salt,
                      int iterationCount,
                      int keyLength)

      Create a PBKDF2Params with the specified salt, iteration count, keyLength, and algid-hmacWithSHA1 for the prf.
      Parameters:
        `salt` - input salt.
        `iterationCount` - input iteration count.
        `keyLength` - intended key length to be produced.

    - #### PBKDF2Params

          public PBKDF2Params(byte[] salt,
                      int iterationCount,
                      int keyLength,
                      AlgorithmIdentifier prf)

      Create a PBKDF2Params with the specified salt, iteration count, keyLength, and a defined prf.
      Parameters:
        `salt` - input salt.
        `iterationCount` - input iteration count.
        `keyLength` - intended key length to be produced.
        `prf` - the pseudo-random function to use.

    - #### PBKDF2Params

          public PBKDF2Params(byte[] salt,
                      int iterationCount,
                      AlgorithmIdentifier prf)

      Create a PBKDF2Params with the specified salt, iteration count, and a defined prf.
      Parameters:
        `salt` - input salt.
        `iterationCount` - input iteration count.
        `prf` - the pseudo-random function to use.

  - ### Method Detail

    - #### getInstance

          public static PBKDF2Params getInstance(java.lang.Object obj)

      Create PBKDF2Params from the passed in object,
      Parameters:
        `obj` - either PBKDF2Params or an ASN2Sequence.
      Returns:
        a PBKDF2Params instance.

    - #### getSalt

          public byte[] getSalt()

      Return the salt to use.
      Returns:
        the input salt.

    - #### getIterationCount

          public java.math.BigInteger getIterationCount()

      Return the iteration count to use.
      Returns:
        the input iteration count.

    - #### getKeyLength

          public java.math.BigInteger getKeyLength()

      Return the intended length in octets of the derived key.
      Returns:
        length in octets for derived key, if specified.

    - #### isDefaultPrf

          public boolean isDefaultPrf()

      Return true if the PRF is the default (hmacWithSHA1)
      Returns:
        true if PRF is default, false otherwise.

    - #### getPrf

          public AlgorithmIdentifier getPrf()

      Return the algId of the underlying pseudo random function to use.
      Returns:
        the prf algorithm identifier.

    - #### toASN1Primitive

          public ASN1Primitive toASN1Primitive()

      Return an ASN.1 structure suitable for encoding.
      Specified by:
        `toASN1Primitive` in interface `ASN1Encodable`
      Specified by:
        `toASN1Primitive` in class `ASN1Object`
      Returns:
        the object as an ASN.1 encodable structure.