Package com.wolfssl.wolfcrypt
Class Fips
java.lang.Object
com.wolfssl.wolfcrypt.WolfObject
com.wolfssl.wolfcrypt.Fips
public class Fips extends WolfObject
Main wrapper for the native WolfCrypt implementation.
- Version:
- 1.0, February 2015
- Author:
- Moisés Guimarães
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
Fips.ErrorCallback
-
Field Summary
Fields Modifier and Type Field Description static boolean
enabled
static int
fipsVersion
-
Method Summary
Modifier and Type Method Description static int
AesCbcDecrypt_fips(Aes aes, byte[] out, byte[] in, long sz)
Performs Aes Cbc Decryption.static int
AesCbcDecrypt_fips(Aes aes, java.nio.ByteBuffer out, java.nio.ByteBuffer in, long sz)
Performs Aes Cbc Decryption.static int
AesCbcEncrypt_fips(Aes aes, byte[] out, byte[] in, long sz)
Performs Aes Cbc Encryption.static int
AesCbcEncrypt_fips(Aes aes, java.nio.ByteBuffer out, java.nio.ByteBuffer in, long sz)
Performs Aes Cbc Encryption.static int
AesGcmDecrypt_fips(Aes aes, byte[] out, byte[] in, long sz, byte[] iv, long ivSz, byte[] authTag, long authTagSz, byte[] authIn, long authInSz)
Performs aes GCM Decryption.static int
AesGcmDecrypt_fips(Aes aes, java.nio.ByteBuffer out, java.nio.ByteBuffer in, long sz, java.nio.ByteBuffer iv, long ivSz, java.nio.ByteBuffer authTag, long authTagSz, java.nio.ByteBuffer authIn, long authInSz)
Performs aes GCM Decryption.static int
AesGcmEncrypt_fips(Aes aes, byte[] out, byte[] in, long sz, byte[] iv, long ivSz, byte[] authTag, long authTagSz, byte[] authIn, long authInSz)
Performs aes GCM Encryption.static int
AesGcmEncrypt_fips(Aes aes, java.nio.ByteBuffer out, java.nio.ByteBuffer in, long sz, java.nio.ByteBuffer iv, long ivSz, java.nio.ByteBuffer authTag, long authTagSz, java.nio.ByteBuffer authIn, long authInSz)
Performs aes GCM Encryption.static int
AesGcmSetKey_fips(Aes aes, byte[] userKey, long keylen)
Initializes Aes object for GCM mode with key.static int
AesGcmSetKey_fips(Aes aes, java.nio.ByteBuffer userKey, long keylen)
Initializes Aes object for GCM mode with key.static int
AesSetIV_fips(Aes aes, byte[] iv)
Initializes Aes object with iv.static int
AesSetIV_fips(Aes aes, java.nio.ByteBuffer iv)
Initializes Aes object with iv.static int
AesSetKey_fips(Aes aes, byte[] userKey, long keylen, byte[] iv, int dir)
Initializes Aes object for CBC mode with key and iv.static int
AesSetKey_fips(Aes aes, java.nio.ByteBuffer userKey, long keylen, java.nio.ByteBuffer iv, int dir)
Initializes Aes object for CBC mode with key and iv.static int
Des3_CbcDecrypt_fips(Des3 des, byte[] out, byte[] in, long sz)
Performs des3 CBC Decryption.static int
Des3_CbcDecrypt_fips(Des3 des, java.nio.ByteBuffer out, java.nio.ByteBuffer in, long sz)
Performs des3 CBC Decryption.static int
Des3_CbcEncrypt_fips(Des3 des, byte[] out, byte[] in, long sz)
Performs Des3 CBC Encryption.static int
Des3_CbcEncrypt_fips(Des3 des, java.nio.ByteBuffer out, java.nio.ByteBuffer in, long sz)
Performs Des3 CBC Encryption.static int
Des3_SetIV_fips(Des3 des, byte[] iv)
Initializes Des3 object with iv.static int
Des3_SetIV_fips(Des3 des, java.nio.ByteBuffer iv)
Initializes Des3 object with iv.static int
Des3_SetKey_fips(Des3 des, byte[] userKey, byte[] iv, int dir)
Initializes Des3 object for CBC mode with key and iv.static int
Des3_SetKey_fips(Des3 des, java.nio.ByteBuffer userKey, java.nio.ByteBuffer iv, int dir)
Initializes Des3 object for CBC mode with key and iv.static int
DhAgree(Dh key, byte[] agree, long[] agreeSz, byte[] priv, long privSz, byte[] otherPub, long pubSz)
Creates the agreement agree of size agreeSz using Dh key private priv of size privSz and peer’s public key otherPub of size pubSz.static int
DhAgree(Dh key, java.nio.ByteBuffer agree, long[] agreeSz, java.nio.ByteBuffer priv, long privSz, java.nio.ByteBuffer otherPub, long pubSz)
Creates the agreement agree of size agreeSz using Dh key private priv of size privSz and peer’s public key otherPub of size pubSz.static int
DhGenerateKeyPair(Dh key, Rng rng, byte[] priv, long[] privSz, byte[] pub, long[] pubSz)
Generates the public part pub of size pubSz, private part priv of size privSz using rng for Dh key.static int
DhGenerateKeyPair(Dh key, Rng rng, java.nio.ByteBuffer priv, long[] privSz, java.nio.ByteBuffer pub, long[] pubSz)
Generates the public part pub of size pubSz, private part priv of size privSz using rng for Dh key.static int
DhKeyDecode(byte[] input, long[] inOutIdx, Dh key, long inSz)
Decodes the DER group parameters from buffer input starting at index inOutIdx of size inSz into Dh key.static int
DhKeyDecode(java.nio.ByteBuffer input, long[] inOutIdx, Dh key, long inSz)
Decodes the DER group parameters from buffer input starting at index inOutIdx of size inSz into Dh key.static int
DhParamsLoad(byte[] input, long inSz, byte[] p, long[] pInOutSz, byte[] g, long[] gInOutSz)
Loads the Dh group parameters.static int
DhParamsLoad(java.nio.ByteBuffer input, long inSz, java.nio.ByteBuffer p, long[] pInOutSz, java.nio.ByteBuffer g, long[] gInOutSz)
Loads the Dh group parameters.static int
DhSetKey(Dh key, byte[] p, long pSz, byte[] g, long gSz)
Sets the group parameters for the Dh key from the unsigned binary inputs p of size pSz and g of size gSz.static int
DhSetKey(Dh key, java.nio.ByteBuffer p, long pSz, java.nio.ByteBuffer g, long gSz)
Sets the group parameters for the Dh key from the unsigned binary inputs p of size pSz and g of size gSz.static int
ecc_export_x963(Ecc key, byte[] out, long[] outLen)
Exports the public ecc key into out of length outLen in x963 format.static int
ecc_export_x963(Ecc key, java.nio.ByteBuffer out, long[] outLen)
Exports the public ecc key into out of length outLen in x963 format.static void
ecc_free(Ecc key)
Releases Ecc object's resources.static int
ecc_import_x963(byte[] in, long inLen, Ecc key)
Imports the public ecc key from in of length inLen in x963 format.static int
ecc_import_x963(java.nio.ByteBuffer in, long inLen, Ecc key)
Imports the public ecc key from in of length inLen in x963 format.static int
ecc_init(Ecc key)
Initializes Ecc object for use.static int
ecc_make_key(Rng rng, int keysize, Ecc key)
Generates a new ecc key of size keysize using rng.static int
ecc_shared_secret(Ecc private_key, Ecc public_key, byte[] out, long[] outlen)
Creates the shared secret out of size outlen using ecc private_key and the peer’s ecc public_key.static int
ecc_shared_secret(Ecc private_key, Ecc public_key, java.nio.ByteBuffer out, long[] outlen)
Creates the shared secret out of size outlen using ecc private_key and the peer’s ecc public_key.static void
FreeDhKey(Dh key)
Releases Dh object's resources.static int
FreeRng_fips(Rng rng)
Releases RNG object's resources and zeros out state.static int
FreeRsaKey_fips(Rsa key)
Releases Rsa object's resources.static int
HmacFinal_fips(Hmac hmac, byte[] hash)
Outputs Hmac digest to hash.static int
HmacFinal_fips(Hmac hmac, java.nio.ByteBuffer hash)
Outputs Hmac digest to hash.static int
HmacSetKey_fips(Hmac hmac, int type, byte[] key, long keySz)
Initializes Hmac object with type and key.static int
HmacSetKey_fips(Hmac hmac, int type, java.nio.ByteBuffer key, long keySz)
Initializes Hmac object with type and key.static int
HmacUpdate_fips(Hmac hmac, byte[] data, long len)
Updates Hmac object with data.static int
HmacUpdate_fips(Hmac hmac, java.nio.ByteBuffer data, long len)
Updates Hmac object with data.static void
InitDhKey(Dh key)
Initializes Dh object for use.static int
InitMd5(Md5 md5)
Initializes Md5 object for use.static int
InitRng_fips(Rng rng)
Initializes RNG object's resources and state.static int
InitRsaKey_fips(Rsa key, java.nio.ByteBuffer heap)
Initializes Rsa object for use with optional heap hint p.static int
InitSha_fips(Sha sha)
Initializes Sha object for use.static int
InitSha256_fips(Sha256 sha)
Initializes Sha256 object for use.static int
InitSha384_fips(Sha384 sha)
Initializes Sha384 object for use.static int
InitSha512_fips(Sha512 sha)
Initializes Sha512 object for use.static int
Md5Final(Md5 md5, byte[] hash)
Outputs Md5 digest to hash.static int
Md5Final(Md5 md5, java.nio.ByteBuffer hash)
Outputs Md5 digest to hash.static int
Md5Update(Md5 md5, byte[] data, long len)
Updates Md5 object with data.static int
Md5Update(Md5 md5, java.nio.ByteBuffer data, long len)
Updates Md5 object with data.static int
RNG_GenerateBlock_fips(Rng rng, byte[] buf, long bufSz)
Outputs block of random data from RNG object.static int
RNG_GenerateBlock_fips(Rng rng, java.nio.ByteBuffer buf, long bufSz)
Outputs block of random data from RNG object.static int
RNG_HealthTest_fips(int reseed, byte[] entropyA, long entropyASz, byte[] entropyB, long entropyBSz, byte[] output, long outputSz)
When reseed is 0, tests the output of a temporary instance of an RNG against the expected output of size in bytes outputSz using the seed buffer entropyA of size in bytes entropyASz, where entropyB and entropyBSz are ignored.static int
RNG_HealthTest_fips(int reseed, java.nio.ByteBuffer entropyA, long entropyASz, java.nio.ByteBuffer entropyB, long entropyBSz, java.nio.ByteBuffer output, long outputSz)
When reseed is 0, tests the output of a temporary instance of an RNG against the expected output of size in bytes outputSz using the seed buffer entropyA of size in bytes entropyASz, where entropyB and entropyBSz are ignored.static int
RsaEncryptSize_fips(Rsa key)
Retrieves Rsa Output Size.static int
RsaPrivateDecrypt_fips(byte[] in, long inLen, byte[] out, long outLen, Rsa key)
Performs Rsa Private Decryption.static int
RsaPrivateDecrypt_fips(java.nio.ByteBuffer in, long inLen, java.nio.ByteBuffer out, long outLen, Rsa key)
Performs Rsa Private Decryption.static int
RsaPrivateKeyDecode_fips(byte[] input, long[] inOutIdx, Rsa key, long inSz)
Decodes Rsa Private Key from buffer.static int
RsaPrivateKeyDecode_fips(java.nio.ByteBuffer input, long[] inOutIdx, Rsa key, long inSz)
Decodes Rsa Private Key from buffer.static int
RsaPublicEncrypt_fips(byte[] in, long inLen, byte[] out, long outLen, Rsa key, Rng rng)
Performs Rsa Public Encryption.static int
RsaPublicEncrypt_fips(java.nio.ByteBuffer in, long inLen, java.nio.ByteBuffer out, long outLen, Rsa key, Rng rng)
Performs Rsa Public Encryption.static int
RsaPublicKeyDecode_fips(byte[] input, long[] inOutIdx, Rsa key, long inSz)
Decodes Rsa Public Key from buffer.static int
RsaPublicKeyDecode_fips(java.nio.ByteBuffer input, long[] inOutIdx, Rsa key, long inSz)
Decodes Rsa Public Key from buffer.static int
RsaSSL_Sign_fips(byte[] in, long inLen, byte[] out, long outLen, Rsa key, Rng rng)
Performs Rsa Signing Operation.static int
RsaSSL_Sign_fips(java.nio.ByteBuffer in, long inLen, java.nio.ByteBuffer out, long outLen, Rsa key, Rng rng)
Performs Rsa Signing Operation.static int
RsaSSL_Verify_fips(byte[] in, long inLen, byte[] out, long outLen, Rsa key)
Performs Rsa Signature Verification.static int
RsaSSL_Verify_fips(java.nio.ByteBuffer in, long inLen, java.nio.ByteBuffer out, long outLen, Rsa key)
Performs Rsa Signature Verification.static int
Sha256Final_fips(Sha256 sha, byte[] hash)
Outputs Sha256 digest to hash.static int
Sha256Final_fips(Sha256 sha, java.nio.ByteBuffer hash)
Outputs Sha256 digest to hash.static int
Sha256Update_fips(Sha256 sha, byte[] data, long len)
Updates Sha256 object with data.static int
Sha256Update_fips(Sha256 sha, java.nio.ByteBuffer data, long len)
Updates Sha256 object with data.static int
Sha384Final_fips(Sha384 sha, byte[] hash)
Outputs Sha384 digest to hash.static int
Sha384Final_fips(Sha384 sha, java.nio.ByteBuffer hash)
Outputs Sha384 digest to hash.static int
Sha384Update_fips(Sha384 sha, byte[] data, long len)
Updates Sha384 object with data.static int
Sha384Update_fips(Sha384 sha, java.nio.ByteBuffer data, long len)
Updates Sha384 object with data.static int
Sha512Final_fips(Sha512 sha, byte[] hash)
Outputs Sha512 digest to hash.static int
Sha512Final_fips(Sha512 sha, java.nio.ByteBuffer hash)
Outputs Sha512 digest to hash.static int
Sha512Update_fips(Sha512 sha, byte[] data, long len)
Updates Sha512 object with data.static int
Sha512Update_fips(Sha512 sha, java.nio.ByteBuffer data, long len)
Updates Sha512 object with data.static int
ShaFinal_fips(Sha sha, byte[] hash)
Outputs Sha digest to hash.static int
ShaFinal_fips(Sha sha, java.nio.ByteBuffer hash)
Outputs Sha digest to hash.static int
ShaUpdate_fips(Sha sha, byte[] data, long len)
Updates Sha object with data.static int
ShaUpdate_fips(Sha sha, java.nio.ByteBuffer data, long len)
Updates Sha object with data.static java.lang.String
wolfCrypt_GetCoreHash_fips()
The current inCore hash of the wolfCrypt fips code.static int
wolfCrypt_GetStatus_fips()
static void
wolfCrypt_SetCb_fips(Fips.ErrorCallback callback)
Sets an callback class for handling fips errors.static int
wolfCrypt_SetStatus_fips(int status)
Sets the fips module status.
-
Field Details
-
enabled
public static final boolean enabled -
fipsVersion
public static final int fipsVersion
-
-
Method Details
-
wolfCrypt_SetCb_fips
Sets an callback class for handling fips errors.- Parameters:
callback
- the callback class.
-
wolfCrypt_GetCoreHash_fips
public static java.lang.String wolfCrypt_GetCoreHash_fips()The current inCore hash of the wolfCrypt fips code.- Returns:
- current inCore hash.
-
AesSetKey_fips
public static int AesSetKey_fips(Aes aes, java.nio.ByteBuffer userKey, long keylen, java.nio.ByteBuffer iv, int dir)Initializes Aes object for CBC mode with key and iv.- Parameters:
aes
- the Aes object.userKey
- the key to be set.keylen
- the key length.iv
- the initialization vector (optional).dir
- the direction (encryption|decryption).- Returns:
- 0 on success, < 0 on error.
-
AesSetKey_fips
Initializes Aes object for CBC mode with key and iv.- Parameters:
aes
- the Aes object.userKey
- the key to be set.keylen
- the key length.iv
- the initialization vector (optional).dir
- the direction (encryption|decryption).- Returns:
- 0 on success, < 0 on error.
-
AesSetIV_fips
Initializes Aes object with iv.- Parameters:
aes
- the Aes object.iv
- the initialization vector.- Returns:
- 0 on success, < 0 on error.
-
AesSetIV_fips
Initializes Aes object with iv.- Parameters:
aes
- the Aes object.iv
- the initialization vector.- Returns:
- 0 on success, < 0 on error.
-
AesCbcEncrypt_fips
public static int AesCbcEncrypt_fips(Aes aes, java.nio.ByteBuffer out, java.nio.ByteBuffer in, long sz)Performs Aes Cbc Encryption.- Parameters:
aes
- the Aes object.out
- the output buffer.in
- the input buffer.sz
- the input length.- Returns:
- 0 on success, < 0 on error.
-
AesCbcEncrypt_fips
Performs Aes Cbc Encryption.- Parameters:
aes
- the Aes object.out
- the output buffer.in
- the input buffer.sz
- the input length.- Returns:
- 0 on success, < 0 on error.
-
AesCbcDecrypt_fips
public static int AesCbcDecrypt_fips(Aes aes, java.nio.ByteBuffer out, java.nio.ByteBuffer in, long sz)Performs Aes Cbc Decryption.- Parameters:
aes
- the Aes object.out
- the output buffer.in
- the input buffer.sz
- the input length.- Returns:
- 0 on success, < 0 on error.
-
AesCbcDecrypt_fips
Performs Aes Cbc Decryption.- Parameters:
aes
- the Aes object.out
- the output buffer.in
- the input buffer.sz
- the input length.- Returns:
- 0 on success, < 0 on error.
-
AesGcmSetKey_fips
Initializes Aes object for GCM mode with key.- Parameters:
aes
- the Aes object.userKey
- the key to be set.keylen
- the key length.- Returns:
- 0 on success, < 0 on error.
-
AesGcmSetKey_fips
Initializes Aes object for GCM mode with key.- Parameters:
aes
- the Aes object.userKey
- the key to be set.keylen
- the key length.- Returns:
- 0 on success, < 0 on error.
-
AesGcmEncrypt_fips
public static int AesGcmEncrypt_fips(Aes aes, java.nio.ByteBuffer out, java.nio.ByteBuffer in, long sz, java.nio.ByteBuffer iv, long ivSz, java.nio.ByteBuffer authTag, long authTagSz, java.nio.ByteBuffer authIn, long authInSz)Performs aes GCM Encryption.- Parameters:
aes
- the Aes object.out
- the output buffer.in
- the input buffer.sz
- the input length.iv
- the initialization vector buffer.ivSz
- the initialization vector length.authTag
- the authTag buffer.authTagSz
- the authTag length.authIn
- the authIn buffer.authInSz
- the authIn length.- Returns:
- 0 on success, < 0 on error.
-
AesGcmEncrypt_fips
public static int AesGcmEncrypt_fips(Aes aes, byte[] out, byte[] in, long sz, byte[] iv, long ivSz, byte[] authTag, long authTagSz, byte[] authIn, long authInSz)Performs aes GCM Encryption.- Parameters:
aes
- the Aes object.out
- the output buffer.in
- the input buffer.sz
- the input length.iv
- the initialization vector buffer.ivSz
- the initialization vector length.authTag
- the authTag buffer.authTagSz
- the authTag length.authIn
- the authIn buffer.authInSz
- the authIn length.- Returns:
- 0 on success, < 0 on error.
-
AesGcmDecrypt_fips
public static int AesGcmDecrypt_fips(Aes aes, java.nio.ByteBuffer out, java.nio.ByteBuffer in, long sz, java.nio.ByteBuffer iv, long ivSz, java.nio.ByteBuffer authTag, long authTagSz, java.nio.ByteBuffer authIn, long authInSz)Performs aes GCM Decryption.- Parameters:
aes
- the Aes object.out
- the output buffer.in
- the input buffer.sz
- the input length.iv
- the initialization vector buffer.ivSz
- the initialization vector length.authTag
- the authTag buffer.authTagSz
- the authTag length.authIn
- the authIn buffer.authInSz
- the authIn length.- Returns:
- 0 on success, < 0 on error.
-
AesGcmDecrypt_fips
public static int AesGcmDecrypt_fips(Aes aes, byte[] out, byte[] in, long sz, byte[] iv, long ivSz, byte[] authTag, long authTagSz, byte[] authIn, long authInSz)Performs aes GCM Decryption.- Parameters:
aes
- the Aes object.out
- the output buffer.in
- the input buffer.sz
- the input length.iv
- the initialization vector buffer.ivSz
- the initialization vector length.authTag
- the authTag buffer.authTagSz
- the authTag length.authIn
- the authIn buffer.authInSz
- the authIn length.- Returns:
- 0 on success, < 0 on error.
-
Des3_SetKey_fips
public static int Des3_SetKey_fips(Des3 des, java.nio.ByteBuffer userKey, java.nio.ByteBuffer iv, int dir)Initializes Des3 object for CBC mode with key and iv.- Parameters:
des
- the Des3 object.userKey
- the key to be set.iv
- the initialization vector (optional).dir
- the direction (encryption|decryption).- Returns:
- 0 on success, < 0 on error.
-
Des3_SetKey_fips
Initializes Des3 object for CBC mode with key and iv.- Parameters:
des
- the Des3 object.userKey
- the key to be set.iv
- the initialization vector (optional).dir
- the direction (encryption|decryption).- Returns:
- 0 on success, < 0 on error.
-
Des3_SetIV_fips
Initializes Des3 object with iv.- Parameters:
des
- the Des3 object.iv
- the initialization vector.- Returns:
- 0 on success, < 0 on error.
-
Des3_SetIV_fips
Initializes Des3 object with iv.- Parameters:
des
- the Des3 object.iv
- the initialization vector.- Returns:
- 0 on success, < 0 on error.
-
Des3_CbcEncrypt_fips
public static int Des3_CbcEncrypt_fips(Des3 des, java.nio.ByteBuffer out, java.nio.ByteBuffer in, long sz)Performs Des3 CBC Encryption.- Parameters:
des
- the Des3 object.out
- the output buffer.in
- the input buffer.sz
- the input length.- Returns:
- 0 on success, < 0 on error.
-
Des3_CbcEncrypt_fips
Performs Des3 CBC Encryption.- Parameters:
des
- the Des3 object.out
- the output buffer.in
- the input buffer.sz
- the input length.- Returns:
- 0 on success, < 0 on error.
-
Des3_CbcDecrypt_fips
public static int Des3_CbcDecrypt_fips(Des3 des, java.nio.ByteBuffer out, java.nio.ByteBuffer in, long sz)Performs des3 CBC Decryption.- Parameters:
des
- the Des3 object.out
- the output buffer.in
- the input buffer.sz
- the input length.- Returns:
- 0 on success, < 0 on error.
-
Des3_CbcDecrypt_fips
Performs des3 CBC Decryption.- Parameters:
des
- the Des3 object.out
- the output buffer.in
- the input buffer.sz
- the input length.- Returns:
- 0 on success, < 0 on error.
-
HmacSetKey_fips
Initializes Hmac object with type and key.- Parameters:
hmac
- the Hmac object.type
- the digest id.key
- the key buffer.keySz
- the key length.- Returns:
- 0 on success, < 0 on error.
-
HmacSetKey_fips
Initializes Hmac object with type and key.- Parameters:
hmac
- the Hmac object.type
- the digest id.key
- the key buffer.keySz
- the key length.- Returns:
- 0 on success, < 0 on error.
-
HmacUpdate_fips
Updates Hmac object with data.- Parameters:
hmac
- the Hmac object.data
- the input buffer.len
- the input length.- Returns:
- 0 on success, < 0 on error.
-
HmacUpdate_fips
Updates Hmac object with data.- Parameters:
hmac
- the Hmac object.data
- the input buffer.len
- the input length.- Returns:
- 0 on success, < 0 on error.
-
HmacFinal_fips
Outputs Hmac digest to hash.- Parameters:
hmac
- the Hmac object.hash
- the output buffer.- Returns:
- 0 on success, < 0 on error.
-
HmacFinal_fips
Outputs Hmac digest to hash.- Parameters:
hmac
- the Hmac object.hash
- the output buffer.- Returns:
- 0 on success, < 0 on error.
-
InitRng_fips
Initializes RNG object's resources and state. FreeRng_fips must be called for resources deallocation.- Parameters:
rng
- the RNG object.- Returns:
- 0 on success, < 0 on error.
-
FreeRng_fips
Releases RNG object's resources and zeros out state.- Parameters:
rng
- the RNG object.- Returns:
- 0 on success, < 0 on error. Also part of Zeroize Service.
-
RNG_GenerateBlock_fips
Outputs block of random data from RNG object.- Parameters:
rng
- the RNG object.buf
- the output buffer.bufSz
- the output length.- Returns:
- 0 on success, < 0 on error.
-
RNG_GenerateBlock_fips
Outputs block of random data from RNG object.- Parameters:
rng
- the RNG object.buf
- the output buffer.bufSz
- the output length.- Returns:
- 0 on success, < 0 on error.
-
RNG_HealthTest_fips
public static int RNG_HealthTest_fips(int reseed, java.nio.ByteBuffer entropyA, long entropyASz, java.nio.ByteBuffer entropyB, long entropyBSz, java.nio.ByteBuffer output, long outputSz)When reseed is 0, tests the output of a temporary instance of an RNG against the expected output of size in bytes outputSz using the seed buffer entropyA of size in bytes entropyASz, where entropyB and entropyBSz are ignored. When reseed is 1, the test also reseeds the temporary instance of the RNG with the seed buffer entropyB of size in bytes entropyBSz and then tests the RNG against the expected output of size in bytes outputSz.- Parameters:
reseed
- the reseed flag.entropyA
- the entropyA buffer.entropyASz
- the entropyA length.entropyB
- the entropyB buffer.entropyBSz
- the entropyB length.output
- the output buffer.outputSz
- the output length.- Returns:
- 0 on success, < 0 on error.
-
RNG_HealthTest_fips
public static int RNG_HealthTest_fips(int reseed, byte[] entropyA, long entropyASz, byte[] entropyB, long entropyBSz, byte[] output, long outputSz)When reseed is 0, tests the output of a temporary instance of an RNG against the expected output of size in bytes outputSz using the seed buffer entropyA of size in bytes entropyASz, where entropyB and entropyBSz are ignored. When reseed is 1, the test also reseeds the temporary instance of the RNG with the seed buffer entropyB of size in bytes entropyBSz and then tests the RNG against the expected output of size in bytes outputSz.- Parameters:
reseed
- the reseed flag.entropyA
- the entropyA buffer.entropyASz
- the entropyA length.entropyB
- the entropyB buffer.entropyBSz
- the entropyB length.output
- the output buffer.outputSz
- the output length.- Returns:
- 0 on success, < 0 on error.
-
InitRsaKey_fips
Initializes Rsa object for use with optional heap hint p. FreeRsaKey_fips must be called for resources deallocation.- Parameters:
key
- the Rsa object.heap
- the (optional) heap.- Returns:
- 0 on success, < 0 on error.
-
FreeRsaKey_fips
Releases Rsa object's resources.- Parameters:
key
- the Rsa object.- Returns:
- 0 on success, < 0 on error.
-
RsaSSL_Sign_fips
public static int RsaSSL_Sign_fips(java.nio.ByteBuffer in, long inLen, java.nio.ByteBuffer out, long outLen, Rsa key, Rng rng)Performs Rsa Signing Operation.- Parameters:
in
- the input buffer.inLen
- the input length.out
- the output buffer.outLen
- the output length.key
- the Rsa object.rng
- the random source for padding.- Returns:
- 0 on success, < 0 on error.
-
RsaSSL_Sign_fips
public static int RsaSSL_Sign_fips(byte[] in, long inLen, byte[] out, long outLen, Rsa key, Rng rng)Performs Rsa Signing Operation.- Parameters:
in
- the input buffer.inLen
- the input length.out
- the output buffer.outLen
- the output length.key
- the Rsa object.rng
- the random source for padding.- Returns:
- 0 on success, < 0 on error.
-
RsaSSL_Verify_fips
public static int RsaSSL_Verify_fips(java.nio.ByteBuffer in, long inLen, java.nio.ByteBuffer out, long outLen, Rsa key)Performs Rsa Signature Verification.- Parameters:
in
- the input buffer.inLen
- the input length.out
- the output buffer.outLen
- the output length.key
- the Rsa object.- Returns:
- 0 on success, < 0 on error.
-
RsaSSL_Verify_fips
Performs Rsa Signature Verification.- Parameters:
in
- the input buffer.inLen
- the input length.out
- the output buffer.outLen
- the output length.key
- the Rsa object.- Returns:
- 0 on success, < 0 on error.
-
RsaEncryptSize_fips
Retrieves Rsa Output Size.- Parameters:
key
- the Rsa object.- Returns:
- key output size > 0 on success, < 0 on error.
-
RsaPrivateKeyDecode_fips
public static int RsaPrivateKeyDecode_fips(java.nio.ByteBuffer input, long[] inOutIdx, Rsa key, long inSz)Decodes Rsa Private Key from buffer.- Parameters:
input
- the input buffer.inOutIdx
- the key's starting index in the input.key
- the Rsa object.inSz
- the input length.- Returns:
- 0 on success, < 0 on error.
-
RsaPrivateKeyDecode_fips
Decodes Rsa Private Key from buffer.- Parameters:
input
- the input buffer.inOutIdx
- the key's starting index in the input.key
- the Rsa object.inSz
- the input length.- Returns:
- 0 on success, < 0 on error.
-
RsaPublicKeyDecode_fips
public static int RsaPublicKeyDecode_fips(java.nio.ByteBuffer input, long[] inOutIdx, Rsa key, long inSz)Decodes Rsa Public Key from buffer.- Parameters:
input
- the input buffer.inOutIdx
- the key's starting index in the input.key
- the Rsa object.inSz
- the input length.- Returns:
- 0 on success, < 0 on error.
-
RsaPublicKeyDecode_fips
Decodes Rsa Public Key from buffer.- Parameters:
input
- the input buffer.inOutIdx
- the key's starting index in the input.key
- the Rsa object.inSz
- the input length.- Returns:
- 0 on success, < 0 on error.
-
InitSha_fips
Initializes Sha object for use.- Parameters:
sha
- the Sha object.- Returns:
- 0 on success, < 0 on error.
-
ShaUpdate_fips
Updates Sha object with data.- Parameters:
sha
- the Sha object.data
- the input buffer.len
- the input length.- Returns:
- 0 on success, < 0 on error.
-
ShaUpdate_fips
Updates Sha object with data.- Parameters:
sha
- the Sha object.data
- the input buffer.len
- the input length.- Returns:
- 0 on success, < 0 on error.
-
ShaFinal_fips
Outputs Sha digest to hash.- Parameters:
sha
- the Sha object.hash
- the output buffer.- Returns:
- 0 on success, < 0 on error.
-
ShaFinal_fips
Outputs Sha digest to hash.- Parameters:
sha
- the Sha object.hash
- the output buffer.- Returns:
- 0 on success, < 0 on error.
-
InitSha256_fips
Initializes Sha256 object for use.- Parameters:
sha
- the Sha256 object.- Returns:
- 0 on success, < 0 on error.
-
Sha256Update_fips
Updates Sha256 object with data.- Parameters:
sha
- the Sha256 object.data
- the input buffer.len
- the input length.- Returns:
- 0 on success, < 0 on error.
-
Sha256Update_fips
Updates Sha256 object with data.- Parameters:
sha
- the Sha256 object.data
- the input buffer.len
- the input length.- Returns:
- 0 on success, < 0 on error.
-
Sha256Final_fips
Outputs Sha256 digest to hash.- Parameters:
sha
- the Sha256 object.hash
- the output buffer.- Returns:
- 0 on success, < 0 on error.
-
Sha256Final_fips
Outputs Sha256 digest to hash.- Parameters:
sha
- the Sha256 object.hash
- the output buffer.- Returns:
- 0 on success, < 0 on error.
-
InitSha384_fips
Initializes Sha384 object for use.- Parameters:
sha
- the Sha384 object.- Returns:
- 0 on success, < 0 on error.
-
Sha384Update_fips
Updates Sha384 object with data.- Parameters:
sha
- the Sha384 object.data
- the input buffer.len
- the input length.- Returns:
- 0 on success, < 0 on error.
-
Sha384Update_fips
Updates Sha384 object with data.- Parameters:
sha
- the Sha384 object.data
- the input buffer.len
- the input length.- Returns:
- 0 on success, < 0 on error.
-
Sha384Final_fips
Outputs Sha384 digest to hash.- Parameters:
sha
- the Sha384 object.hash
- the output buffer.- Returns:
- 0 on success, < 0 on error.
-
Sha384Final_fips
Outputs Sha384 digest to hash.- Parameters:
sha
- the Sha384 object.hash
- the output buffer.- Returns:
- 0 on success, < 0 on error.
-
InitSha512_fips
Initializes Sha512 object for use.- Parameters:
sha
- the Sha512 object.- Returns:
- 0 on success, < 0 on error.
-
Sha512Update_fips
Updates Sha512 object with data.- Parameters:
sha
- the Sha512 object.data
- the input buffer.len
- the input length.- Returns:
- 0 on success, < 0 on error.
-
Sha512Update_fips
Updates Sha512 object with data.- Parameters:
sha
- the Sha512 object.data
- the input buffer.len
- the input length.- Returns:
- 0 on success, < 0 on error.
-
Sha512Final_fips
Outputs Sha512 digest to hash.- Parameters:
sha
- the Sha512 object.hash
- the output buffer.- Returns:
- 0 on success, < 0 on error.
-
Sha512Final_fips
Outputs Sha512 digest to hash.- Parameters:
sha
- the Sha512 object.hash
- the output buffer.- Returns:
- 0 on success, < 0 on error.
-
wolfCrypt_GetStatus_fips
public static int wolfCrypt_GetStatus_fips()- Returns:
- The current status of the module. A return code of 0 means the module is in a state without errors. Any other return code is the specific error state of the module.
-
wolfCrypt_SetStatus_fips
public static int wolfCrypt_SetStatus_fips(int status)Sets the fips module status. Only available if HAVE_FORCE_FIPS_FAILURE is defined on the native library.- Parameters:
status
- the new status.- Returns:
- 0 on success, < 0 on error.
-
RsaPublicEncrypt_fips
public static int RsaPublicEncrypt_fips(java.nio.ByteBuffer in, long inLen, java.nio.ByteBuffer out, long outLen, Rsa key, Rng rng)Performs Rsa Public Encryption.- Parameters:
in
- the input buffer.inLen
- the input length.out
- the output buffer.outLen
- the output length.key
- the Rsa object.rng
- the random source for padding.- Returns:
- 0 on success, < 0 on error.
-
RsaPublicEncrypt_fips
public static int RsaPublicEncrypt_fips(byte[] in, long inLen, byte[] out, long outLen, Rsa key, Rng rng)Performs Rsa Public Encryption.- Parameters:
in
- the input buffer.inLen
- the input length.out
- the output buffer.outLen
- the output length.key
- the Rsa object.rng
- the random source for padding.- Returns:
- 0 on success, < 0 on error.
-
RsaPrivateDecrypt_fips
public static int RsaPrivateDecrypt_fips(java.nio.ByteBuffer in, long inLen, java.nio.ByteBuffer out, long outLen, Rsa key)Performs Rsa Private Decryption.- Parameters:
in
- the input buffer.inLen
- the input length.out
- the output buffer.outLen
- the output length.key
- the Rsa object.- Returns:
- 0 on success, < 0 on error.
-
RsaPrivateDecrypt_fips
Performs Rsa Private Decryption.- Parameters:
in
- the input buffer.inLen
- the input length.out
- the output buffer.outLen
- the output length.key
- the Rsa object.- Returns:
- 0 on success, < 0 on error.
-
InitMd5
Initializes Md5 object for use.- Parameters:
md5
- the Md5 object.- Returns:
- 0 on success, < 0 on error.
-
Md5Update
Updates Md5 object with data.- Parameters:
md5
- the Md5 object.data
- the input buffer.len
- the input length.- Returns:
- 0 on success, < 0 on error.
-
Md5Update
Updates Md5 object with data.- Parameters:
md5
- the Md5 object.data
- the input buffer.len
- the input length.- Returns:
- 0 on success, < 0 on error.
-
Md5Final
Outputs Md5 digest to hash.- Parameters:
md5
- the Md5 object.hash
- the output buffer.- Returns:
- 0 on success, < 0 on error.
-
Md5Final
Outputs Md5 digest to hash.- Parameters:
md5
- the Md5 object.hash
- the output buffer.- Returns:
- 0 on success, < 0 on error.
-
InitDhKey
Initializes Dh object for use. FreeDhKey must be called for resources deallocation.- Parameters:
key
- the Dh object.
-
FreeDhKey
Releases Dh object's resources.- Parameters:
key
- the Dh object.
-
DhGenerateKeyPair
public static int DhGenerateKeyPair(Dh key, Rng rng, java.nio.ByteBuffer priv, long[] privSz, java.nio.ByteBuffer pub, long[] pubSz)Generates the public part pub of size pubSz, private part priv of size privSz using rng for Dh key.- Parameters:
key
- the Dh object.rng
- the random source.priv
- the private part buffer.privSz
- the private part length.pub
- the public part buffer.pubSz
- the the public part length.- Returns:
- 0 on success, < 0 on error.
-
DhGenerateKeyPair
public static int DhGenerateKeyPair(Dh key, Rng rng, byte[] priv, long[] privSz, byte[] pub, long[] pubSz)Generates the public part pub of size pubSz, private part priv of size privSz using rng for Dh key.- Parameters:
key
- the Dh object.rng
- the random source.priv
- the private part buffer.privSz
- the private part length.pub
- the public part buffer.pubSz
- the the public part length.- Returns:
- 0 on success, < 0 on error.
-
DhAgree
public static int DhAgree(Dh key, java.nio.ByteBuffer agree, long[] agreeSz, java.nio.ByteBuffer priv, long privSz, java.nio.ByteBuffer otherPub, long pubSz)Creates the agreement agree of size agreeSz using Dh key private priv of size privSz and peer’s public key otherPub of size pubSz.- Parameters:
key
- the Dh object.agree
- the agree buffer.agreeSz
- the agree length.priv
- the private part buffer.privSz
- the private part length.otherPub
- the peer's public part buffer.pubSz
- the the public part length.- Returns:
- 0 on success, < 0 on error.
-
DhAgree
public static int DhAgree(Dh key, byte[] agree, long[] agreeSz, byte[] priv, long privSz, byte[] otherPub, long pubSz)Creates the agreement agree of size agreeSz using Dh key private priv of size privSz and peer’s public key otherPub of size pubSz.- Parameters:
key
- the Dh object.agree
- the agree buffer.agreeSz
- the agree length.priv
- the private part buffer.privSz
- the private part length.otherPub
- the peer's public part buffer.pubSz
- the the public part length.- Returns:
- 0 on success, < 0 on error.
-
DhKeyDecode
Decodes the DER group parameters from buffer input starting at index inOutIdx of size inSz into Dh key.- Parameters:
input
- the parameters buffer.inOutIdx
- the parameters' starting index.key
- the Dh object.inSz
- the parameters buffer length. (not from inOutIdx)- Returns:
- 0 on success, < 0 on error.
-
DhKeyDecode
Decodes the DER group parameters from buffer input starting at index inOutIdx of size inSz into Dh key.- Parameters:
input
- the parameters buffer.inOutIdx
- the parameters' starting index.key
- the Dh object.inSz
- the parameters buffer length. (not from inOutIdx)- Returns:
- 0 on success, < 0 on error.
-
DhSetKey
public static int DhSetKey(Dh key, java.nio.ByteBuffer p, long pSz, java.nio.ByteBuffer g, long gSz)Sets the group parameters for the Dh key from the unsigned binary inputs p of size pSz and g of size gSz.- Parameters:
key
- the Dh object.p
- the prime buffer.pSz
- the prime length.g
- the primitive root molulo p buffer.gSz
- the primitive root modulo p length.- Returns:
- 0 on success, < 0 on error.
-
DhSetKey
Sets the group parameters for the Dh key from the unsigned binary inputs p of size pSz and g of size gSz.- Parameters:
key
- the Dh object.p
- the prime buffer.pSz
- the prime length.g
- the primitive root molulo p buffer.gSz
- the primitive root modulo p length.- Returns:
- 0 on success, < 0 on error.
-
DhParamsLoad
public static int DhParamsLoad(java.nio.ByteBuffer input, long inSz, java.nio.ByteBuffer p, long[] pInOutSz, java.nio.ByteBuffer g, long[] gInOutSz)Loads the Dh group parameters.- Parameters:
input
- the parameters buffer.inSz
- the parameters size.p
- the prime buffer.pInOutSz
- the prime length.g
- the primitive root molulo p buffer.gInOutSz
- the primitive root modulo p length.- Returns:
- 0 on success, < 0 on error.
-
DhParamsLoad
public static int DhParamsLoad(byte[] input, long inSz, byte[] p, long[] pInOutSz, byte[] g, long[] gInOutSz)Loads the Dh group parameters.- Parameters:
input
- the parameters buffer.inSz
- the parameters size.p
- the prime buffer.pInOutSz
- the prime length.g
- the primitive root molulo p buffer.gInOutSz
- the primitive root modulo p length.- Returns:
- 0 on success, < 0 on error.
-
ecc_init
Initializes Ecc object for use. ecc_free must be called for resources deallocation.- Parameters:
key
- the Ecc object.- Returns:
- 0 on success, < 0 on error.
-
ecc_free
Releases Ecc object's resources.- Parameters:
key
- the Ecc object.
-
ecc_make_key
Generates a new ecc key of size keysize using rng.- Parameters:
rng
- the random source.keysize
- the key length.key
- the Ecc object.- Returns:
- 0 on success, < 0 on error.
-
ecc_shared_secret
public static int ecc_shared_secret(Ecc private_key, Ecc public_key, java.nio.ByteBuffer out, long[] outlen)Creates the shared secret out of size outlen using ecc private_key and the peer’s ecc public_key.- Parameters:
private_key
- the Ecc object for the private key.public_key
- the Ecc object for the peer's public key.out
- the output buffer.outlen
- the output length.- Returns:
- 0 on success, < 0 on error.
-
ecc_shared_secret
Creates the shared secret out of size outlen using ecc private_key and the peer’s ecc public_key.- Parameters:
private_key
- the Ecc object for the private key.public_key
- the Ecc object for the peer's public key.out
- the output buffer.outlen
- the output length.- Returns:
- 0 on success, < 0 on error.
-
ecc_import_x963
Imports the public ecc key from in of length inLen in x963 format.- Parameters:
in
- the input buffer.inLen
- the input length.key
- the Ecc object.- Returns:
- 0 on success, < 0 on error.
-
ecc_import_x963
Imports the public ecc key from in of length inLen in x963 format.- Parameters:
in
- the input buffer.inLen
- the input length.key
- the Ecc object.- Returns:
- 0 on success, < 0 on error.
-
ecc_export_x963
Exports the public ecc key into out of length outLen in x963 format.- Parameters:
key
- the Ecc object.out
- the output buffer.outLen
- the output length.- Returns:
- 0 on success, < 0 on error.
-
ecc_export_x963
Exports the public ecc key into out of length outLen in x963 format.- Parameters:
key
- the Ecc object.out
- the output buffer.outLen
- the output length.- Returns:
- 0 on success, < 0 on error.
-