O‘zbekiston Respublikasi Axborot texnologiyalari va kommunikatsiyalarini rivojlantirish vazirligi muhammad al-xorazmiy nomidagi toshkent axborot texnologiyalari universiteti himoyaga «Axborot texnologiyalarining dasturiy ta'minoti»


FOYDALANILGAN ADABIYOTLAR RO'YXATI



Download 17,23 Mb.
bet12/12
Sana23.07.2022
Hajmi17,23 Mb.
#841237
1   ...   4   5   6   7   8   9   10   11   12
Bog'liq
BMI Biometric asosiy 4

FOYDALANILGAN ADABIYOTLAR RO'YXATI

  1. Axborot texnologiyalari sohasida kadrlar tayyorlash tizimini takomillashtirish to’g’risidagi O’zbekiston Respublikasi Prezidenti qarori. Xalq so’zi gazetasi, 2005, 3-iyun.

  2. 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.

  3. O’zbekiston Respublikasining-Axborotlashtirish to’g’risidagi qonuni.

  4. ‘Axborot-kommunikatsiya texnologiyalarini yanada rivojlantirishga oid qo’shimcha chora-tadbirlar to’g’risida’ O’zbekiston Respublikasi Prezidentining 2005 yil 8 iyuldagi– 117-son qarori.

  5. I.Xabibullayev, A.Djaylavov, K.Djurayeva “Savdo-sotiqda axborot texnologiyalari” (o’quv qo’llanma) Toshkent “Iqtisod-moliya”-2009 y.

  6. Sapayev D. “HAYOT faoliyai xavfsizligi”.

  7. “Kadrlar tayyorlash Milliy dasturi” // Barkamol avlod- Ozbekiston

  8. Dmitriy Musin. Samouchitel . 2015 g

  9. K.Yu. Polyakov, V.M. Gurovis. G.Rossum, F.L.Dj.Dreyk, D.S.Otkidach.

  10. K.Yu. Polyakov, Ye.A. Yeremin. Informatika, 10 klass.

  11. www.google.com qidiruv tizimi

  12. www.uz O’zbеkiston saytlari xaqida ma’lumot sayti

  13. 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 uz.elmurod.biometric_data.R
import uz.elmurod.biometric_data.common.BiometricAuthListener
import uz.elmurod.biometric_data.databinding.ActivityMainBinding
import uz.elmurod.biometric_data.util.BiometricUtil
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.*
import uz.elmurod.biometric_data.R
import uz.elmurod.biometric_data.common.EncryptedMessage
import uz.elmurod.biometric_data.util.PreferenceUtil
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 uz.elmurod.biometric_data.common.BiometricAuthListener
import uz.elmurod.biometric_data.common.CommonUtils
import uz.elmurod.biometric_data.common.EncryptedMessage
import uz.elmurod.biometric_data.util.BiometricUtil
import uz.elmurod.biometric_data.util.CryptographyUtil
import kotlinx.android.synthetic.main.activity_decryption.*
import uz.elmurod.biometric_data.R
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 uz.elmurod.biometric_data.R
import uz.elmurod.biometric_data.common.BiometricAuthListener
import uz.elmurod.biometric_data.common.CommonUtils
import uz.elmurod.biometric_data.util.BiometricUtil
import uz.elmurod.biometric_data.util.CryptographyUtil
import uz.elmurod.biometric_data.util.PreferenceUtil
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
import uz.elmurod.biometric_data.databinding.ActivitySplashBinding

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
import uz.elmurod.biometric_data.R
import uz.elmurod.biometric_data.common.BiometricAuthListener

/**
* 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
)
}
}

package="uz.elmurod.biometric_data">
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="uz.elmurod.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" />





Download 17,23 Mb.

Do'stlaringiz bilan baham:
1   ...   4   5   6   7   8   9   10   11   12




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish