コード例 #1
0
    private PopoSigningKey(Asn1Sequence seq)
    {
        int num = 0;

        if (seq[num] is Asn1TaggedObject)
        {
            Asn1TaggedObject asn1TaggedObject = (Asn1TaggedObject)seq[num++];
            if (asn1TaggedObject.TagNo != 0)
            {
                throw new ArgumentException("Unknown PopoSigningKeyInput tag: " + asn1TaggedObject.TagNo, "seq");
            }
            poposkInput = PopoSigningKeyInput.GetInstance(asn1TaggedObject.GetObject());
        }
        algorithmIdentifier = AlgorithmIdentifier.GetInstance(seq[num++]);
        signature           = DerBitString.GetInstance(seq[num]);
    }
コード例 #2
0
        public PopoSigningKey Build(ISignatureFactory signer)
        {
            if (_name != null && _publicKeyMAC != null)
            {
                throw new InvalidOperationException("name and publicKeyMAC cannot both be set.");
            }

            PopoSigningKeyInput popo;

            byte[]            b;
            IStreamCalculator calc = signer.CreateCalculator();

            if (_certRequest != null)
            {
                popo = null;
                b    = _certRequest.GetDerEncoded();
                calc.Stream.Write(b, 0, b.Length);
            }
            else if (_name != null)
            {
                popo = new PopoSigningKeyInput(_name, _pubKeyInfo);
                b    = popo.GetDerEncoded();
                calc.Stream.Write(b, 0, b.Length);
            }
            else
            {
                popo = new PopoSigningKeyInput(_publicKeyMAC, _pubKeyInfo);
                b    = popo.GetDerEncoded();
                calc.Stream.Write(b, 0, b.Length);
            }

            calc.Stream.Flush();
            BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.Platform.Dispose(calc.Stream);
            DefaultSignatureResult res = (DefaultSignatureResult)calc.GetResult();

            return(new PopoSigningKey(popo, (AlgorithmIdentifier)signer.AlgorithmDetails, new DerBitString(res.Collect())));
        }
コード例 #3
0
 public PopoSigningKey(PopoSigningKeyInput poposkIn, AlgorithmIdentifier aid, DerBitString signature)
 {
     poposkInput         = poposkIn;
     algorithmIdentifier = aid;
     this.signature      = signature;
 }