Skip to content

Software Development at Program Tom LTD

Place for coding, programming, development and software in general.

Menu
  • Blog
  • PDF Booklets
  • Dev Utils & Content
  • Java Spring Boot Or Web Apps
  • English
    • български
    • English
    • Español
    • Português
    • हिन्दी
    • Русский
    • Deutsch
    • Français
    • Italiano
    • العربية
  • About Us
Menu
Public / Private Key Cryptography - Use Cases - Examples

Public / Private Key Cryptography – Use Cases – Examples

Posted on May 28, 2022April 8, 2023 by Toma Velev

Public / Private Key Cryptography is the core that allows the Internet to function. If I must use the metaphor from IT Crowd – if there is any “Internet Box” – it is the hash & crypto math.

Use Cases

HTTPS / SSL

blank

HTTPS/SSL allows any user to communicate with the servers – with a lot less chance of getting listened to or hacked. This opens the door for money transfer, commerce and many more use cases that require high security. After Snowden revealed that the secret agencies are spying and collecting data from all of us, the big internet companies forced on everybody – to use https. This does not secure the servers or the (mobile) devices, but – at least – while in transit – the information is encrypted.

Authentication (Universal Electronic Signatures)

blank

You request Electronic Signatures from authorized and licensed certificate authorities. You give them a public key that you control and they sign it. The signatures usually have with some additional metadata for identification – like citizen or corporation ID. Countries will generally want to control the people, so if someone does something fishy – his or her access may be revoked. With such tool – individuals or companies may interact with the local governments, banks, courts and other institutions in a digital way – online. This saves time & money and increases security for the hard working people.

Authorization (JWT)

Applications don’t want the users to enter their credentials on every request. The old way of authorization are cookies. There is a second generation – using temporary tokens. They are generated and verified using cryptographic math. This minimizes the hits to the databases for authorization purposes. Using a key registered in a blockchain is the latest way I’ve seen.

DNS

DNS are like the electronic signatures – public keys – signed by centrally controlled authorities licensed by the Internet Working Group. The metadata in these signatures is the domain name. This is how a server verifies that it has name. If there was no DNS, no everyday user will use the Internet. Good luck – making your grandma remember IP addresses.

Application Stores

In identical manner – the Android, Apple, Amazon, Samsung, Ubuntu’s Snap, Russian alternative of play – all use digital signatures. If someone is doing something bad, the centralised software systems have a switch to revoke apps. It is simple update – making the key that have signed an app not accepted.

Security

SSL transits the information encrypted. Applications that have high requirements for security add one more – custom layer with Encryption.

Cryptocurrencies

blank

The core of the cryptocurrencies are the hash and public-private key math – that powers the rest of the internet. A crypto wallet – without the blockchain is just simple pair of unbound public-private key. This is a big different from the DNS, JWT, SSL and the other Internet Powering tools. The most important feature is – there is no central authority that may stop writing a record in the blockchain. Anybody could create independent public-private key and do something – as long as the protocol is followed.

Basic Example in Java

//definition

public class NewKey {

public static KeyPair getNewKey() throws NoSuchAlgorithmException {
KeyPairGenerator generator = KeyPairGenerator.getInstance(“RSA”);
generator.initialize(2048);
KeyPair pair = generator.generateKeyPair();
return pair;
}
}

//usage

KeyPair pair = NewKey.getNewKey();

DateFormat sdf = new SimpleDateFormat(“hh_mm_ss”);
Date date = new Date();
Files.write(new File(sdf.format(date) + “privatekey.txt”).toPath(),
Base64.getEncoder().encode(pair.getPrivate().getEncoded()), StandardOpenOption.CREATE_NEW);
Files.write(new File(sdf.format(date) + “publickey.txt”).toPath(),
Base64.getEncoder().encode(pair.getPublic().getEncoded()), StandardOpenOption.CREATE_NEW);

And this is how you create new public/private key in Java. The thing is – for now – it is of no use for anybody. Integrating into an app or some public blockchain will make it useful.

Java & Dart (Flutter) Example

TODO

  • Prompt-to-Production: How AI is Forcing Us to Build Higher Quality Software
  • Debug Web View Flutter App
  • Skipping AI? You’re a Relic – Time to Evolve or Perish!
  • 2026 Flutter Launch Blueprint: Your 10-Step Checklist to App Store Domination
  • Product Requirements Document – for different software development levels

Categories

  • Apps (25)
  • ChatGPT (27)
  • Choosing a Framework (38)
  • Flutter (281)
  • Graphical User Interface (14)
  • Marketing (119)
  • Software Development (292)
  • Spring (45)
  • StartUp (22)
  • Uncategorized (14)
  • Uncategorized (4)
  • Vaadin (16)

Tags

Algorithms (9) crypto (29) flutterdev (39) General (86) Java (7) QR & Bar Codes (3) Software Dev Choices (33) Spring Boot (1) standards (1) Theme (3) User Authentication & Authorization (9) User Experience (10) Utilities (19) WordPress (11)

Product categories

  • All Technologies (87)
    • Flutter Apps (26)
    • GPT (4)
    • Java (39)
    • Native Android (3)
    • PHP (9)
    • Spring (Boot) / Quarkus (36)
    • Utils (15)
    • Vaadin 24+ (28)
    • Vaadin 8 (1)
  • Apps (18)
    • Employees DB (1)
    • Notes (6)
    • Personal Budget (1)
    • Recipes Book (1)
    • Stuff Organizer (1)
    • To-Do (2)
  • PDF Books (3)
  • Source Code Generators (8)

Recent Posts

  • Prompt-to-Production: How AI is Forcing Us to Build Higher Quality Software
  • Debug Web View Flutter App
  • Skipping AI? You’re a Relic – Time to Evolve or Perish!
  • 2026 Flutter Launch Blueprint: Your 10-Step Checklist to App Store Domination
  • Product Requirements Document – for different software development levels

Post Categories

  • Apps (25)
  • ChatGPT (27)
  • Choosing a Framework (38)
  • Flutter (281)
  • Graphical User Interface (14)
  • Marketing (119)
  • Software Development (292)
  • Spring (45)
  • StartUp (22)
  • Uncategorized (14)
  • Uncategorized (4)
  • Vaadin (16)