Git Product home page Git Product logo

ap-bah-crypto-utility's Introduction

Table of Contents

Overview

This SDK library provides reference implementation of ISO 20022 Digital Signature specification to sign and verify XML messages. It assumes that you have read the specification prior to coming here.

Refer to ISO20022 Signed Unsigned Message Examples for understanding the difference between a signed and unsigned message.

In Signed XML payload, you will see three reference nodes:

  • Resource as uri="" - will get resolved to AppHdr
  • Resource with no uri - will get resolved to Document
  • Resource as uri="#id" - will get resolved to element as per that id value

Compatibility

Java 11+

Maven 3.6.1+

Usage

Signing the request

XmlSignUtil.sign(Document document, SignatureInfo signatureInfo, SignatureKeyInfo signatureKeyInfo) signs the XML Document where:

  • document - the unsigned payload
  • signatureInfo - signature info which is used in signing the payload
  • signatureKeyInfo - signature key info which holds private key and ski bytes to be set in X509 Data element

Refer to detailed message signing flow

Verifying the request

XmlSignUtil.verify(Document document, PublicKey publicKey) verifies the signed payload where:

  • document - the signed payload
  • publicKey - the public key

Refer to detailed message verification flow

Adding the Library to Your Project

Maven

<dependency>
    <groupId>com.mastercard.ap.security</groupId>
    <artifactId>ap-bah-crypto-utility</artifactId>
    <version>${bah-crypto-utility-version}</version>
</dependency>

Keytool Command to generate private-pubic key pair

Execute the command from command prompt

keytool -genkey -alias test -keyalg RSA -validity 3060 -keysize 2048 -keystore keystore.jks -storetype JKS

Enter keystore password:

Re-enter new password:

What is your first and last name?

[Unknown]:  Test

What is the name of your organizational unit?

[Unknown]:  OU

What is the name of your organization?

[Unknown]:  O

What is the name of your City or Locality?

[Unknown]:  London

What is the name of your State or Province?

[Unknown]:  S

What is the two-letter country code for this unit?

[Unknown]:  UK

Is CN=Test, OU=OU, O=O, L=London, ST=S, C=UK correct?

[no]:  yes

Enter key password for (RETURN if same as keystore password):

Re-enter new password:

ap-bah-crypto-utility's People

Contributors

vishakhajain102133 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.