Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
ueman committed Sep 15, 2024
1 parent ef0931b commit 8b80283
Showing 1 changed file with 10 additions and 16 deletions.
26 changes: 10 additions & 16 deletions passkit/lib/src/write_signature.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,27 @@ import 'package:pkcs7/pkcs7.dart';
import 'package:pointycastle/pointycastle.dart';

Uint8List writeSignature(
String userCertificate,
Uint8List manifestBytes,
String userCertificate, // this is private key and certificate in one file
Uint8List
manifestBytes, // has of the manifest file or maybe content, not sure
) {
final privateKey = _createPrivateKey(userCertificate);
final issuer = X509.fromPem(userCertificate);

final pkcs7Builder = Pkcs7Builder();
// Add one or more certificates

pkcs7Builder.addCertificate(issuer);
pkcs7Builder.addCertificate(wwdrG4);

// Create a signature information object
final signerInfo =
Pkcs7SignerInfoBuilder.rsa(issuer: issuer, privateKey: privateKey);
final signerInfo = Pkcs7SignerInfoBuilder.rsa(
issuer: issuer,
privateKey: privateKey,
digestAlgorithm: HashAlgorithm.sha1,
);

// Add the digest to sign
signerInfo.addSMimeDigest(digest: manifestBytes, signingTime: DateTime.now());

// Add the signature information
pkcs7Builder.addSignerInfo(signerInfo);

// Add a certificate revocation list
pkcs7Builder.addCRL(
CertificateRevocationList.fromDer(
Uint8List.fromList(worldwide_Developer_Relations_G4),
),
);

final pkcs7 = pkcs7Builder.build();
return pkcs7.der;
}
Expand Down

0 comments on commit 8b80283

Please sign in to comment.