catalyst_cose

Creator: coderz1093

Last updated:

0 purchases

catalyst_cose Image
catalyst_cose Images

Languages

Categories

Add to Cart

Description:

catalyst cose

Content #

Content

Features
Requirements
Install
Example
Limitations
Support
License



Features #
This package exposes a CBOR Object Signing and Encryption
RFC-9052,
RFC-9053 implementation.
Requirements #

Dart: 3.5.0+

Install #
dependencies:
catalyst_cose: any # or the latest version on Pub
copied to clipboard
Example #
// ignore_for_file: avoid_print

import 'dart:convert';

import 'package:catalyst_cose/catalyst_cose.dart';
import 'package:cbor/cbor.dart';
import 'package:convert/convert.dart';
import 'package:cryptography/cryptography.dart';

Future<void> main() async {
final algorithm = Ed25519();
final keyPair = await algorithm.newKeyPairFromSeed(List.filled(32, 0));
final privateKey = await keyPair.extractPrivateKeyBytes();
final publicKey = await keyPair.extractPublicKey().then((e) => e.bytes);

final payload = utf8.encode('This is the content.');

final coseSign1 = await CatalystCose.sign1(
privateKey: privateKey,
payload: payload,
kid: CborBytes(publicKey),
);

final verified = await CatalystCose.verifyCoseSign1(
coseSign1: coseSign1,
publicKey: publicKey,
);

print('COSE_SIGN1:');
print(hex.encode(cbor.encode(coseSign1)));
print('verified: $verified');

assert(
verified,
'The signature proves that given COSE_SIGN1 structure has been '
'signed by the owner of the given public key',
);
}
copied to clipboard
Limitations #
This package supports only a subset of COSE features and algorithms.
More features and algorithms are supposed to be added in the feature.
Supported features:

COSE_SIGN_1: signature + verification

Supported algorithms:

EdDSA: Ed25519

Support #
Post issues and feature requests on the GitHub issue tracker.
Please read our CONTRIBUTING
for guidelines on how to contribute.
License #
Licensed under either of Apache License, Version 2.0
or MIT license
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in this crate by you, as defined in the Apache-2.0 license, shall
be dual licensed as above, without any additional terms or conditions.

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.