blob: be8f2988626b3930439713d6e3a97e387c4baebc (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
using System;
using Org.BouncyCastle.Asn1;
using Org.BouncyCastle.Asn1.Pkcs;
namespace Org.BouncyCastle.Pkcs
{
public class Pkcs12StoreBuilder
{
private DerObjectIdentifier keyAlgorithm = PkcsObjectIdentifiers.PbeWithShaAnd3KeyTripleDesCbc;
private DerObjectIdentifier certAlgorithm = PkcsObjectIdentifiers.PbewithShaAnd40BitRC2Cbc;
private DerObjectIdentifier keyPrfAlgorithm = null;
private bool useDerEncoding = false;
private bool reverseCertificates = false;
public Pkcs12StoreBuilder()
{
}
public Pkcs12Store Build()
{
return new Pkcs12Store(keyAlgorithm, keyPrfAlgorithm, certAlgorithm, useDerEncoding, reverseCertificates);
}
public Pkcs12StoreBuilder SetReverseCertificates(bool reverseCertificates)
{
this.reverseCertificates = reverseCertificates;
return this;
}
public Pkcs12StoreBuilder SetCertAlgorithm(DerObjectIdentifier certAlgorithm)
{
this.certAlgorithm = certAlgorithm;
return this;
}
public Pkcs12StoreBuilder SetKeyAlgorithm(DerObjectIdentifier keyAlgorithm)
{
this.keyAlgorithm = keyAlgorithm;
return this;
}
// Specify a PKCS#5 Scheme 2 encryption for keys
public Pkcs12StoreBuilder SetKeyAlgorithm(DerObjectIdentifier keyAlgorithm, DerObjectIdentifier keyPrfAlgorithm)
{
this.keyAlgorithm = keyAlgorithm;
this.keyPrfAlgorithm = keyPrfAlgorithm;
return this;
}
public Pkcs12StoreBuilder SetUseDerEncoding(bool useDerEncoding)
{
this.useDerEncoding = useDerEncoding;
return this;
}
}
}
|