|
| 1 | +/* |
| 2 | + * Copyright (c) 2025 Matthew Nelson |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * https://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + **/ |
| 16 | +@file:Suppress("EXPECT_ACTUAL_CLASSIFIERS_ARE_IN_BETA_WARNING") |
| 17 | + |
| 18 | +package org.kotlincrypto.core |
| 19 | + |
| 20 | +/** |
| 21 | + * This exception is thrown when an invalid parameter is encountered. |
| 22 | + * */ |
| 23 | +public actual open class InvalidParameterException: IllegalArgumentException { |
| 24 | + public actual constructor(): super() |
| 25 | + public actual constructor(message: String?): super(message) |
| 26 | +} |
| 27 | + |
| 28 | +/** |
| 29 | + * The `GeneralSecurityException` class is a generic security exception class that provides type |
| 30 | + * safety for all the security-related exception classes that extend from it. |
| 31 | + * */ |
| 32 | +public actual open class GeneralSecurityException: Exception { |
| 33 | + public actual constructor(): super() |
| 34 | + public actual constructor(message: String?): super(message) |
| 35 | + public actual constructor(message: String?, cause: Throwable?): super(message, cause) |
| 36 | + public actual constructor(cause: Throwable?): super(cause) |
| 37 | +} |
| 38 | + |
| 39 | +/** |
| 40 | + * This exception is thrown when a particular padding mechanism is expected for the input data but |
| 41 | + * the data is not padded properly. |
| 42 | + * */ |
| 43 | +public actual open class BadPaddingException: GeneralSecurityException { |
| 44 | + public actual constructor(): super() |
| 45 | + public actual constructor(message: String?): super(message) |
| 46 | +} |
| 47 | + |
| 48 | +/** |
| 49 | + * The `CertificateException` class is a generic security exception class that provides type safety |
| 50 | + * for all the certificate-related exception classes that extend from it. |
| 51 | + * */ |
| 52 | +public actual open class CertificateException: GeneralSecurityException { |
| 53 | + public actual constructor(): super() |
| 54 | + public actual constructor(message: String?): super(message) |
| 55 | + public actual constructor(message: String?, cause: Throwable?): super(message, cause) |
| 56 | + public actual constructor(cause: Throwable?): super(cause) |
| 57 | +} |
| 58 | + |
| 59 | +/** |
| 60 | + * This exception is thrown when an error occurs while attempting to encode a certificate. |
| 61 | + * */ |
| 62 | +public actual open class CertificateEncodingException: CertificateException { |
| 63 | + public actual constructor(): super() |
| 64 | + public actual constructor(message: String?): super(message) |
| 65 | + public actual constructor(message: String?, cause: Throwable?): super(message, cause) |
| 66 | + public actual constructor(cause: Throwable?): super(cause) |
| 67 | +} |
| 68 | + |
| 69 | +/** |
| 70 | + * This exception is thrown whenever an invalid DER-encoded certificate is parsed, or unsupported |
| 71 | + * DER features are found in the Certificate. |
| 72 | + * */ |
| 73 | +public actual open class CertificateParsingException: CertificateException { |
| 74 | + public actual constructor(): super() |
| 75 | + public actual constructor(message: String?): super(message) |
| 76 | + public actual constructor(message: String?, cause: Throwable?): super(message, cause) |
| 77 | + public actual constructor(cause: Throwable?): super(cause) |
| 78 | +} |
| 79 | + |
| 80 | +/** |
| 81 | + * This exception is thrown when the length of data provided to a block cipher is incorrect, (i.e. |
| 82 | + * does not match the block size of the cipher.) |
| 83 | + * */ |
| 84 | +public actual open class IllegalBlockSizeException: GeneralSecurityException { |
| 85 | + public actual constructor(): super() |
| 86 | + public actual constructor(message: String?): super(message) |
| 87 | +} |
| 88 | + |
| 89 | +/** |
| 90 | + * The `KeyException` class is a generic security exception class that provides type safety for all |
| 91 | + * the key-related exception classes that extend from it. |
| 92 | + * */ |
| 93 | +public actual open class KeyException: GeneralSecurityException { |
| 94 | + public actual constructor(): super() |
| 95 | + public actual constructor(message: String?): super(message) |
| 96 | + public actual constructor(message: String?, cause: Throwable?): super(message, cause) |
| 97 | + public actual constructor(cause: Throwable?): super(cause) |
| 98 | +} |
| 99 | + |
| 100 | +/** |
| 101 | + * This exception is thrown when a key is invalid (e.g. invalid encoding, wrong length, etc.). |
| 102 | + * */ |
| 103 | +public actual open class InvalidKeyException: KeyException { |
| 104 | + public actual constructor(): super() |
| 105 | + public actual constructor(message: String?): super(message) |
| 106 | + public actual constructor(message: String?, cause: Throwable?): super(message, cause) |
| 107 | + public actual constructor(cause: Throwable?): super(cause) |
| 108 | +} |
| 109 | + |
| 110 | +/** |
| 111 | + * This exception is thrown when a buffer provided by the user is too short to hold the operation result. |
| 112 | + * */ |
| 113 | +public actual open class ShortBufferException: GeneralSecurityException { |
| 114 | + public actual constructor(): super() |
| 115 | + public actual constructor(message: String?): super(message) |
| 116 | +} |
0 commit comments