Top Description Inners Fields Constructors Methods
org.bouncycastle.jcajce.provider.drbg

public Class DRBG

extends Object
Class Inheritance
Imports
java.io.IOException, .InputStream, java.net.URL, java.security.AccessController, .PrivilegedAction, .Provider, .SecureRandom, .SecureRandomSpi, .Security, java.util.concurrent.atomic.AtomicBoolean, .AtomicInteger, .AtomicReference, org.bouncycastle.crypto.digests.SHA512Digest, org.bouncycastle.crypto.macs.HMac, org.bouncycastle.crypto.prng.EntropySource, .EntropySourceProvider, .SP800SecureRandom, .SP800SecureRandomBuilder, org.bouncycastle.jcajce.provider.config.ConfigurableProvider, org.bouncycastle.jcajce.provider.symmetric.util.ClassUtil, org.bouncycastle.jcajce.provider.util.AsymmetricAlgorithmProvider, org.bouncycastle.util.Arrays, .Pack, .Properties, .Strings

DRBG Configuration

org.bouncycastle.drbg.gather_pause_secs - is to stop the entropy collection thread from grabbing all available entropy on the system. The original motivation for the hybrid infrastructure was virtual machines sometimes produce very few bits of entropy a second, the original approach (which "worked" at least for BC) was to just read on the second thread and allow things to progress around it, but it did tend to hog the system if other processes were using /dev/random. By default the thread will pause for 5 seconds between 64 bit reads, increasing this time will reduce the demands on the system entropy pool. Ideally the pause will be set to large enough to allow everyone to work together, but small enough to ensure the provider's DRBG is being regularly reseeded.

org.bouncycastle.drbg.entropysource - is the class name for an implementation of EntropySourceProvider. For example, one could be provided which just reads directly from /dev/random and the extra infrastructure used here could be avoided.

org.bouncycastle.drbg.entropy_thread - if true the provider will start a single daemon thread for handling entropy requests, rather than starting a thread periodically when samples are required.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
public static class
private static class
public static class
public static class
private static class
private static class

Field Summary

Modifier and TypeField and Description
private static EntropyDaemon
private static Thread
private static final String[][]
private static final String

Constructor Summary

AccessConstructor and Description
public
DRBG()

Method Summary

Modifier and TypeMethod and Description
private static SecureRandom
createBaseRandom(boolean isPredictionResistant)

private static EntropySourceProvider
private static EntropySourceProvider
private static EntropySourceProvider
private static final Object[]
private static byte[]
private static byte[]
private static void
sleep(long ms)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

entropyDaemonback to summary
private static EntropyDaemon entropyDaemon
entropyThreadback to summary
private static Thread entropyThread
initialEntropySourceNamesback to summary
private static final String[][] initialEntropySourceNames
PREFIXback to summary
private static final String PREFIX

Constructor Detail

DRBGback to summary
public DRBG()

Method Detail

createBaseRandomback to summary
private static SecureRandom createBaseRandom(boolean isPredictionResistant)
createCoreEntropySourceProviderback to summary
private static EntropySourceProvider createCoreEntropySourceProvider()
createEntropySourceback to summary
private static EntropySourceProvider createEntropySource()
createInitialEntropySourceback to summary
private static EntropySourceProvider createInitialEntropySource()
findSourceback to summary
private static final Object[] findSource()
generateDefaultPersonalizationStringback to summary
private static byte[] generateDefaultPersonalizationString(byte[] seed)
generateNonceIVPersonalizationStringback to summary
private static byte[] generateNonceIVPersonalizationString(byte[] seed)
sleepback to summary
private static void sleep(long ms) throws InterruptedException
org.bouncycastle.jcajce.provider.drbg back to summary

private Class DRBG.CoreSecureRandom

extends SecureRandom
Class Inheritance

Constructor Summary

AccessConstructor and Description
pack-priv
CoreSecureRandom(Object[] initialEntropySourceAndSpi)

Method Summary

Inherited from java.security.SecureRandom:
generateSeedgetAlgorithmgetInstancegetInstancegetInstancegetInstancegetInstancegetInstancegetInstanceStronggetParametersgetProvidergetSeednextnextBytesnextBytesreseedreseedsetSeedsetSeedtoString

Constructor Detail

CoreSecureRandomback to summary
pack-priv CoreSecureRandom(Object[] initialEntropySourceAndSpi)
org.bouncycastle.jcajce.provider.drbg back to summary

public Class DRBG.Default

extends SecureRandomSpi
Class Inheritance

Field Summary

Modifier and TypeField and Description
private static final SecureRandom

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected byte[]
engineGenerateSeed(int
the number of seed bytes to generate.
numBytes
)

Implements abstract java.security.SecureRandomSpi.engineGenerateSeed.

Returns the given number of seed bytes.
protected void
engineNextBytes(byte[]
the array to be filled in with random bytes.
bytes
)

Implements abstract java.security.SecureRandomSpi.engineNextBytes.

Generates a user-specified number of random bytes.
protected void
engineSetSeed(byte[]
the seed.
bytes
)

Implements abstract java.security.SecureRandomSpi.engineSetSeed.

Reseeds this random object with the given seed.
Inherited from java.security.SecureRandomSpi:
engineGetParametersengineNextBytesengineReseedtoString

Field Detail

randomback to summary
private static final SecureRandom random

Constructor Detail

Defaultback to summary
public Default()

Method Detail

engineGenerateSeedback to summary
protected byte[] engineGenerateSeed(int numBytes)

Implements abstract java.security.SecureRandomSpi.engineGenerateSeed.

Doc from java.security.SecureRandomSpi.engineGenerateSeed.

Returns the given number of seed bytes. This call may be used to seed other random number generators.

Parameters
numBytes:int

the number of seed bytes to generate.

Returns:byte[]

the seed bytes.

engineNextBytesback to summary
protected void engineNextBytes(byte[] bytes)

Implements abstract java.security.SecureRandomSpi.engineNextBytes.

Doc from java.security.SecureRandomSpi.engineNextBytes.

Generates a user-specified number of random bytes.

Some random number generators can only generate a limited amount of random bytes per invocation. If the size of bytes is greater than this limit, the implementation should invoke its generation process multiple times to completely fill the buffer before returning from this method.

Parameters
bytes:byte[]

the array to be filled in with random bytes.

engineSetSeedback to summary
protected void engineSetSeed(byte[] bytes)

Implements abstract java.security.SecureRandomSpi.engineSetSeed.

Doc from java.security.SecureRandomSpi.engineSetSeed.

Reseeds this random object with the given seed. The seed supplements, rather than replaces, the existing seed. Thus, repeated calls are guaranteed never to reduce randomness.

Parameters
bytes:byte[]

the seed.

org.bouncycastle.jcajce.provider.drbg back to summary

private Class DRBG.HybridEntropySource

extends Object
implements EntropySource
Class Inheritance
  • java.lang.Object
  • org.bouncycastle.jcajce.provider.drbg.DRBG.HybridEntropySource
All Implemented Interfaces
org.bouncycastle.crypto.prng.EntropySource

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private final byte[]
private final int
private final SP800SecureRandom
private final DRBG.HybridEntropySource.SignallingEntropySource
private final AtomicInteger
private final AtomicBoolean

Constructor Summary

AccessConstructor and Description
pack-priv
HybridEntropySource(final EntropyDaemon entropyDaemon, final int bitsRequired)

Method Summary

Modifier and TypeMethod and Description
public int
entropySize()

Implements org.bouncycastle.crypto.prng.EntropySource.entropySize.

Return the number of bits of entropy this source can produce.
public byte[]
getEntropy()

Implements org.bouncycastle.crypto.prng.EntropySource.getEntropy.

Return a byte array of entropy.
public boolean
isPredictionResistant()

Implements org.bouncycastle.crypto.prng.EntropySource.isPredictionResistant.

Return whether or not this entropy source is regarded as prediction resistant.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

additionalInputback to summary
private final byte[] additionalInput
bytesRequiredback to summary
private final int bytesRequired
drbgback to summary
private final SP800SecureRandom drbg
entropySourceback to summary
private final DRBG.HybridEntropySource.SignallingEntropySource entropySource
samplesback to summary
private final AtomicInteger samples
seedAvailableback to summary
private final AtomicBoolean seedAvailable

Constructor Detail

HybridEntropySourceback to summary
pack-priv HybridEntropySource(final EntropyDaemon entropyDaemon, final int bitsRequired)

Method Detail

entropySizeback to summary
public int entropySize()

Implements org.bouncycastle.crypto.prng.EntropySource.entropySize.

Doc from org.bouncycastle.crypto.prng.EntropySource.entropySize.

Return the number of bits of entropy this source can produce.

Returns:int

size in bits of the return value of getEntropy.

getEntropyback to summary
public byte[] getEntropy()

Implements org.bouncycastle.crypto.prng.EntropySource.getEntropy.

Doc from org.bouncycastle.crypto.prng.EntropySource.getEntropy.

Return a byte array of entropy.

Returns:byte[]

entropy bytes.

isPredictionResistantback to summary
public boolean isPredictionResistant()

Implements org.bouncycastle.crypto.prng.EntropySource.isPredictionResistant.

Doc from org.bouncycastle.crypto.prng.EntropySource.isPredictionResistant.

Return whether or not this entropy source is regarded as prediction resistant.

Returns:boolean

true if it is, false otherwise.

org.bouncycastle.jcajce.provider.drbg back to summary

private Class DRBG.HybridEntropySource.SignallingEntropySource

extends Object
implements IncrementalEntropySource
Class Inheritance
  • java.lang.Object
  • org.bouncycastle.jcajce.provider.drbg.DRBG.HybridEntropySource.SignallingEntropySource
All Implemented Interfaces
org.bouncycastle.jcajce.provider.drbg.IncrementalEntropySource, org.bouncycastle.crypto.prng.EntropySource

Field Summary

Modifier and TypeField and Description
private final int
private final AtomicReference<V>
private final EntropyDaemon
private final IncrementalEntropySource
private final AtomicBoolean
private final AtomicBoolean

Constructor Summary

AccessConstructor and Description
pack-priv
SignallingEntropySource(EntropyDaemon entropyDaemon, AtomicBoolean seedAvailable, EntropySourceProvider baseRandom, int bitsRequired)

Method Summary

Modifier and TypeMethod and Description
public int
entropySize()

Implements org.bouncycastle.crypto.prng.EntropySource.entropySize.

Return the number of bits of entropy this source can produce.
public byte[]
getEntropy()

Implements org.bouncycastle.crypto.prng.EntropySource.getEntropy.

Return a byte array of entropy.
public byte[]
getEntropy(long
time in milliseconds to pause in build up seed.
pause
)

Implements org.bouncycastle.jcajce.provider.drbg.IncrementalEntropySource.getEntropy.

Pause allows for a gap between fetches.
public boolean
isPredictionResistant()

Implements org.bouncycastle.crypto.prng.EntropySource.isPredictionResistant.

Return whether or not this entropy source is regarded as prediction resistant.
pack-priv void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

byteLengthback to summary
private final int byteLength
entropyback to summary
private final AtomicReference<V> entropy
entropyDaemonback to summary
private final EntropyDaemon entropyDaemon
entropySourceback to summary
private final IncrementalEntropySource entropySource
scheduledback to summary
private final AtomicBoolean scheduled
seedAvailableback to summary
private final AtomicBoolean seedAvailable

Constructor Detail

SignallingEntropySourceback to summary
pack-priv SignallingEntropySource(EntropyDaemon entropyDaemon, AtomicBoolean seedAvailable, EntropySourceProvider baseRandom, int bitsRequired)

Method Detail

entropySizeback to summary
public int entropySize()

Implements org.bouncycastle.crypto.prng.EntropySource.entropySize.

Doc from org.bouncycastle.crypto.prng.EntropySource.entropySize.

Return the number of bits of entropy this source can produce.

Returns:int

size in bits of the return value of getEntropy.

getEntropyback to summary
public byte[] getEntropy()

Implements org.bouncycastle.crypto.prng.EntropySource.getEntropy.

Doc from org.bouncycastle.crypto.prng.EntropySource.getEntropy.

Return a byte array of entropy.

Returns:byte[]

entropy bytes.

getEntropyback to summary
public byte[] getEntropy(long pause) throws InterruptedException

Implements org.bouncycastle.jcajce.provider.drbg.IncrementalEntropySource.getEntropy.

Doc from org.bouncycastle.jcajce.provider.drbg.IncrementalEntropySource.getEntropy.

Pause allows for a gap between fetches. We only want this after we've initialised.

Parameters
pause:long

time in milliseconds to pause in build up seed.

Returns:byte[]

the resulting seed

isPredictionResistantback to summary
public boolean isPredictionResistant()

Implements org.bouncycastle.crypto.prng.EntropySource.isPredictionResistant.

Doc from org.bouncycastle.crypto.prng.EntropySource.isPredictionResistant.

Return whether or not this entropy source is regarded as prediction resistant.

Returns:boolean

true if it is, false otherwise.

scheduleback to summary
pack-priv void schedule()
org.bouncycastle.jcajce.provider.drbg back to summary

public Class DRBG.Mappings

extends AsymmetricAlgorithmProvider
Class Inheritance

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
Inherited from org.bouncycastle.jcajce.provider.util.AsymmetricAlgorithmProvider:
addCipherAlgorithmaddKeyFactoryAlgorithmaddKeyGeneratorAlgorithmaddKeyPairGeneratorAlgorithmaddSignatureAlgorithmaddSignatureAlgorithmaddSignatureAlgorithmaddSignatureAlgorithmaddSignatureAliasregisterKeyFactoryOidregisterOidregisterOidAlgorithmParameterGeneratorregisterOidAlgorithmParameters

Constructor Detail

Mappingsback to summary
public Mappings()

Method Detail

configureback to summary
public void configure(ConfigurableProvider provider)

Implements abstract org.bouncycastle.jcajce.provider.util.AlgorithmProvider.configure.

org.bouncycastle.jcajce.provider.drbg back to summary

public Class DRBG.NonceAndIV

extends SecureRandomSpi
Class Inheritance

Field Summary

Modifier and TypeField and Description
private static final SecureRandom

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected byte[]
engineGenerateSeed(int
the number of seed bytes to generate.
numBytes
)

Implements abstract java.security.SecureRandomSpi.engineGenerateSeed.

Returns the given number of seed bytes.
protected void
engineNextBytes(byte[]
the array to be filled in with random bytes.
bytes
)

Implements abstract java.security.SecureRandomSpi.engineNextBytes.

Generates a user-specified number of random bytes.
protected void
engineSetSeed(byte[]
the seed.
bytes
)

Implements abstract java.security.SecureRandomSpi.engineSetSeed.

Reseeds this random object with the given seed.
Inherited from java.security.SecureRandomSpi:
engineGetParametersengineNextBytesengineReseedtoString

Field Detail

randomback to summary
private static final SecureRandom random

Constructor Detail

NonceAndIVback to summary
public NonceAndIV()

Method Detail

engineGenerateSeedback to summary
protected byte[] engineGenerateSeed(int numBytes)

Implements abstract java.security.SecureRandomSpi.engineGenerateSeed.

Doc from java.security.SecureRandomSpi.engineGenerateSeed.

Returns the given number of seed bytes. This call may be used to seed other random number generators.

Parameters
numBytes:int

the number of seed bytes to generate.

Returns:byte[]

the seed bytes.

engineNextBytesback to summary
protected void engineNextBytes(byte[] bytes)

Implements abstract java.security.SecureRandomSpi.engineNextBytes.

Doc from java.security.SecureRandomSpi.engineNextBytes.

Generates a user-specified number of random bytes.

Some random number generators can only generate a limited amount of random bytes per invocation. If the size of bytes is greater than this limit, the implementation should invoke its generation process multiple times to completely fill the buffer before returning from this method.

Parameters
bytes:byte[]

the array to be filled in with random bytes.

engineSetSeedback to summary
protected void engineSetSeed(byte[] bytes)

Implements abstract java.security.SecureRandomSpi.engineSetSeed.

Doc from java.security.SecureRandomSpi.engineSetSeed.

Reseeds this random object with the given seed. The seed supplements, rather than replaces, the existing seed. Thus, repeated calls are guaranteed never to reduce randomness.

Parameters
bytes:byte[]

the seed.

org.bouncycastle.jcajce.provider.drbg back to summary

private Class DRBG.OneShotHybridEntropySource

extends Object
implements EntropySource
Class Inheritance
  • java.lang.Object
  • org.bouncycastle.jcajce.provider.drbg.DRBG.OneShotHybridEntropySource
All Implemented Interfaces
org.bouncycastle.crypto.prng.EntropySource

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private final byte[]
private final int
private final SP800SecureRandom
private final DRBG.OneShotHybridEntropySource.OneShotSignallingEntropySource
private final AtomicInteger
private final AtomicBoolean

Constructor Summary

AccessConstructor and Description
pack-priv
OneShotHybridEntropySource(final int bitsRequired)

Method Summary

Modifier and TypeMethod and Description
public int
entropySize()

Implements org.bouncycastle.crypto.prng.EntropySource.entropySize.

Return the number of bits of entropy this source can produce.
public byte[]
getEntropy()

Implements org.bouncycastle.crypto.prng.EntropySource.getEntropy.

Return a byte array of entropy.
public boolean
isPredictionResistant()

Implements org.bouncycastle.crypto.prng.EntropySource.isPredictionResistant.

Return whether or not this entropy source is regarded as prediction resistant.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

additionalInputback to summary
private final byte[] additionalInput
bytesRequiredback to summary
private final int bytesRequired
drbgback to summary
private final SP800SecureRandom drbg
entropySourceback to summary
private final DRBG.OneShotHybridEntropySource.OneShotSignallingEntropySource entropySource
samplesback to summary
private final AtomicInteger samples
seedAvailableback to summary
private final AtomicBoolean seedAvailable

Constructor Detail

OneShotHybridEntropySourceback to summary
pack-priv OneShotHybridEntropySource(final int bitsRequired)

Method Detail

entropySizeback to summary
public int entropySize()

Implements org.bouncycastle.crypto.prng.EntropySource.entropySize.

Doc from org.bouncycastle.crypto.prng.EntropySource.entropySize.

Return the number of bits of entropy this source can produce.

Returns:int

size in bits of the return value of getEntropy.

getEntropyback to summary
public byte[] getEntropy()

Implements org.bouncycastle.crypto.prng.EntropySource.getEntropy.

Doc from org.bouncycastle.crypto.prng.EntropySource.getEntropy.

Return a byte array of entropy.

Returns:byte[]

entropy bytes.

isPredictionResistantback to summary
public boolean isPredictionResistant()

Implements org.bouncycastle.crypto.prng.EntropySource.isPredictionResistant.

Doc from org.bouncycastle.crypto.prng.EntropySource.isPredictionResistant.

Return whether or not this entropy source is regarded as prediction resistant.

Returns:boolean

true if it is, false otherwise.

org.bouncycastle.jcajce.provider.drbg back to summary

private Class DRBG.OneShotHybridEntropySource.OneShotSignallingEntropySource

extends Object
implements IncrementalEntropySource
Class Inheritance
  • java.lang.Object
  • org.bouncycastle.jcajce.provider.drbg.DRBG.OneShotHybridEntropySource.OneShotSignallingEntropySource
All Implemented Interfaces
org.bouncycastle.jcajce.provider.drbg.IncrementalEntropySource, org.bouncycastle.crypto.prng.EntropySource

Field Summary

Modifier and TypeField and Description
private final int
private final AtomicReference<V>
private final IncrementalEntropySource
private final AtomicBoolean
private final AtomicBoolean

Constructor Summary

AccessConstructor and Description
pack-priv
OneShotSignallingEntropySource(AtomicBoolean seedAvailable, EntropySourceProvider baseRandom, int bitsRequired)

Method Summary

Modifier and TypeMethod and Description
public int
entropySize()

Implements org.bouncycastle.crypto.prng.EntropySource.entropySize.

Return the number of bits of entropy this source can produce.
public byte[]
getEntropy()

Implements org.bouncycastle.crypto.prng.EntropySource.getEntropy.

Return a byte array of entropy.
public byte[]
getEntropy(long
time in milliseconds to pause in build up seed.
pause
)

Implements org.bouncycastle.jcajce.provider.drbg.IncrementalEntropySource.getEntropy.

Pause allows for a gap between fetches.
public boolean
isPredictionResistant()

Implements org.bouncycastle.crypto.prng.EntropySource.isPredictionResistant.

Return whether or not this entropy source is regarded as prediction resistant.
pack-priv void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

byteLengthback to summary
private final int byteLength
entropyback to summary
private final AtomicReference<V> entropy
entropySourceback to summary
private final IncrementalEntropySource entropySource
scheduledback to summary
private final AtomicBoolean scheduled
seedAvailableback to summary
private final AtomicBoolean seedAvailable

Constructor Detail

OneShotSignallingEntropySourceback to summary
pack-priv OneShotSignallingEntropySource(AtomicBoolean seedAvailable, EntropySourceProvider baseRandom, int bitsRequired)

Method Detail

entropySizeback to summary
public int entropySize()

Implements org.bouncycastle.crypto.prng.EntropySource.entropySize.

Doc from org.bouncycastle.crypto.prng.EntropySource.entropySize.

Return the number of bits of entropy this source can produce.

Returns:int

size in bits of the return value of getEntropy.

getEntropyback to summary
public byte[] getEntropy()

Implements org.bouncycastle.crypto.prng.EntropySource.getEntropy.

Doc from org.bouncycastle.crypto.prng.EntropySource.getEntropy.

Return a byte array of entropy.

Returns:byte[]

entropy bytes.

getEntropyback to summary
public byte[] getEntropy(long pause) throws InterruptedException

Implements org.bouncycastle.jcajce.provider.drbg.IncrementalEntropySource.getEntropy.

Doc from org.bouncycastle.jcajce.provider.drbg.IncrementalEntropySource.getEntropy.

Pause allows for a gap between fetches. We only want this after we've initialised.

Parameters
pause:long

time in milliseconds to pause in build up seed.

Returns:byte[]

the resulting seed

isPredictionResistantback to summary
public boolean isPredictionResistant()

Implements org.bouncycastle.crypto.prng.EntropySource.isPredictionResistant.

Doc from org.bouncycastle.crypto.prng.EntropySource.isPredictionResistant.

Return whether or not this entropy source is regarded as prediction resistant.

Returns:boolean

true if it is, false otherwise.

scheduleback to summary
pack-priv void schedule()
org.bouncycastle.jcajce.provider.drbg back to summary

private Class DRBG.URLSeededEntropySourceProvider

extends Object
implements EntropySourceProvider
Class Inheritance
  • java.lang.Object
  • org.bouncycastle.jcajce.provider.drbg.DRBG.URLSeededEntropySourceProvider
All Implemented Interfaces
org.bouncycastle.crypto.prng.EntropySourceProvider

Field Summary

Modifier and TypeField and Description
private final InputStream

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public EntropySource
private int
privilegedRead(final byte[] data, final int off, final int len)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

seedStreamback to summary
private final InputStream seedStream

Constructor Detail

URLSeededEntropySourceProviderback to summary
pack-priv URLSeededEntropySourceProvider(final URL url)

Method Detail

getback to summary
public EntropySource get(final int bitsRequired)

Implements org.bouncycastle.crypto.prng.EntropySourceProvider.get.

privilegedReadback to summary
private int privilegedRead(final byte[] data, final int off, final int len)