Skip to content

Instantly share code, notes, and snippets.

View prabhatkashyap's full-sized avatar

Prabhat Kashyap prabhatkashyap

  • Nexthoughts Software Technology Pvt. Ltd.
  • Noida
View GitHub Profile
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:git-core/ppa
sudo apt-get update
sudo apt-get install git
static public String encrypt(String unencryptedString) {
String UNICODE_FORMAT = "UTF8"
String DESEDE_ENCRYPTION_SCHEME = "DESede"
String myEncryptionKey = "Provide your encryption key"
String myEncryptionScheme = DESEDE_ENCRYPTION_SCHEME
byte[] arrayBytes = myEncryptionKey.getBytes(UNICODE_FORMAT)
KeySpec ks = new DESedeKeySpec(arrayBytes)
SecretKeyFactory skf = SecretKeyFactory.getInstance(myEncryptionScheme)
Cipher cipher = Cipher.getInstance(myEncryptionScheme)
static public String decrypt(String encryptedString) {
String UNICODE_FORMAT = "UTF8"
String DESEDE_ENCRYPTION_SCHEME = "DESede"
String myEncryptionKey = "Provide the same key used for encryption"
String myEncryptionScheme = DESEDE_ENCRYPTION_SCHEME
byte[] arrayBytes = myEncryptionKey.getBytes(UNICODE_FORMAT)
KeySpec ks = new DESedeKeySpec(arrayBytes)
SecretKeyFactory skf = SecretKeyFactory.getInstance(myEncryptionScheme)
Cipher cipher = Cipher.getInstance(myEncryptionScheme)
javax.net.ssl.SSLHandshakeException:
sun.security.validator.ValidatorException: PKIX path building failed:
sun.security.provider.certpath.SunCertPathBuilderException:
unable to find valid certification path to requested target
Caused by: sun.security.validator.ValidatorException:
PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException:
unable to find valid certification path to requested target
Caused by: sun.security.provider.certpath.SunCertPathBuilderException:
nexthoughts@NexThoughts:~/Desktop$ java InstallCert services.krediidiinfo.ee
Loading KeyStore /usr/lib/jvm/java-7-oracle/jre/lib/security/jssecacerts...
Opening connection to services.krediidiinfo.ee:443...
Starting SSL handshake...
javax.net.ssl.SSLException: java.lang.UnsupportedOperationException
at sun.security.ssl.Alerts.getSSLException(Alerts.java:208)
at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1884)
at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1842)
at sun.security.ssl.SSLSocketImpl.handleException(SSLSocketImpl.java:1825)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1346)
<script type="text/javascript">
window.history.forward();
function noBack() { window.history.forward(); }
</script>
</head>
<body onload="noBack();"
onpageshow="if (event.persisted) noBack();" onunload="">
<script>
var validNavigation = false;
function wireUpEvents() {
var dont_confirm_leave = 0;
var leave_message = "You sure you want to leave ?";
function goodbye(e) {
if (!validNavigation) {
if (dont_confirm_leave !== 1) {
if (typeof jQuery !== 'undefined') {
(function($) {
$('#spinner').ajaxStart(function() {
$(this).fadeIn();
}).ajaxStop(function() {
$(this).fadeOut();
});
})(jQuery);
}
Properties props = System.getProperties();
props.setProperty("mail.store.protocol", "imaps");
try {
Session session = Session.getInstance(props, null);
Store store = session.getStore("imaps");
final String username = ""
final String password = ""
store.connect("imap.gmail.com", 993, username, password);
Folder inbox = store.getFolder("INBOX");
inbox.open(Folder.READ_ONLY);
Properties props = new Properties();
props.put("mail.smtp.host", "smtp.gmail.com");
props.put("mail.smtp.socketFactory.port", "465");
props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.port", "465");
final String username = ""
final String password = ""
Session session = Session.getDefaultInstance(props,
new javax.mail.Authenticator() {