Chilkat HOME Android™ ASP Visual Basic VB.NET C# iOS (IPhone) Objective-C C++ C Unicode C++ Unicode C MFC Delphi DLL Delphi ActiveX FoxPro Java Perl PHP Extension PHP ActiveX Python PowerShell Ruby SQL Server VBScript
|
(Chilkat for Android™ API) SSH Key FingerprintGenerates a fingerprint for an SSH key. Download: Chilkat for Android™ Java Libraries // Important: Don't forget to include the call to System.loadLibrary // as shown at the bottom of this code sample. package com.test; import android.app.Activity; import com.chilkatsoft.*; import android.widget.TextView; import android.os.Bundle; public class SimpleActivity extends Activity { // Called when the activity is first created. @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); TextView tv = new TextView(this); String outStr = ""; CkSshKey key = new CkSshKey(); boolean success; // Load an SSH key from an encrypted OpenSSH-formatted private key: key.put_Password("secret"); String keyStr; // First load the PEM into a string: keyStr = key.loadText("privkey_openssh_encrypted.pem"); // Import into the SSH key object: success = key.FromOpenSshPrivateKey(keyStr); if (success != true) { outStr += key.lastErrorText() + "\n"; tv.setText(outStr); setContentView(tv); return; } // Generate the fingerprint: String fingerprint; fingerprint = key.genFingerprint(); outStr += fingerprint + "\n"; // A sample fingerpring looks like this: // ssh-dss 2048 d0:5f:f7:d6:49:60:7b:50:19:f4:41:59:d4:1f:61:7a tv.setText(outStr); setContentView(tv); } static { // Important: Make sure the name passed to loadLibrary matches the shared library // found in your project's libs/armeabi directory. // for "libchilkat.so", pass "chilkat" to loadLibrary // for "libchilkatemail.so", pass "chilkatemail" to loadLibrary // etc. // System.loadLibrary("chilkat"); // Note: If the incorrect library name is passed to System.loadLibrary, // then you will see the following error message at application startup: //"The application <your-application-name> has stopped unexpectedly. Please try again." } } |
© 2000-2013 Chilkat Software, Inc. All Rights Reserved.