Package org.qdl_lang.extensions.crypto
Class Crypto
- java.lang.Object
- 
- org.qdl_lang.extensions.crypto.Crypto
 
- 
- All Implemented Interfaces:
- Serializable,- QDLMetaModule
 
 public class Crypto extends Object implements QDLMetaModule Created by Jeff Gaynor 
 on 8/16/22 at 1:34 PM- See Also:
- Serialized Form
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description classCrypto.B64ToHexclassCrypto.B64ToIntclassCrypto.CodeChallengeComputes an RFC 7636 code challenge.classCrypto.CreateKeyclassCrypto.DecryptclassCrypto.DoJWTVerifyclassCrypto.EncryptclassCrypto.ExportKeysclassCrypto.FromJWTclassCrypto.GetPublicKeyGet the public part of a keyclassCrypto.HexToB64classCrypto.HexToIntprotected classCrypto.IdentityEncryptDecryptclassCrypto.IdentityJWTprotected classCrypto.IdentitySymmetricDeorEncryptclassCrypto.ImportKeyclassCrypto.IntToBase64classCrypto.IntToHexclassCrypto.KeyTypeclassCrypto.ProcessB64ToHexclassCrypto.ProcessB64ToIntprotected classCrypto.ProcessHexToIntprotected classCrypto.ProcessIntToB64protected classCrypto.ProcessIntToHexclassCrypto.ReadCertclassCrypto.ReadOIDclassCrypto.ToJWTclassCrypto.VerifyJWT
 - 
Field SummaryFields Modifier and Type Field Description static StringAES_TYPEstatic StringB64_TO_HEXstatic StringCODE_CHALLENGEstatic StringCREATE_KEY_NAMEstatic StringDECRYPT_NAMEEncrypt or decrypt a stem.static StringEC_TYPEstatic StringENCRYPT_NAMEstatic StringEXPORT_NAMEstatic StringFROM_BASE64static StringFROM_JWTstatic StringGET_PUBLIC_KEY_NAMEstatic StringHEX_TO_B64static StringHEX_TO_INTstatic StringIMPORT_NAMEstatic StringINT_TO_HEXstatic StringJWKS_TYPEstatic StringJWT_ALGORITHMstatic StringJWT_ALGORITHM_NONEstatic StringJWT_DEFAULT_TYPEstatic StringJWT_KEY_IDstatic StringJWT_TYPEstatic StringKEY_TYPES_STEM_NAMEstatic StringPKCS_1_TYPEstatic StringPKCS_8_PUBLIC_TYPEstatic StringPKCS_8_TYPEstatic StringREAD_CERTstatic StringREAD_OIDstatic StringRSA_TYPEstatic StringSIGN_JWTstatic StringTO_BASE64static StringVERIFY_JWTstatic StringX509_TYPE
 - 
Constructor SummaryConstructors Constructor Description Crypto()
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddTypeHelp(List<String> dd)voiddeserializeFromJSON(net.sf.json.JSONObject json)protected ObjectexportJWKS(QDLValue[] qdlValues, State state)Does the actual work of exporting a JWKS set.protected ObjectexportPKCS(QDLValue[] qdlValues, State state)Does the actual work or exporting various PKCS files.static com.nimbusds.jose.jwk.JWKgetJwk(PublicKey publicKey)edu.uiuc.ncsa.security.util.jwk.JWKUtil2getJwkUtil()protected edu.uiuc.ncsa.security.util.jwk.JSONWebKeygetKeys(QDLStem keys)QDLStemgetKeyTypes()static StringgetRandomID()static StringgetRandomID(int byteCount)Creates a random id as an (upper case) hex number.ObjectimportJWKS(QDLValue[] qdlValues, State state)ObjectimportPKCS(QDLValue[] qdlValues, State state)protected booleanisAES(QDLStem key)Tests if a given stem that is a key is an AES i.e., symmetric key.protected booleanisEC(QDLStem key)protected booleanisRSA(QDLStem key)protected booleanisSingleKey(QDLStem stem)Is the stem a single key or a stem of keys? This is a simple-minded test and just checks if a required value for the keyis at the top level.ObjectsDeOrEnCrypt(QDLValue[] objects, boolean isEncrypt, String name)net.sf.json.JSONObjectserializeToJSON()Send back a serialization of internal state for this object.static QDLStemwebKeyToStem(edu.uiuc.ncsa.security.util.jwk.JSONWebKey jsonWebKey)
 
- 
- 
- 
Field Detail- 
CREATE_KEY_NAMEpublic static final String CREATE_KEY_NAME - See Also:
- Constant Field Values
 
 - 
IMPORT_NAMEpublic static final String IMPORT_NAME - See Also:
- Constant Field Values
 
 - 
EXPORT_NAMEpublic static final String EXPORT_NAME - See Also:
- Constant Field Values
 
 - 
JWKS_TYPEpublic static final String JWKS_TYPE - See Also:
- Constant Field Values
 
 - 
PKCS_1_TYPEpublic static final String PKCS_1_TYPE - See Also:
- Constant Field Values
 
 - 
PKCS_8_TYPEpublic static final String PKCS_8_TYPE - See Also:
- Constant Field Values
 
 - 
PKCS_8_PUBLIC_TYPEpublic static final String PKCS_8_PUBLIC_TYPE - See Also:
- Constant Field Values
 
 - 
X509_TYPEpublic static final String X509_TYPE - See Also:
- Constant Field Values
 
 - 
RSA_TYPEpublic static final String RSA_TYPE - See Also:
- Constant Field Values
 
 - 
EC_TYPEpublic static final String EC_TYPE - See Also:
- Constant Field Values
 
 - 
AES_TYPEpublic static final String AES_TYPE - See Also:
- Constant Field Values
 
 - 
KEY_TYPES_STEM_NAMEpublic static String KEY_TYPES_STEM_NAME 
 - 
GET_PUBLIC_KEY_NAMEpublic static final String GET_PUBLIC_KEY_NAME - See Also:
- Constant Field Values
 
 - 
ENCRYPT_NAMEpublic static final String ENCRYPT_NAME - See Also:
- Constant Field Values
 
 - 
DECRYPT_NAMEpublic static final String DECRYPT_NAME Encrypt or decrypt a stem. This will skip anything that is not a string or stem and will do the correct recursion to get everything in the stem- See Also:
- Constant Field Values
 
 - 
READ_CERTpublic static String READ_CERT 
 - 
READ_OIDpublic static final String READ_OID - See Also:
- Constant Field Values
 
 - 
SIGN_JWTpublic static String SIGN_JWT 
 - 
JWT_TYPEpublic static String JWT_TYPE 
 - 
JWT_KEY_IDpublic static String JWT_KEY_ID 
 - 
JWT_ALGORITHMpublic static String JWT_ALGORITHM 
 - 
JWT_DEFAULT_TYPEpublic static String JWT_DEFAULT_TYPE 
 - 
JWT_ALGORITHM_NONEpublic static String JWT_ALGORITHM_NONE 
 - 
FROM_JWTpublic static String FROM_JWT 
 - 
VERIFY_JWTpublic static String VERIFY_JWT 
 - 
HEX_TO_INTpublic static final String HEX_TO_INT - See Also:
- Constant Field Values
 
 - 
INT_TO_HEXpublic static final String INT_TO_HEX - See Also:
- Constant Field Values
 
 - 
TO_BASE64public static String TO_BASE64 
 - 
FROM_BASE64public static String FROM_BASE64 
 - 
B64_TO_HEXpublic static String B64_TO_HEX 
 - 
HEX_TO_B64public static String HEX_TO_B64 
 - 
CODE_CHALLENGEpublic static String CODE_CHALLENGE 
 
- 
 - 
Method Detail- 
getJwkUtilpublic edu.uiuc.ncsa.security.util.jwk.JWKUtil2 getJwkUtil() 
 - 
importPKCSpublic Object importPKCS(QDLValue[] qdlValues, State state) throws Throwable - Throws:
- Throwable
 
 - 
importJWKSpublic Object importJWKS(QDLValue[] qdlValues, State state) throws Throwable - Throws:
- Throwable
 
 - 
exportJWKSprotected Object exportJWKS(QDLValue[] qdlValues, State state) throws Throwable Does the actual work of exporting a JWKS set.- Parameters:
- qdlValues-
- state-
- Returns:
- Throws:
- Throwable
 
 - 
exportPKCSprotected Object exportPKCS(QDLValue[] qdlValues, State state) throws Throwable Does the actual work or exporting various PKCS files.- Parameters:
- qdlValues-
- state-
- Returns:
- Throws:
- Throwable
 
 - 
getKeyTypespublic QDLStem getKeyTypes() 
 - 
getJwkpublic static com.nimbusds.jose.jwk.JWK getJwk(PublicKey publicKey) 
 - 
getKeysprotected edu.uiuc.ncsa.security.util.jwk.JSONWebKey getKeys(QDLStem keys) 
 - 
webKeyToStempublic static QDLStem webKeyToStem(edu.uiuc.ncsa.security.util.jwk.JSONWebKey jsonWebKey) 
 - 
isSingleKeyprotected boolean isSingleKey(QDLStem stem) Is the stem a single key or a stem of keys? This is a simple-minded test and just checks if a required value for the keyis at the top level.- Parameters:
- stem-
- Returns:
 
 - 
getRandomIDpublic static String getRandomID() 
 - 
getRandomIDpublic static String getRandomID(int byteCount) Creates a random id as an (upper case) hex number.- Parameters:
- byteCount-
- Returns:
 
 - 
serializeToJSONpublic net.sf.json.JSONObject serializeToJSON() Description copied from interface:QDLMetaModuleSend back a serialization of internal state for this object. This allows for the state you choose to be serialized and then reloaded.NOTEThere is no canonical form for this. Set it how you will and deserialize it accordingly.- Specified by:
- serializeToJSONin interface- QDLMetaModule
- Returns:
 
 - 
deserializeFromJSONpublic void deserializeFromJSON(net.sf.json.JSONObject json) - Specified by:
- deserializeFromJSONin interface- QDLMetaModule
 
 - 
isAESprotected boolean isAES(QDLStem key) Tests if a given stem that is a key is an AES i.e., symmetric key.- Parameters:
- key-
- Returns:
 
 - 
isECprotected boolean isEC(QDLStem key) 
 - 
isRSAprotected boolean isRSA(QDLStem key) 
 
- 
 
-