FOYDALANILGAN ADABIYOTLAR RO'YXATI
Axborot texnologiyalari sohasida kadrlar tayyorlash tizimini takomillashtirish to’g’risidagi O’zbekiston Respublikasi Prezidenti qarori. Xalq so’zi gazetasi, 2005, 3-iyun.
2001-2005 yillarda kompyuter va axborot texnologiyalarini rivojlantirish, Internetning xalqaro axborot tizimlariga keng kirib borishini ta’minlash dasturini ishlab chiqishni tashkil etish chora-tadbirlari to’g’risida O’zbekiston Respublikasi Vazirlar Mahkamasining qarori. Xalq so’zi. 24 may, 2001 y.
O’zbekiston Respublikasining-Axborotlashtirish to’g’risidagi qonuni.
‘Axborot-kommunikatsiya texnologiyalarini yanada rivojlantirishga oid qo’shimcha chora-tadbirlar to’g’risida’ O’zbekiston Respublikasi Prezidentining 2005 yil 8 iyuldagi– 117-son qarori.
I.Xabibullayev, A.Djaylavov, K.Djurayeva “Savdo-sotiqda axborot texnologiyalari” (o’quv qo’llanma) Toshkent “Iqtisod-moliya”-2009 y.
Sapayev D. “HAYOT faoliyai xavfsizligi”.
“Kadrlar tayyorlash Milliy dasturi” // Barkamol avlod- Ozbekiston
Dmitriy Musin. Samouchitel . 2015 g
K.Yu. Polyakov, V.M. Gurovis. G.Rossum, F.L.Dj.Dreyk, D.S.Otkidach.
K.Yu. Polyakov, Ye.A. Yeremin. Informatika, 10 klass.
www.google.com qidiruv tizimi
www.uz O’zbеkiston saytlari xaqida ma’lumot sayti
www.uz - milliy axborot qidiruv tizimi;
14. www.ziyonet.uz - axborot ta’lim tarmog’i.
ILOVA
import android.annotation.SuppressLint
import android.content.Intent
import android.os.Build
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.provider.Settings
import android.view.View
import android.widget.Toast
import androidx.annotation.RequiresApi
import androidx.biometric.BiometricManager
import androidx.biometric.BiometricManager.Authenticators.BIOMETRIC_STRONG
import androidx.biometric.BiometricManager.Authenticators.DEVICE_CREDENTIAL
import androidx.biometric.BiometricPrompt
import androidx.core.content.ContextCompat
import java.util.concurrent.Executor
@RequiresApi(Build.VERSION_CODES.R)
class MainActivity : AppCompatActivity(), BiometricAuthListener {
private lateinit var binding: ActivityMainBinding
@SuppressLint("SetTextI18n")
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityMainBinding.inflate(layoutInflater)
setContentView(binding.root)
showTitleDevice()
binding.biometricBtn.setOnClickListener {
BiometricUtil.showBiometricPrompt(
activity = this,
listener = this,
cryptoObject = null,
allowDeviceCredential = true
)
}
}
override fun onBiometricAuthenticationSuccess(result: BiometricPrompt.AuthenticationResult) {
Toast.makeText(
this,
"Tekshirish muvaffaqiyatli amalga oshirildi!", Toast.LENGTH_SHORT
)
.show()
navigateToListActivity()
}
override fun onBiometricAuthenticationError(errorCode: Int, errorMessage: String) {
Toast.makeText(
this,
"Tekshirish xatosi: $errorMessage", Toast.LENGTH_SHORT
)
.show()
}
fun navigateToListActivity() {
startActivity(Intent(this, ListActivity::class.java))
finish()
}
private fun showTitleDevice() {
val biometricManager = BiometricManager.from(this)
when (biometricManager.canAuthenticate(BIOMETRIC_STRONG or DEVICE_CREDENTIAL)) {
BiometricManager.BIOMETRIC_SUCCESS -> {
binding.tvBiometricInfo.text = "Ilova biometrik ma'lumotlardan foydalanishi mumkin."
binding.biometricBtn.visibility = View.VISIBLE
}
BiometricManager.BIOMETRIC_ERROR_NO_HARDWARE -> {
binding.tvBiometricInfo.text = "Ushbu qurilmada biometrik funksiyalar mavjud emas."
binding.biometricBtn.visibility = View.GONE
}
BiometricManager.BIOMETRIC_ERROR_HW_UNAVAILABLE -> {
binding.tvBiometricInfo.text = "Biometri" +
"k xususiyatlar hozirda mavjud emas."
binding.biometricBtn.visibility = View.GONE
}
BiometricManager.BIOMETRIC_ERROR_NONE_ENROLLED -> {
binding.tvBiometricInfo.text = "Biometrik xususiyatlar hozirda mavjud emas."
binding.biometricBtn.visibility = View.GONE
// Prompts the user to create credentials that your app accepts.
val enrollIntent = Intent(Settings.ACTION_BIOMETRIC_ENROLL).apply {
putExtra(
Settings.EXTRA_BIOMETRIC_AUTHENTICATORS_ALLOWED,
BIOMETRIC_STRONG or DEVICE_CREDENTIAL
)
}
startActivityForResult(enrollIntent, 1011)
}
}
}
}
import android.content.Intent
import android.content.res.ColorStateList
import android.graphics.Color
import android.os.Bundle
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import kotlinx.android.synthetic.main.activity_list.*
import kotlinx.android.synthetic.main.content_list.*
class ListActivity : AppCompatActivity(), MessageListAdapter.OnItemClickListener {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_list)
setSupportActionBar(findViewById(R.id.toolbar))
fab.setOnClickListener { view ->
ColorStateList.valueOf(Color.WHITE)
startActivity(Intent(this, EncryptionActivity::class.java))
}
val colorStateList = ColorStateList.valueOf(Color.WHITE)
fab.imageTintList = colorStateList
}
override fun onResume() {
super.onResume()
// Set Adapter
showMessageList()
}
override fun onItemClick(item: EncryptedMessage, itemView: View) {
val decryptionIntent = (Intent(this, DecryptionActivity::class.java))
decryptionIntent.putExtra(getString(R.string.parcel_message), item)
startActivity(decryptionIntent)
}
private fun showMessageList() {
val messageList = PreferenceUtil.getMessageList(applicationContext)
if (!messageList.isNullOrEmpty()) {
textViewNoMessage.visibility = View.GONE
recyclerView.adapter = MessageListAdapter(messageList, this)
}
}
}
import android.os.Build
import android.os.Bundle
import android.view.View
import androidx.annotation.RequiresApi
import androidx.appcompat.app.AppCompatActivity
import androidx.biometric.BiometricPrompt
import kotlinx.android.synthetic.main.activity_decryption.*
import javax.crypto.Cipher
class DecryptionActivity : AppCompatActivity(),
BiometricAuthListener {
var encryptedMessage: EncryptedMessage? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_decryption)
encryptedMessage = intent.getParcelableExtra(getString(R.string.parcel_message))
}
@RequiresApi(Build.VERSION_CODES.M)
fun onClickDecryptMessage(view: View) {
showBiometricPromptToDecrypt()
}
@RequiresApi(Build.VERSION_CODES.M)
private fun showBiometricPromptToDecrypt() {
encryptedMessage?.initializationVector?.let { it ->
// Retrieve Cryptography Object
val cryptoObject = BiometricPrompt.CryptoObject(
CryptographyUtil.getInitializedCipherForDecryption(it)
)
// Show BiometricPrompt With Cryptography Object
BiometricUtil.showBiometricPrompt(
activity = this,
listener = this,
cryptoObject = cryptoObject
)
}
}
private fun decryptAndDisplay(cipher: Cipher) {
encryptedMessage?.cipherText?.let { it ->
val decryptedMessage = CryptographyUtil.decryptData(it, cipher)
textViewMessage.text = decryptedMessage
}
}
override fun onBiometricAuthenticationSuccess(result: BiometricPrompt.AuthenticationResult) {
result.cryptoObject?.cipher?.let {
decryptAndDisplay(it)
}
}
override fun onBiometricAuthenticationError(errorCode: Int, errorMessage: String) {
CommonUtils.displayToast(this, "Biometric error: $errorMessage")
}
}
import android.content.DialogInterface
import android.os.Build
import android.os.Bundle
import android.text.TextUtils
import android.view.View
import androidx.annotation.RequiresApi
import androidx.appcompat.app.AppCompatActivity
import androidx.biometric.BiometricPrompt
import kotlinx.android.synthetic.main.activity_encryption.*
import javax.crypto.Cipher
class EncryptionActivity : AppCompatActivity(),
BiometricAuthListener {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_encryption)
}
@RequiresApi(Build.VERSION_CODES.M)
fun onClickEncryptMessage(view: View) {
val message = textInputMessage.editText?.text.toString().trim()
if (!TextUtils.isEmpty(message)) {
if (BiometricUtil.isBiometricReady(this)) {
showBiometricPromptToEncrypt()
} else {
showAlertToSetupBiometric()
}
}
}
private fun confirmInput() {
textInputMessage.editText?.text = null
CommonUtils.displayToast(this, getString(R.string.message_saved))
}
private fun showAlertToSetupBiometric() {
CommonUtils.displayMessage(
this,
getString(R.string.message_encryption_failed),
getString(R.string.message_no_biometric),
) { dialog: DialogInterface, index: Int ->
BiometricUtil.lunchBiometricSettings(this)
}
}
@RequiresApi(Build.VERSION_CODES.M)
private fun showBiometricPromptToEncrypt() {
// Create Cryptography Object
val cryptoObject = BiometricPrompt.CryptoObject(
CryptographyUtil.getInitializedCipherForEncryption()
)
// Show BiometricPrompt
BiometricUtil.showBiometricPrompt(
activity = this,
listener = this,
cryptoObject = cryptoObject
)
}
override fun onBiometricAuthenticationSuccess(result: BiometricPrompt.AuthenticationResult) {
result.cryptoObject?.cipher?.let {
val message = textInputMessage.editText?.text.toString().trim()
if (!TextUtils.isEmpty(message)) {
encryptAndSave(message, it)
confirmInput()
}
}
}
override fun onBiometricAuthenticationError(errorCode: Int, errorMessage: String) {
CommonUtils.displayToast(this, "Biometric error: $errorMessage")
}
private fun encryptAndSave(plainTextMessage: String, cipher: Cipher) {
val encryptedMessage = CryptographyUtil.encryptData(plainTextMessage, cipher)
// Save Encrypted Message
PreferenceUtil.storeEncryptedMessage(
applicationContext,
prefKey = encryptedMessage.savedAt.toString(),
encryptedMessage = encryptedMessage
)
}
}
import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
class SplashActivity : AppCompatActivity() {
private lateinit var binding: ActivitySplashBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivitySplashBinding.inflate(layoutInflater)
setContentView(binding.root)
binding.animationView.postDelayed({
finish()
startActivity(Intent(this, MainActivity::class.java))
}, 3000)
}
}
import android.content.Context
import android.content.Intent
import android.content.res.Resources
import android.util.Log
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.content.res.AppCompatResources
import androidx.biometric.BiometricManager
import androidx.biometric.BiometricPrompt
import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat
import androidx.core.content.res.ResourcesCompat
/**
* Helper class for managing Biometric Authentication Process
*/
object BiometricUtil {
/**
* Checks if the device has Biometric support
*/
fun hasBiometricCapability(context: Context): Int {
val biometricManager = BiometricManager.from(context)
return biometricManager.canAuthenticate()
}
/**
* Checks if Biometric Authentication (example: Fingerprint) is set in the device
*/
fun isBiometricReady(context: Context) =
hasBiometricCapability(context) == BiometricManager.BIOMETRIC_SUCCESS
/**
* Prepares PromptInfo dialog with provided configuration
*/
fun setBiometricPromptInfo(
title: String,
subtitle: String,
description: String,
allowDeviceCredential: Boolean
): BiometricPrompt.PromptInfo {
val builder = BiometricPrompt.PromptInfo.Builder()
.setTitle(title)
.setSubtitle(subtitle)
.setDescription(description)
// Use Device Credentials if allowed, otherwise show Cancel Button
builder.apply {
if (allowDeviceCredential) setDeviceCredentialAllowed(true)
else setNegativeButtonText("Cancel")
}
return builder.build()
}
/**
* Initializes BiometricPrompt with the caller and callback handlers
*/
fun initBiometricPrompt(
activity: AppCompatActivity,
listener: BiometricAuthListener
): BiometricPrompt {
// Attach calling Activity
val executor = ContextCompat.getMainExecutor(activity)
// Attach callback handlers
val callback = object : BiometricPrompt.AuthenticationCallback() {
override fun onAuthenticationError(errorCode: Int, errString: CharSequence) {
super.onAuthenticationError(errorCode, errString)
listener.onBiometricAuthenticationError(errorCode, errString.toString())
}
override fun onAuthenticationFailed() {
super.onAuthenticationFailed()
Toast.makeText(
activity.applicationContext, "Tekshirish amalga oshmadi",
Toast.LENGTH_SHORT
)
.show()
}
override fun onAuthenticationSucceeded(result: BiometricPrompt.AuthenticationResult) {
super.onAuthenticationSucceeded(result)
listener.onBiometricAuthenticationSuccess(result)
}
}
return BiometricPrompt(activity, executor, callback)
}
/**
* Displays a BiometricPrompt with provided configurations
*/
fun showBiometricPrompt(
title: String = "Biometrik autentifikatsiya",
subtitle: String = "Davom etish uchun biometrik hisob maʼlumotlarini kiriting.",
description: String = "Barmoq izi yoki yuz orqali ishlov berish ",
activity: AppCompatActivity,
listener: BiometricAuthListener,
cryptoObject: BiometricPrompt.CryptoObject? = null,
allowDeviceCredential: Boolean = false
) {
// Prepare BiometricPrompt Dialog
val promptInfo = setBiometricPromptInfo(
title,
subtitle,
description,
allowDeviceCredential
)
// Attach with caller and callback handler
val biometricPrompt = initBiometricPrompt(activity, listener)
// Authenticate with a CryptoObject if provided, otherwise default authentication
biometricPrompt.apply {
if (cryptoObject == null) authenticate(promptInfo)
else authenticate(promptInfo, cryptoObject)
}
}
/**
* Navigates to Device's Settings screen Biometric Setup
*/
fun lunchBiometricSettings(context: Context) {
ActivityCompat.startActivity(
context,
Intent(android.provider.Settings.ACTION_SECURITY_SETTINGS),
null
)
}
}
android:allowBackup="true"
android:icon="@mipmap/ic_launcher_biometric_s"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_biometric_s_round"
android:supportsRtl="true"
android:theme="@style/Theme.BiometricData">
android:name="biometric_data.ui.SplashActivity"
android:theme="@style/Theme.BiometricData.ActionBar"
android:exported="true">
android:name=".ui.MainActivity"
android:parentActivityName=".ui.ListActivity"
android:screenOrientation="portrait"
android:theme="@style/Theme.BiometricData.ActionBar" />
android:name=".ui.ListActivity"
android:label="@string/app_name"
android:theme="@style/Theme.BiometricData.ActionBar"
android:screenOrientation="portrait" />
android:name=".ui.EncryptionActivity"
android:label="@string/encrypt_message"
android:parentActivityName=".ui.ListActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize" />
android:name=".ui.DecryptionActivity"
android:label="@string/decrypt_message"
android:parentActivityName=".ui.ListActivity"
android:screenOrientation="portrait" />
Do'stlaringiz bilan baham: |