Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Ctors](https://developer.android.com/reference/java/security/GeneralSecurityException#pubctors) \| [Inherited Methods](https://developer.android.com/reference/java/security/GeneralSecurityException#inhmethods)

# GeneralSecurityException

` public class GeneralSecurityException `   
` ` ` ` ` extends https://developer.android.com/reference/java/lang/Exception ` ` `

|---|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||||
| ↳ | [java.lang.Throwable](https://developer.android.com/reference/java/lang/Throwable) |||
|   | ↳ | [java.lang.Exception](https://developer.android.com/reference/java/lang/Exception) ||
|   |   | ↳ | java.security.GeneralSecurityException |

Known direct subclasses [BadPaddingException](https://developer.android.com/reference/javax/crypto/BadPaddingException), [CRLException](https://developer.android.com/reference/java/security/cert/CRLException), [CertPathBuilderException](https://developer.android.com/reference/java/security/cert/CertPathBuilderException), [CertPathValidatorException](https://developer.android.com/reference/java/security/cert/CertPathValidatorException), [CertStoreException](https://developer.android.com/reference/java/security/cert/CertStoreException), [CertificateException](https://developer.android.com/reference/java/security/cert/CertificateException), [DigestException](https://developer.android.com/reference/java/security/DigestException), [ExemptionMechanismException](https://developer.android.com/reference/javax/crypto/ExemptionMechanismException), [IllegalBlockSizeException](https://developer.android.com/reference/javax/crypto/IllegalBlockSizeException), [InvalidAlgorithmParameterException](https://developer.android.com/reference/java/security/InvalidAlgorithmParameterException), [InvalidKeySpecException](https://developer.android.com/reference/java/security/spec/InvalidKeySpecException), [InvalidParameterSpecException](https://developer.android.com/reference/java/security/spec/InvalidParameterSpecException), [KeyException](https://developer.android.com/reference/java/security/KeyException), [KeyStoreException](https://developer.android.com/reference/java/security/KeyStoreException), [LoginException](https://developer.android.com/reference/javax/security/auth/login/LoginException), and 6 others. [BadPaddingException](https://developer.android.com/reference/javax/crypto/BadPaddingException) This exception is thrown when a particular padding mechanism is expected for the input data but the data is not padded properly. [CRLException](https://developer.android.com/reference/java/security/cert/CRLException) CRL (Certificate Revocation List) Exception. [CertPathBuilderException](https://developer.android.com/reference/java/security/cert/CertPathBuilderException) An exception indicating one of a variety of problems encountered when building a certification path with a `CertPathBuilder`. [CertPathValidatorException](https://developer.android.com/reference/java/security/cert/CertPathValidatorException) An exception indicating one of a variety of problems encountered when validating a certification path. [CertStoreException](https://developer.android.com/reference/java/security/cert/CertStoreException) An exception indicating one of a variety of problems retrieving certificates and CRLs from a `CertStore`. [CertificateException](https://developer.android.com/reference/java/security/cert/CertificateException) This exception indicates one of a variety of certificate problems. [DigestException](https://developer.android.com/reference/java/security/DigestException) This is the generic Message Digest exception. [ExemptionMechanismException](https://developer.android.com/reference/javax/crypto/ExemptionMechanismException) This is the generic ExemptionMechanism exception. [IllegalBlockSizeException](https://developer.android.com/reference/javax/crypto/IllegalBlockSizeException) This exception is thrown when the length of data provided to a block cipher is incorrect, i.e., does not match the block size of the cipher. [InvalidAlgorithmParameterException](https://developer.android.com/reference/java/security/InvalidAlgorithmParameterException) This is the exception for invalid or inappropriate algorithm parameters. [InvalidKeySpecException](https://developer.android.com/reference/java/security/spec/InvalidKeySpecException) This is the exception for invalid key specifications. [InvalidParameterSpecException](https://developer.android.com/reference/java/security/spec/InvalidParameterSpecException) This is the exception for invalid parameter specifications. [KeyException](https://developer.android.com/reference/java/security/KeyException) This is the basic key exception. [KeyStoreException](https://developer.android.com/reference/java/security/KeyStoreException) This is the generic KeyStore exception. [LoginException](https://developer.android.com/reference/javax/security/auth/login/LoginException) This is the basic login exception. [NoSuchAlgorithmException](https://developer.android.com/reference/java/security/NoSuchAlgorithmException) This exception is thrown when a particular cryptographic algorithm is requested but is not available in the environment. [NoSuchPaddingException](https://developer.android.com/reference/javax/crypto/NoSuchPaddingException) This exception is thrown when a particular padding mechanism is requested but is not available in the environment. [NoSuchProviderException](https://developer.android.com/reference/java/security/NoSuchProviderException) This exception is thrown when a particular security provider is requested but is not available in the environment. [ShortBufferException](https://developer.android.com/reference/javax/crypto/ShortBufferException) This exception is thrown when an output buffer provided by the user is too short to hold the operation result. [SignatureException](https://developer.android.com/reference/java/security/SignatureException) This is the generic Signature exception. [UnrecoverableEntryException](https://developer.android.com/reference/java/security/UnrecoverableEntryException) This exception is thrown if an entry in the keystore cannot be recovered. Known indirect subclasses [AEADBadTagException](https://developer.android.com/reference/javax/crypto/AEADBadTagException), [CertificateEncodingException](https://developer.android.com/reference/java/security/cert/CertificateEncodingException), [CertificateExpiredException](https://developer.android.com/reference/java/security/cert/CertificateExpiredException), [CertificateNotYetValidException](https://developer.android.com/reference/java/security/cert/CertificateNotYetValidException), [CertificateParsingException](https://developer.android.com/reference/java/security/cert/CertificateParsingException), [CertificateRevokedException](https://developer.android.com/reference/java/security/cert/CertificateRevokedException), [InvalidKeyException](https://developer.android.com/reference/java/security/InvalidKeyException), [KeyExpiredException](https://developer.android.com/reference/android/security/keystore/KeyExpiredException), [KeyManagementException](https://developer.android.com/reference/java/security/KeyManagementException), [KeyNotYetValidException](https://developer.android.com/reference/android/security/keystore/KeyNotYetValidException), [KeyPermanentlyInvalidatedException](https://developer.android.com/reference/android/security/keystore/KeyPermanentlyInvalidatedException), [UnrecoverableKeyException](https://developer.android.com/reference/java/security/UnrecoverableKeyException), [UserNotAuthenticatedException](https://developer.android.com/reference/android/security/keystore/UserNotAuthenticatedException), [UserPresenceUnavailableException](https://developer.android.com/reference/android/security/keystore/UserPresenceUnavailableException) [AEADBadTagException](https://developer.android.com/reference/javax/crypto/AEADBadTagException) This exception is thrown when a `https://developer.android.com/reference/javax/crypto/Cipher` operating in an AEAD mode (such as GCM/CCM) is unable to verify the supplied authentication tag. [CertificateEncodingException](https://developer.android.com/reference/java/security/cert/CertificateEncodingException) Certificate Encoding Exception. [CertificateExpiredException](https://developer.android.com/reference/java/security/cert/CertificateExpiredException) Certificate Expired Exception. [CertificateNotYetValidException](https://developer.android.com/reference/java/security/cert/CertificateNotYetValidException) Certificate is not yet valid exception. [CertificateParsingException](https://developer.android.com/reference/java/security/cert/CertificateParsingException) Certificate Parsing Exception. [CertificateRevokedException](https://developer.android.com/reference/java/security/cert/CertificateRevokedException) An exception that indicates an X.509 certificate is revoked. [InvalidKeyException](https://developer.android.com/reference/java/security/InvalidKeyException) This is the exception for invalid Keys (invalid encoding, wrong length, uninitialized, etc). [KeyExpiredException](https://developer.android.com/reference/android/security/keystore/KeyExpiredException) Indicates that a cryptographic operation failed because the employed key's validity end date is in the past. [KeyManagementException](https://developer.android.com/reference/java/security/KeyManagementException) This is the general key management exception for all operations dealing with key management. [KeyNotYetValidException](https://developer.android.com/reference/android/security/keystore/KeyNotYetValidException) Indicates that a cryptographic operation failed because the employed key's validity start date is in the future. [KeyPermanentlyInvalidatedException](https://developer.android.com/reference/android/security/keystore/KeyPermanentlyInvalidatedException) Indicates that the key can no longer be used because it has been permanently invalidated. [UnrecoverableKeyException](https://developer.android.com/reference/java/security/UnrecoverableKeyException) This exception is thrown if a key in the keystore cannot be recovered. [UserNotAuthenticatedException](https://developer.android.com/reference/android/security/keystore/UserNotAuthenticatedException) Indicates that a cryptographic operation could not be performed because the user has not been authenticated recently enough. [UserPresenceUnavailableException](https://developer.android.com/reference/android/security/keystore/UserPresenceUnavailableException) Indicates the condition that a proof of user-presence was requested but this proof was not presented.   

*** ** * ** ***

The `GeneralSecurityException` class is a generic security exception class that provides type safety for all the security-related exception classes that extend from it.

## Summary

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/java/security/GeneralSecurityException#GeneralSecurityException()() ` Constructs a GeneralSecurityException with no detail message. |
| ` https://developer.android.com/reference/java/security/GeneralSecurityException#GeneralSecurityException(java.lang.String)(https://developer.android.com/reference/java/lang/String msg) ` Constructs a GeneralSecurityException with the specified detail message. |
| ` https://developer.android.com/reference/java/security/GeneralSecurityException#GeneralSecurityException(java.lang.String,%20java.lang.Throwable)(https://developer.android.com/reference/java/lang/String message, https://developer.android.com/reference/java/lang/Throwable cause) ` Creates a `GeneralSecurityException` with the specified detail message and cause. |
| ` https://developer.android.com/reference/java/security/GeneralSecurityException#GeneralSecurityException(java.lang.Throwable)(https://developer.android.com/reference/java/lang/Throwable cause) ` Creates a `GeneralSecurityException` with the specified cause and a detail message of `(cause==null ? null : cause.toString())` (which typically contains the class and detail message of `cause`). |

### Inherited methods

From class ` https://developer.android.com/reference/java/lang/Throwable ` ` final void` ` https://developer.android.com/reference/java/lang/Throwable#addSuppressed(java.lang.Throwable)(https://developer.android.com/reference/java/lang/Throwable exception) `

Appends the specified exception to the exceptions that were suppressed in order to deliver this exception.
` https://developer.android.com/reference/java/lang/Throwable` ` https://developer.android.com/reference/java/lang/Throwable#fillInStackTrace()() `

Fills in the execution stack trace.
` https://developer.android.com/reference/java/lang/Throwable` ` https://developer.android.com/reference/java/lang/Throwable#getCause()() `

Returns the cause of this throwable or `null` if the cause is nonexistent or unknown.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Throwable#getLocalizedMessage()() `

Creates a localized description of this throwable.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Throwable#getMessage()() `

Returns the detail message string of this throwable.
` https://developer.android.com/reference/java/lang/StackTraceElement` ` https://developer.android.com/reference/java/lang/Throwable#getStackTrace()() `

Provides programmatic access to the stack trace information printed by `https://developer.android.com/reference/java/lang/Throwable#printStackTrace()`.
` final https://developer.android.com/reference/java/lang/Throwable` ` https://developer.android.com/reference/java/lang/Throwable#getSuppressed()() `

Returns an array containing all of the exceptions that were suppressed, typically by the `try`-with-resources statement, in order to deliver this exception.
` https://developer.android.com/reference/java/lang/Throwable` ` https://developer.android.com/reference/java/lang/Throwable#initCause(java.lang.Throwable)(https://developer.android.com/reference/java/lang/Throwable cause) `

Initializes the *cause* of this throwable to the specified value.
` void` ` https://developer.android.com/reference/java/lang/Throwable#printStackTrace()() `

Prints this throwable and its backtrace to the standard error stream.
` void` ` https://developer.android.com/reference/java/lang/Throwable#printStackTrace(java.io.PrintWriter)(https://developer.android.com/reference/java/io/PrintWriter s) `

Prints this throwable and its backtrace to the specified print writer.
` void` ` https://developer.android.com/reference/java/lang/Throwable#printStackTrace(java.io.PrintStream)(https://developer.android.com/reference/java/io/PrintStream s) `

Prints this throwable and its backtrace to the specified print stream.
` void` ` https://developer.android.com/reference/java/lang/Throwable#setStackTrace(java.lang.StackTraceElement[])(https://developer.android.com/reference/java/lang/StackTraceElement stackTrace) `

Sets the stack trace elements that will be returned by `https://developer.android.com/reference/java/lang/Throwable#getStackTrace()` and printed by `https://developer.android.com/reference/java/lang/Throwable#printStackTrace()` and related methods.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Throwable#toString()() `

Returns a short description of this throwable.
From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait()() `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.

## Public constructors

### GeneralSecurityException

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public GeneralSecurityException ()
```

Constructs a GeneralSecurityException with no detail message.

<br />

### GeneralSecurityException

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public GeneralSecurityException (String msg)
```

Constructs a GeneralSecurityException with the specified detail message. A detail message is a String that describes this particular exception.

<br />

| Parameters ||
|---|---|
| `msg` | `String`: the detail message. <br /> |

### GeneralSecurityException

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public GeneralSecurityException (String message, 
                Throwable cause)
```

Creates a `GeneralSecurityException` with the specified detail message and cause.

<br />

| Parameters ||
|---|---|
| `message` | `String`: the detail message (which is saved for later retrieval by the `https://developer.android.com/reference/java/lang/Throwable#getMessage()` method). <br /> |
| `cause` | `Throwable`: the cause (which is saved for later retrieval by the `https://developer.android.com/reference/java/lang/Throwable#getCause()` method). (A `null` value is permitted, and indicates that the cause is nonexistent or unknown.) <br /> |

### GeneralSecurityException

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public GeneralSecurityException (Throwable cause)
```

Creates a `GeneralSecurityException` with the specified cause and a detail message of `(cause==null ? null : cause.toString())` (which typically contains the class and detail message of `cause`).

<br />

| Parameters ||
|---|---|
| `cause` | `Throwable`: the cause (which is saved for later retrieval by the `https://developer.android.com/reference/java/lang/Throwable#getCause()` method). (A `null` value is permitted, and indicates that the cause is nonexistent or unknown.) <br /> |