Tabnine Logo
DerivationFunction.generateBytes
Code IndexAdd Tabnine to your IDE (free)

How to use
generateBytes
method
in
org.spongycastle.crypto.DerivationFunction

Best Java code snippets using org.spongycastle.crypto.DerivationFunction.generateBytes (Showing top 14 results out of 315)

origin: ethereum/ethereumj

K = new byte[K1.length + K2.length];
kdf.generateBytes(K, 0, K.length);
K = new byte[K1.length + K2.length];
kdf.generateBytes(K, 0, K.length);
System.arraycopy(K, 0, K1, 0, K1.length);
System.arraycopy(K, K1.length, K2, 0, K2.length);
origin: ethereum/ethereumj

K = new byte[K1.length + K2.length];
kdf.generateBytes(K, 0, K.length);
K = new byte[K1.length + K2.length];
kdf.generateBytes(K, 0, K.length);
System.arraycopy(K, 0, K1, 0, K1.length);
System.arraycopy(K, K1.length, K2, 0, K2.length);
origin: com.madgag/sc-light-jdk15on

private byte[] generateKdfBytes(
  KDFParameters kParam,
  int length)
{
  byte[]  buf = new byte[length];
  kdf.init(kParam);
  kdf.generateBytes(buf, 0, buf.length);
  return buf;
}
origin: com.madgag.spongycastle/core

  protected KeyParameter generateKey(BigInteger n, BigInteger r, int keyLen)
  {
    byte[] R = BigIntegers.asUnsignedByteArray((n.bitLength() + 7) / 8, r);

    // Initialise the KDF
    kdf.init(new KDFParameters(R, null));

    // Generate the secret key
    byte[] K = new byte[keyLen];
    kdf.generateBytes(K, 0, K.length);

    return new KeyParameter(K);
  }
}
origin: com.madgag/scprov-jdk15on

protected SecretKey engineGenerateSecret(
  String algorithm)
  throws NoSuchAlgorithmException
{
  byte[] secret = bigIntToBytes(result);
  if (kdf != null)
  {
    if (!algorithms.containsKey(algorithm))
    {
      throw new NoSuchAlgorithmException("unknown algorithm encountered: " + algorithm);
    }
    
    int    keySize = ((Integer)algorithms.get(algorithm)).intValue();
    DHKDFParameters params = new DHKDFParameters(new DERObjectIdentifier(algorithm), keySize, secret);
    byte[] keyBytes = new byte[keySize / 8];
    kdf.init(params);
    kdf.generateBytes(keyBytes, 0, keyBytes.length);
    secret = keyBytes;
  }
  else
  {
    // TODO Should we be ensuring the key is the right length?
  }
  return new SecretKeySpec(secret, algorithm);
}
origin: com.madgag.spongycastle/prov

kdf.generateBytes(keyBytes, 0, keyBytes.length);
origin: com.madgag.spongycastle/core

  protected KeyParameter deriveKey(int keyLen, byte[] C, byte[] PEH)
  {
    byte[] kdfInput = PEH;
    if (!SingleHashMode)
    {
      kdfInput = Arrays.concatenate(C, PEH);
      Arrays.fill(PEH, (byte)0);
    }

    try
    {
      // Initialise the KDF
      kdf.init(new KDFParameters(kdfInput, null));
  
      // Generate the secret key
      byte[] K = new byte[keyLen];
      kdf.generateBytes(K, 0, K.length);

      // Return the ciphertext
      return new KeyParameter(K);
    }
    finally
    {
      Arrays.fill(kdfInput, (byte)0);
    }
  }
}
origin: com.madgag.spongycastle/core

K = new byte[K1.length + K2.length];
kdf.generateBytes(K, 0, K.length);
K = new byte[K1.length + K2.length];
kdf.generateBytes(K, 0, K.length);
System.arraycopy(K, 0, K1, 0, K1.length);
System.arraycopy(K, K1.length, K2, 0, K2.length);
origin: com.madgag/sc-light-jdk15on

public int generateBytes(byte[] out, int outOff, int len)
  throws DataLengthException, IllegalArgumentException
{
  // TODO Create an ASN.1 class for this (RFC3278)
  // ECC-CMS-SharedInfo
  ASN1EncodableVector v = new ASN1EncodableVector();
  v.add(new AlgorithmIdentifier(algorithm, new DERNull()));
  v.add(new DERTaggedObject(true, 2, new DEROctetString(integerToBytes(keySize))));
  try
  {
    kdf.init(new KDFParameters(z, new DERSequence(v).getEncoded(ASN1Encoding.DER)));
  }
  catch (IOException e)
  {
    throw new IllegalArgumentException("unable to initialise kdf: " + e.getMessage());
  }
  return kdf.generateBytes(out, outOff, len);
}
origin: yggdrash/yggdrash

K = new byte[K1.length + K2.length];
kdf.generateBytes(K, 0, K.length);
K = new byte[K1.length + K2.length];
kdf.generateBytes(K, 0, K.length);
System.arraycopy(K, 0, K1, 0, K1.length);
System.arraycopy(K, K1.length, K2, 0, K2.length);
origin: biheBlockChain/wkcwallet-java

K = new byte[K1.length + K2.length];
kdf.generateBytes(K, 0, K.length);
K = new byte[K1.length + K2.length];
kdf.generateBytes(K, 0, K.length);
System.arraycopy(K, 0, K1, 0, K1.length);
System.arraycopy(K, K1.length, K2, 0, K2.length);
origin: com.madgag.spongycastle/core

K = new byte[K1.length + K2.length];
kdf.generateBytes(K, 0, K.length);
K = new byte[K1.length + K2.length];
kdf.generateBytes(K, 0, K.length);
System.arraycopy(K, 0, K1, 0, K1.length);
System.arraycopy(K, K1.length, K2, 0, K2.length);
origin: yggdrash/yggdrash

K = new byte[K1.length + K2.length];
kdf.generateBytes(K, 0, K.length);
System.arraycopy(K, 0, K1, 0, K1.length);
System.arraycopy(K, K1.length, K2, 0, K2.length);
K = new byte[K1.length + K2.length];
kdf.generateBytes(K, 0, K.length);
System.arraycopy(K, 0, K1, 0, K1.length);
System.arraycopy(K, K1.length, K2, 0, K2.length);
origin: biheBlockChain/wkcwallet-java

K = new byte[K1.length + K2.length];
kdf.generateBytes(K, 0, K.length);
K = new byte[K1.length + K2.length];
kdf.generateBytes(K, 0, K.length);
System.arraycopy(K, 0, K1, 0, K1.length);
System.arraycopy(K, K1.length, K2, 0, K2.length);
org.spongycastle.cryptoDerivationFunctiongenerateBytes

Popular methods of DerivationFunction

  • init
  • getDigest
    return the message digest used as the basis for the function

Popular in Java

  • Making http requests using okhttp
  • runOnUiThread (Activity)
  • getExternalFilesDir (Context)
  • putExtra (Intent)
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • Hashtable (java.util)
    A plug-in replacement for JDK1.5 java.util.Hashtable. This version is based on org.cliffc.high_scale
  • UUID (java.util)
    UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • BoxLayout (javax.swing)
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now