11/**
22 * EXPath Cryptographic Module
33 * Java Library providing an EXPath Cryptographic Module
4- * Copyright (C) 2015 Kuberam
4+ * Copyright (C) 2015 Claudius Teodorescu
55 *
66 * This library is free software; you can redistribute it and/or
77 * modify it under the terms of the GNU Lesser General Public License
2020package ro .kuberam .libs .java .crypto ;
2121
2222public enum CryptoError {
23+
24+ UNKNOWN_ALGORITH ("crypto:unknown-algorithm" , "The specified algorithm is not supported." ),
25+ SIGNATURE_TYPE ("crypto:signature-type" , "The specified signature type is not supported." ),
26+ UNREADABLE_KEYSTORE ("crypto:unreadable-keystore" , "I/O error while reading keystore, or the password is incorrect." ),
27+ DENIED_KEYSTORE ("crypto:denied-keystore" , "Permission denied to read keystore." ),
28+ KEYSTORE_URL ("crypto:keystore-url" , "The keystore URL is invalid." ),
29+ KEYSTORE_TYPE ("crypto:keystore-type" , "The keystore type is not supported." ),
30+ ALIAS_KEY ("crypto:alias-key" , "Cannot find key for alias in given keystore." ),
31+ SIGNATURE_ELEMENT ("crypto:signature-element" , "Cannot find Signature element." ),
32+ INEXISTENT_PADDING ("crypto:inexistent-padding" , "No such padding." ),
33+ INCORRECT_PADDING ("crypto:incorrect-padding" , "Incorrect padding." ),
34+ ENCRYPTION_TYPE ("crypto:encryption-type" , "The encryption type is not supported." ),
35+ INVALID_CRYPTO_KEY ("crypto:invalid-crypto-key" , "The cryptographic key is invalid." ),
36+ BLOCK_SIZE ("crypto:block-size" , "Illegal block size." ),
37+ DECRYPTION_TYPE ("crypto:decryption-type" , "The decryption type is not supported." ),
38+ NO_PROVIDER ("crypto:no-provider" , "The provider is not set." ),
39+ INPUT_RESOURCES ("crypto.input-resources" , "The 'enveloped' and 'enveloping' signatures have to be applied to only one resource." ),
40+ INCORRECT_INITIALIZATION_VECTOR ("crypto:incorrect-initialization-vector" , "The initialization vector is not correct" );
2341
24- UNKNOWN_ALGORITH ("The specified algorithm is not supported" ),
25- SIGNATURE_TYPE ("The specified signature type is not supported." ),
26- UNREADABLE_KEYSTORE ("I/O error while reading keystore, or the password is incorrect." ),
27- DENIED_KEYSTORE ("Permission denied to read keystore." ),
28- KEYSTORE_URL ("The keystore URL is invalid." ),
29- KEYSTORE_TYPE ("The keystore type is not supported." ),
30- ALIAS_KEY ("Cannot find key for alias in given keystore." ),
31- INVALID_KEY ("The specified key is invalid." ),
32- SIGNATURE_ELEMENT ("Cannot find Signature element." ),
33- INEXISTENT_PADDING ("No such padding." ),
34- INCORRECT_PADDING ("Incorrect padding." ),
35- ENCRYPTION_TYPE ("The encryption type is not supported." ),
36- INVALID_CRYPTO_KEY ("The cryptographic key is invalid." ),
37- BLOCK_SIZE ("Illegal block size." ),
38- DECRYPTION_TYPE ("The decryption type is not supported." ),
39- NO_PROVIDER ("The provider is not set." ),
40- OUTPUT_FORMAT ("The output format is not supported." );
42+ private String code ;
43+ private String message ;
4144
42- private final String description ;
43-
44- CryptoError (final String description ) {
45- this .description = description ;
45+ CryptoError (String code , String message ) {
46+ this .code = code ;
47+ this .message = message ;
4648 }
47-
48- public String asMessage () {
49- return asMessage ( "crypto" ) ;
49+
50+ public String getCode () {
51+ return this . code ;
5052 }
51-
52- public String asMessage ( final String nsPrefix ) {
53- return nsPrefix + ':' + name (). toLowerCase (). replace ( '_' , '-' ) + ": " + description ;
53+
54+ public String getMessage ( ) {
55+ return this . message ;
5456 }
55- }
57+
58+ public String getDescription () {
59+ return this .code + ", " + this .message ;
60+ }
61+
62+ }
0 commit comments