Udostępnij za pośrednictwem


Mac Class

Definition

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

[Android.Runtime.Register("javax/crypto/Mac", DoNotGenerateAcw=true)]
public class Mac : Java.Lang.Object, IDisposable, Java.Interop.IJavaPeerable, Java.Lang.ICloneable
[<Android.Runtime.Register("javax/crypto/Mac", DoNotGenerateAcw=true)>]
type Mac = class
    inherit Object
    interface ICloneable
    interface IJavaObject
    interface IDisposable
    interface IJavaPeerable
Inheritance
Attributes
Implements

Remarks

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., MD5 or SHA-1, in combination with a secret shared key. HMAC is specified in RFC 2104.

Android provides the following Mac algorithms: <table> <thead> <tr> <th>Algorithm</th> <th>Supported API Levels</th> </tr> </thead> <tbody> <tr class="deprecated"> <td>DESMAC</td> <td>1-8</td> </tr> <tr class="deprecated"> <td>DESMAC/CFB8</td> <td>1-8</td> </tr> <tr class="deprecated"> <td>DESedeMAC</td> <td>1-8</td> </tr> <tr class="deprecated"> <td>DESedeMAC/CFB8</td> <td>1-8</td> </tr> <tr class="deprecated"> <td>DESedeMAC64</td> <td>1-8</td> </tr> <tr class="deprecated"> <td>DESwithISO9797</td> <td>1-8</td> </tr> <tr> <td>HmacMD5</td> <td>1+</td> </tr> <tr> <td>HmacSHA1</td> <td>1+</td> </tr> <tr> <td>HmacSHA224</td> <td>1-8,22+</td> </tr> <tr> <td>HmacSHA256</td> <td>1+</td> </tr> <tr> <td>HmacSHA384</td> <td>1+</td> </tr> <tr> <td>HmacSHA512</td> <td>1+</td> </tr> <tr class="deprecated"> <td>ISO9797ALG3MAC</td> <td>1-8</td> </tr> <tr> <td>PBEwithHmacSHA</td> <td>1+</td> </tr> <tr> <td>PBEwithHmacSHA1</td> <td>1+</td> </tr> <tr> <td>PBEwithHmacSHA224</td> <td>26+</td> </tr> <tr> <td>PBEwithHmacSHA256</td> <td>26+</td> </tr> <tr> <td>PBEwithHmacSHA384</td> <td>26+</td> </tr> <tr> <td>PBEwithHmacSHA512</td> <td>26+</td> </tr> </tbody> </table>

These algorithms are described in the Mac section of the Java Cryptography Architecture Standard Algorithm Name Documentation.

Added in 1.4.

Java documentation for javax.crypto.Mac.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Constructors

Mac(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

Mac(MacSpi, Provider, String)

Creates a MAC object.

Properties

Algorithm

Returns the algorithm name of this Mac object.

Class

Returns the runtime class of this Object.

(Inherited from Object)
Handle

The handle to the underlying Android instance.

(Inherited from Object)
JniIdentityHashCode (Inherited from Object)
JniPeerMembers
MacLength

Returns the length of the MAC in bytes.

PeerReference (Inherited from Object)
Provider

Returns the provider of this Mac object.

ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Methods

Clone()

Returns a clone if the provider implementation is cloneable.

Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
DoFinal()

Finishes the MAC operation.

DoFinal(Byte[], Int32)

Finishes the MAC operation.

DoFinal(Byte[])

Processes the given array of bytes and finishes the MAC operation.

Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
GetInstance(String, Provider)

Returns a Mac object that implements the specified MAC algorithm.

GetInstance(String, String)

Returns a Mac object that implements the specified MAC algorithm.

GetInstance(String)

Returns a Mac object that implements the specified MAC algorithm.

Init(IKey, IAlgorithmParameterSpec)

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

Init(IKey)

Initializes this Mac object with the given key.

JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
Reset()

Resets this Mac object.

SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
Update(Byte[], Int32, Int32)

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

Update(Byte[])

Processes the given array of bytes.

Update(ByteBuffer)

Processes input.remaining() bytes in the ByteBuffer input, starting at input.position().

Update(SByte)

Processes the given byte.

Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to