Class SecretWriting
java.lang.Object
ecmwf.common.security.SecretWriting
-
Method Summary
Modifier and TypeMethodDescriptionstatic Stringdecrypt(byte[] data) Decrypt.static StringDecrypt Base64 encoded data.static Stringencrypt(byte[] data) Encrypt.static StringEncrypt.static StringtryDecrypt(String data) Decrypt a string which was previously encrypted with the tryEncrypt method.static StringtryEncrypt(String data, int lineLength) Try to encrypt.
-
Method Details
-
encrypt
public static String encrypt(String data) throws UnrecoverableKeyException, InvalidKeyException, KeyStoreException, NoSuchAlgorithmException, CertificateException, NoSuchPaddingException, IllegalBlockSizeException, BadPaddingException, IOException Encrypt.- Parameters:
data- the data- Returns:
- the string
- Throws:
UnrecoverableKeyException- the unrecoverable key exceptionInvalidKeyException- the invalid key exceptionKeyStoreException- the key store exceptionNoSuchAlgorithmException- the no such algorithm exceptionCertificateException- the certificate exceptionNoSuchPaddingException- the no such padding exceptionIllegalBlockSizeException- the illegal block size exceptionBadPaddingException- the bad padding exceptionIOException- Signals that an I/O exception has occurred.
-
tryEncrypt
-
encrypt
public static String encrypt(byte[] data) throws UnrecoverableKeyException, KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException Encrypt.- Parameters:
data- the data- Returns:
- the string
- Throws:
UnrecoverableKeyException- the unrecoverable key exceptionKeyStoreException- the key store exceptionNoSuchAlgorithmException- the no such algorithm exceptionCertificateException- the certificate exceptionIOException- Signals that an I/O exception has occurred.NoSuchPaddingException- the no such padding exceptionInvalidKeyException- the invalid key exceptionIllegalBlockSizeException- the illegal block size exceptionBadPaddingException- the bad padding exception
-
decrypt
public static String decrypt(String data) throws UnrecoverableKeyException, KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException, NoSuchPaddingException, InvalidKeyException Decrypt Base64 encoded data.- Parameters:
data- the data- Returns:
- the string
- Throws:
UnrecoverableKeyException- the unrecoverable key exceptionKeyStoreException- the key store exceptionNoSuchAlgorithmException- the no such algorithm exceptionCertificateException- the certificate exceptionIOException- Signals that an I/O exception has occurred.NoSuchPaddingException- the no such padding exceptionInvalidKeyException- the invalid key exception
-
tryDecrypt
-
decrypt
public static String decrypt(byte[] data) throws UnrecoverableKeyException, InvalidKeyException, KeyStoreException, NoSuchAlgorithmException, CertificateException, NoSuchPaddingException, IOException Decrypt.- Parameters:
data- the data- Returns:
- the string
- Throws:
UnrecoverableKeyException- the unrecoverable key exceptionInvalidKeyException- the invalid key exceptionKeyStoreException- the key store exceptionNoSuchAlgorithmException- the no such algorithm exceptionCertificateException- the certificate exceptionNoSuchPaddingException- the no such padding exceptionIOException- Signals that an I/O exception has occurred.
-