Liking cljdoc? Tell your friends :D

javax.crypto.Mac

This class provides the functionality of a "Message Authentication Code" (MAC) algorithm.

A MAC provides a way to check the integrity of information transmitted over or stored in an unreliable medium, based on a secret key. Typically, message authentication codes are used between two parties that share a secret key in order to validate information transmitted between these parties.

A MAC mechanism that is based on cryptographic hash functions is referred to as HMAC. HMAC can be used with any cryptographic hash function, e.g., SHA256 or SHA384, in combination with a secret shared key. HMAC is specified in RFC 2104.

Every implementation of the Java platform is required to support the following standard Mac algorithms:

HmacMD5 HmacSHA1 HmacSHA256

These algorithms are described in the

Mac section of the Java Cryptography Architecture Standard Algorithm Name Documentation. Consult the release documentation for your implementation to see if any other algorithms are supported.

This class provides the functionality of a "Message Authentication Code"
(MAC) algorithm.

 A MAC provides a way to check
the integrity of information transmitted over or stored in an unreliable
medium, based on a secret key. Typically, message
authentication codes are used between two parties that share a secret
key in order to validate information transmitted between these
parties.

 A MAC mechanism that is based on cryptographic hash functions is
referred to as HMAC. HMAC can be used with any cryptographic hash function,
e.g., SHA256 or SHA384, in combination with a secret shared key. HMAC is
specified in RFC 2104.

 Every implementation of the Java platform is required to support
the following standard Mac algorithms:

HmacMD5
HmacSHA1
HmacSHA256

These algorithms are described in the

Mac section of the
Java Cryptography Architecture Standard Algorithm Name Documentation.
Consult the release documentation for your implementation to see if any
other algorithms are supported.
raw docstring

*get-instanceclj

(*get-instance algorithm)
(*get-instance algorithm provider)

Returns a Mac object that implements the specified MAC algorithm.

A new Mac object encapsulating the MacSpi implementation from the specified provider is returned. The specified provider must be registered in the security provider list.

Note that the list of registered providers may be retrieved via the Security.getProviders() method.

algorithm - the standard name of the requested MAC algorithm. See the Mac section in the Java Cryptography Architecture Standard Algorithm Name Documentation for information about standard algorithm names. - java.lang.String provider - the name of the provider. - java.lang.String

returns: the new Mac object. - javax.crypto.Mac

throws: java.security.NoSuchAlgorithmException - if a MacSpi implementation for the specified algorithm is not available from the specified provider.

Returns a Mac object that implements the
 specified MAC algorithm.

  A new Mac object encapsulating the
 MacSpi implementation from the specified provider
 is returned.  The specified provider must be registered
 in the security provider list.

  Note that the list of registered providers may be retrieved via
 the Security.getProviders() method.

algorithm - the standard name of the requested MAC algorithm. See the Mac section in the Java Cryptography Architecture Standard Algorithm Name Documentation for information about standard algorithm names. - `java.lang.String`
provider - the name of the provider. - `java.lang.String`

returns: the new Mac object. - `javax.crypto.Mac`

throws: java.security.NoSuchAlgorithmException - if a MacSpi implementation for the specified algorithm is not available from the specified provider.
raw docstring

cloneclj

(clone this)

Returns a clone if the provider implementation is cloneable.

returns: a clone if the provider implementation is cloneable. - java.lang.Object

throws: java.lang.CloneNotSupportedException - if this is called on a delegate that does not support Cloneable.

Returns a clone if the provider implementation is cloneable.

returns: a clone if the provider implementation is cloneable. - `java.lang.Object`

throws: java.lang.CloneNotSupportedException - if this is called on a delegate that does not support Cloneable.
raw docstring

do-finalclj

(do-final this)
(do-final this input)
(do-final this output out-offset)

Finishes the MAC operation.

A call to this method resets this Mac object to the state it was in when previously initialized via a call to init(Key) or init(Key, AlgorithmParameterSpec). That is, the object is reset and available to generate another MAC from the same key, if desired, via new calls to update and doFinal. (In order to reuse this Mac object with a different key, it must be reinitialized via a call to init(Key) or init(Key, AlgorithmParameterSpec).

The MAC result is stored in output, starting at outOffset inclusive.

output - the buffer where the MAC result is stored - byte[] out-offset - the offset in output where the MAC is stored - int

throws: javax.crypto.ShortBufferException - if the given output buffer is too small to hold the result

Finishes the MAC operation.

 A call to this method resets this Mac object to the
 state it was in when previously initialized via a call to
 init(Key) or
 init(Key, AlgorithmParameterSpec).
 That is, the object is reset and available to generate another MAC from
 the same key, if desired, via new calls to update and
 doFinal.
 (In order to reuse this Mac object with a different key,
 it must be reinitialized via a call to init(Key) or
 init(Key, AlgorithmParameterSpec).

 The MAC result is stored in output, starting at
 outOffset inclusive.

output - the buffer where the MAC result is stored - `byte[]`
out-offset - the offset in output where the MAC is stored - `int`

throws: javax.crypto.ShortBufferException - if the given output buffer is too small to hold the result
raw docstring

get-algorithmclj

(get-algorithm this)

Returns the algorithm name of this Mac object.

This is the same name that was specified in one of the getInstance calls that created this Mac object.

returns: the algorithm name of this Mac object. - java.lang.String

Returns the algorithm name of this Mac object.

 This is the same name that was specified in one of the
 getInstance calls that created this
 Mac object.

returns: the algorithm name of this Mac object. - `java.lang.String`
raw docstring

get-mac-lengthclj

(get-mac-length this)

Returns the length of the MAC in bytes.

returns: the MAC length in bytes. - int

Returns the length of the MAC in bytes.

returns: the MAC length in bytes. - `int`
raw docstring

get-providerclj

(get-provider this)

Returns the provider of this Mac object.

returns: the provider of this Mac object. - java.security.Provider

Returns the provider of this Mac object.

returns: the provider of this Mac object. - `java.security.Provider`
raw docstring

initclj

(init this key)
(init this key params)

Initializes this Mac object with the given key and algorithm parameters.

key - the key. - java.security.Key params - the algorithm parameters. - java.security.spec.AlgorithmParameterSpec

throws: java.security.InvalidKeyException - if the given key is inappropriate for initializing this MAC.

Initializes this Mac object with the given key and
 algorithm parameters.

key - the key. - `java.security.Key`
params - the algorithm parameters. - `java.security.spec.AlgorithmParameterSpec`

throws: java.security.InvalidKeyException - if the given key is inappropriate for initializing this MAC.
raw docstring

resetclj

(reset this)

Resets this Mac object.

A call to this method resets this Mac object to the state it was in when previously initialized via a call to init(Key) or init(Key, AlgorithmParameterSpec). That is, the object is reset and available to generate another MAC from the same key, if desired, via new calls to update and doFinal. (In order to reuse this Mac object with a different key, it must be reinitialized via a call to init(Key) or init(Key, AlgorithmParameterSpec).

Resets this Mac object.

A call to this method resets this Mac object to the
state it was in when previously initialized via a call to
init(Key) or
init(Key, AlgorithmParameterSpec).
That is, the object is reset and available to generate another MAC from
the same key, if desired, via new calls to update and
doFinal.
(In order to reuse this Mac object with a different key,
it must be reinitialized via a call to init(Key) or
init(Key, AlgorithmParameterSpec).
raw docstring

updateclj

(update this input)
(update this input offset len)

Processes the first len bytes in input, starting at offset inclusive.

input - the input buffer. - byte[] offset - the offset in input where the input starts. - int len - the number of bytes to process. - int

throws: java.lang.IllegalStateException - if this Mac has not been initialized.

Processes the first len bytes in input,
 starting at offset inclusive.

input - the input buffer. - `byte[]`
offset - the offset in input where the input starts. - `int`
len - the number of bytes to process. - `int`

throws: java.lang.IllegalStateException - if this Mac has not been initialized.
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close