rsa_pkcs 0.1.2

  • README.md
  • Installing
  • Versions
  • 54

rsa_pkcs

RSA,PKCS#1,PKCS#8

openssl genrsa -out rsa_private_key.pem

openssl rsa -in rsa_private_key.pem -text -noout -out rsa_private_key.txt

openssl pkcs8 -in rsa_private_key.pem -topk8 -v2 aes-256-cbc -out rsa_enc_private_key.pem

openssl pkcs8 -in rsa_private_key.pem -topk8 -v2 aes-256-cbc -v2prf hmacWithSHA256 -out rsa_enc_private_key.pem

test("rsa private key", () {
    //openssl genrsa -out rsa_private_key.pem
    File rsa_private_key_file = new File("./resource/rsa_private_key.pem");
    String pem = rsa_private_key_file.readAsStringSync();
    RSAPKCSParser parser = new RSAPKCSParser();
    RSAKeyPair pair = parser.parsePEM(pem);
    var privateKey = pair.private;
    
    expect(pair.public , equals(null));
    expect(privateKey != null , equals(true));
    
    expect(privateKey.version, equals(0));
    expect(privateKey.modulus , equals(new BigInteger ([0x00,0xd8,0x3c,0x3c,0xac,0xb3,0xb7,0x67,0xa1,0x02,0x0f,0x94,0x7c,0xa2,0x01,0x20,0x10,0xba,0x49,0x4d,0x86,0xbd,0xa1,0xef,0xd4,0x37,0x35,0x7b,0x91,0xd5,0xc1,0xe6,0x1b,0x12,0x38,0x4c,0xd3,0xc0,0x1f,0x62,0x83,0x12,0xa5,0xef,0x15,0xcf,0x00,0x3f,0x62,0xc4,0xf6,0xb8,0x35,0xbb,0xb3,0xea,0x99,0x40,0x9f,0x87,0xe5,0x83,0xfa,0x69,0x91])));
    expect(privateKey.publicExponent, equals(65537));
    expect(privateKey.privateExponent , equals(new BigInteger ([0x00,0xa0,0xc2,0x2f,0xcd,0xa9,0x92,0xb9,0xcd,0x5e,0xed,0xdc,0x53,0xc8,0x51,0x93,0xd8,0x3b,0xd6,0x91,0x77,0x91,0xf6,0x19,0x8a,0x29,0x3d,0x6e,0xcf,0xde,0x1e,0x58,0x85,0xfb,0xc0,0xa7,0x66,0xaa,0xca,0x38,0x5d,0xd8,0xb3,0xb1,0x6a,0x58,0x20,0x1b,0xae,0xc3,0x90,0x0b,0x5c,0x16,0x36,0x32,0x1a,0x01,0x67,0xe9,0x56,0xd5,0xfb,0xe0,0x01])));
    expect(privateKey.prime1 , equals(new BigInteger ([0x00,0xf3,0x10,0x3a,0x1b,0xb1,0x4f,0x88,0xf0,0x96,0x98,0x3e,0xcd,0x86,0xcb,0x51,0xf9,0xe0,0xe9,0x32,0x50,0x30,0x03,0x9b,0xe4,0xfb,0xb4,0x17,0x6d,0xe1,0xb7,0x3f,0x91])));
    expect(privateKey.prime2 , equals(new BigInteger ([0x00,0xe3,0xbe,0x79,0x3b,0x59,0x3e,0x4e,0xd5,0xbc,0xe5,0xdb,0x1f,0xf5,0x63,0x46,0x8e,0xeb,0x5c,0xc7,0x15,0xb1,0x2b,0xad,0xf2,0x23,0xd1,0x97,0x0c,0xd8,0x8f,0x8a,0x01])));
    expect(privateKey.exponent1 , equals(new BigInteger ([0x7e,0x4e,0x88,0x63,0xab,0x98,0x31,0x09,0x14,0xb8,0xb8,0xaa,0x04,0xc9,0xd3,0x27,0x8e,0x80,0x9f,0xec,0x9b,0x86,0xc4,0x94,0x11,0x58,0x5c,0x74,0x75,0x3e,0xcc,0x81])));
    expect(privateKey.exponent2, equals(new BigInteger ([0x68,0x7f,0x82,0x72,0xf7,0xec,0xfe,0x11,0x56,0x9e,0x85,0x5f,0xf1,0xa1,0x7e,0xc3,0x9f,0x3d,0x2f,0xe0,0x45,0x2e,0x0c,0x9f,0x79,0x4d,0xf7,0x28,0x1e,0xca,0x26,0x01])));
    expect(privateKey.coefficient , equals(new BigInteger ([0x00,0x92,0xe8,0x95,0xc1,0xa9,0xb7,0xb7,0x05,0xfb,0x69,0x4b,0xba,0x2d,0x52,0xcb,0x99,0x01,0xd4,0x62,0x8d,0xb7,0x94,0xeb,0x43,0x86,0x1b,0x08,0x6c,0x55,0x7d,0x29,0x13])));
  });
  
  test("rsa public key", () {
    //openssl genrsa -out rsa_private_key.pem
    //openssl rsa -in rsa_private_key.pem -pubout -out rsa_public_key.pem
    File rsa_private_key_file = new File("./resource/rsa_public_key.pem");
    String pem = rsa_private_key_file.readAsStringSync();
    RSAPKCSParser parser = new RSAPKCSParser();
    RSAKeyPair pair = parser.parsePEM(pem);
    var privateKey = pair.private;
    var publicKey = pair.public;
    
    expect(privateKey , equals(null));
    expect(publicKey != null , equals(true));

    expect(publicKey.modulus , equals(new BigInteger ([0x00,0xd8,0x3c,0x3c,0xac,0xb3,0xb7,0x67,0xa1,0x02,0x0f,0x94,0x7c,0xa2,0x01,0x20,0x10,0xba,0x49,0x4d,0x86,0xbd,0xa1,0xef,0xd4,0x37,0x35,0x7b,0x91,0xd5,0xc1,0xe6,0x1b,0x12,0x38,0x4c,0xd3,0xc0,0x1f,0x62,0x83,0x12,0xa5,0xef,0x15,0xcf,0x00,0x3f,0x62,0xc4,0xf6,0xb8,0x35,0xbb,0xb3,0xea,0x99,0x40,0x9f,0x87,0xe5,0x83,0xfa,0x69,0x91])));
    expect(publicKey.publicExponent, equals(65537));
  });

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  rsa_pkcs: "^0.1.2"

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:rsa_pkcs/rsa_pkcs.dart';
        
Version Uploaded Documentation Archive
0.1.2 Jun 23, 2016 Go to the documentation of rsa_pkcs 0.1.2 Download rsa_pkcs 0.1.2 archive
0.1.1 Apr 12, 2014 failed Download rsa_pkcs 0.1.1 archive
0.1.0 Mar 15, 2014 failed Download rsa_pkcs 0.1.0 archive

Analysis

We analyzed this package on Apr 23, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.49.0
  • pana: 0.10.6

Scores

Popularity:
Describes how popular the package is relative to other packages. [more]
43 / 100
Health:
Code health derived from static analysis. [more]
98 / 100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
13 / 100
Overall score:
Weighted score of the above. [more]
54
Learn more about scoring.

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:rsa_pkcs/rsa_pkcs.dart.

Suggestions

  • Maintain CHANGELOG.md.

    Changelog entries help clients to follow the progress in your code.

  • The description is too short.

    Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

  • Maintain an example.

    Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use rsa_pkcs.dart.

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 3 hints.

    Strong-mode analysis of lib/src/parser.dart gave the following hint:

    line: 46 col: 44
    'BASE64' is deprecated and shouldn't be used.

Dependencies

Package Constraint Resolved Available
Direct dependencies
asn1lib >=0.4.1 <0.5.0 0.4.2
pointycastle >=0.10.0+1 <0.11.0 0.10.0+5 0.11.1
Transitive dependencies
analyzer 0.30.0+4 0.31.1
args 1.4.2
async 2.0.6
barback 0.15.2+15
bignum 0.1.0
charcode 1.1.1
cli_util 0.1.2+1
code_transformers 0.5.1+4
collection 1.14.9
convert 2.0.1
crypto 2.0.2+1
csslib 0.14.1
dart_style 1.0.9+1 1.0.10
fixnum 0.10.7
front_end 0.1.0-alpha.4.1 0.1.0-alpha.11
glob 1.1.5
html 0.13.3
isolate 1.1.0 2.0.0
kernel 0.3.0-alpha.1.1 0.3.0-alpha.11
logging 0.11.3+1
meta 1.1.2
package_config 1.0.3
path 1.4.2 1.5.1
plugin 0.2.0+2
pool 1.3.4
quiver_collection 1.0.0
quiver_iterables 1.0.1
quiver_pattern 1.0.0
reflectable 1.0.4 2.0.0
source_maps 0.10.4
source_span 1.4.0
stack_trace 1.9.2
string_scanner 1.0.2
typed_data 1.1.5
utf 0.9.0+4
watcher 0.9.7+7
yaml 2.1.13
Dev dependencies
test any