Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package org.bouncycastle.crypto.params;
  
Parameter class for the HKDFBytesGenerator class.
  
  public class HKDFParameters
     implements DerivationParameters
 {
     private final byte[] ikm;
     private final boolean skipExpand;
     private final byte[] salt;
     private final byte[] info;
 
     private HKDFParameters(final byte[] ikmfinal boolean skip,
                            final byte[] saltfinal byte[] info)
     {
         if (ikm == null)
         {
             throw new IllegalArgumentException(
                 "IKM (input keying material) should not be null");
         }
 
         this. = Arrays.clone(ikm);
 
         this. = skip;
 
         if (salt == null || salt.length == 0)
         {
             this. = null;
         }
         else
         {
             this. = Arrays.clone(salt);
         }
 
         if (info == null)
         {
             this. = new byte[0];
         }
         else
         {
             this. = Arrays.clone(info);
         }
     }

    
Generates parameters for HKDF, specifying both the optional salt and optional info. Step 1: Extract won't be skipped.

Parameters:
ikm the input keying material or seed
salt the salt to use, may be null for a salt for hashLen zeros
info the info to use, may be null for an info field of zero bytes
 
     public HKDFParameters(final byte[] ikmfinal byte[] saltfinal byte[] info)
     {
         this(ikmfalsesaltinfo);
     }

    
Factory method that makes the HKDF skip the extract part of the key derivation function.

Parameters:
ikm the input keying material or seed, directly used for step 2: Expand
info the info to use, may be null for an info field of zero bytes
Returns:
HKDFParameters that makes the implementation skip step 1
 
     public static HKDFParameters skipExtractParameters(final byte[] ikm,
                                                        final byte[] info)
     {
 
         return new HKDFParameters(ikmtruenullinfo);
     }
 
     public static HKDFParameters defaultParameters(final byte[] ikm)
     {
         return new HKDFParameters(ikmfalsenullnull);
     }

    
Returns the input keying material or seed.

Returns:
the keying material
 
     public byte[] getIKM()
     {
         return Arrays.clone();
     }

    
Returns if step 1: extract has to be skipped or not

Returns:
true for skipping, false for no skipping of step 1
 
     public boolean skipExtract()
     {
        return ;
    }

    
Returns the salt, or null if the salt should be generated as a byte array of HashLen zeros.

Returns:
the salt, or null
    public byte[] getSalt()
    {
        return Arrays.clone();
    }

    
Returns the info field, which may be empty (null is converted to empty).

Returns:
the info field, never null
    public byte[] getInfo()
    {
        return Arrays.clone();
    }
New to GrepCode? Check out our FAQ X