/**
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2009 Sun Microsystems Inc. All Rights Reserved
*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the License). You may not use this file except in
* compliance with the License.
*
* You can obtain a copy of the License at
* See the License for the specific language governing
* permission and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* Header Notice in each file and include the License file
* at opensso/legal/CDDLv1.0.txt.
* If applicable, add the following below the CDDL Header,
* with the fields enclosed by brackets [] replaced by
* your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*
* $Id: JCECrypt.java,v 1.1 2009/05/05 21:24:47 veiming Exp $
*
*/
/*
* Portions Copyrighted 2011-2014 ForgeRock AS
*/
/**
* The class <code>Crypt</code> provides generic methods to encryt and decrypt
* data. This class provides a pluggable architecture to encrypt and decrypt
* data, using the <code>AMEncryption</code> interface class. A class that
* implements <code>AMEncryption</code> must be specified via the system
* property: <code>com.iplanet.security.encryptor</code>. If none is
* provided, the default provided by iDSAME
* <code>com.iplanet.services.util.JCEEncryption</code> will be used.
* <p>
* Additionally, it provides a method to check if the calling class has
* permission to call these methods. To enable the additional security, the
* property com.sun.identity.security.checkcaller must be set to true.
*/
public class JCECrypt {
static {
}
// Construct the encryptor class
try {
} catch (Exception e) {
debug.error("JCECrypt.createInstance Unable to get class instance: " + encClass + ", falling back to the"
+ " default implementation: " + DEFAULT_ENCRYPTOR_CLASS, e);
instance = new JCEEncryption();
}
try {
} catch (Exception e) {
"JCECrypt.createInstance: failed to set password-based key",
e);
}
}
return instance;
}
return null;
}
// Encrypt the data
try {
} catch (UnsupportedEncodingException uee) {
}
// BASE64 encode the data
// Perf Improvement : Removed the sync block and newed up the Encoder
// object for every call. Its a trade off b/w CPU and mem usage.
// Serialize the data, i.e., remove \n and \r
try {
}
} catch (IOException ioe) {
}
}
}
return (null);
}
// BASE64 decode the data
// Perf Improvement : Removed the sync block and newed up the Decoder
// object for every call. Its a trade off b/w CPU and mem usage.
// Decrypt the data
return (null);
}
// Convert to String and return
try {
} catch (UnsupportedEncodingException uue) {
}
return (answer);
}
/**
* Decode an encoded string
*
* @param encoded
* The encoded string.
* @return The decoded string.
*/
}
}