blob: 1e08b809da5c45fe4fda9f306cd4da8479048003 (
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
57
58
59
60
61
62
63
64
65
66
67
|
using System;
using Org.BouncyCastle.Asn1.X509;
namespace Org.BouncyCastle.Asn1.Mozilla
{
/**
* This is designed to parse
* the PublicKeyAndChallenge created by the KEYGEN tag included by
* Mozilla based browsers.
* <pre>
* PublicKeyAndChallenge ::= SEQUENCE {
* spki SubjectPublicKeyInfo,
* challenge IA5STRING
* }
*
* </pre>
*/
public class PublicKeyAndChallenge
: Asn1Encodable
{
private Asn1Sequence pkacSeq;
private SubjectPublicKeyInfo spki;
private DerIA5String challenge;
public static PublicKeyAndChallenge GetInstance(
object obj)
{
if (obj is PublicKeyAndChallenge)
{
return (PublicKeyAndChallenge) obj;
}
if (obj is Asn1Sequence)
{
return new PublicKeyAndChallenge((Asn1Sequence) obj);
}
throw new ArgumentException(
"unknown object in 'PublicKeyAndChallenge' factory : "
+ obj.GetType().Name + ".");
}
public PublicKeyAndChallenge(
Asn1Sequence seq)
{
pkacSeq = seq;
spki = SubjectPublicKeyInfo.GetInstance(seq[0]);
challenge = DerIA5String.GetInstance(seq[1]);
}
public override Asn1Object ToAsn1Object()
{
return pkacSeq;
}
public SubjectPublicKeyInfo SubjectPublicKeyInfo
{
get { return spki; }
}
public DerIA5String Challenge
{
get { return challenge; }
}
}
}
|