Welcome to mirror list, hosted at ThFree Co, Russian Federation.

JcaSignerId.java « jcajce « cms « bouncycastle « org « jdk1.3 « main « src « pkix - gitlab.com/quite/humla-spongycastle.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 129e85e37f4b9c07e0792c5602585cd58680ffac (plain)
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
package org.bouncycastle.cms.jcajce;

import java.math.BigInteger;
import java.security.cert.X509Certificate;

import org.bouncycastle.asn1.x500.X500Name;
import org.bouncycastle.cms.SignerId;
import org.bouncycastle.jce.PrincipalUtil;
import org.bouncycastle.jce.X509Principal;

public class JcaSignerId
    extends SignerId
{
    private static X509Principal getPrincipal(X509Certificate cert)
    {
         try
         {
             return PrincipalUtil.getIssuerX509Principal(cert);
         }
         catch (Exception e)
         {
             throw new IllegalArgumentException("unable to extract principle");
         }
    }

    /**
     * Construct a signer identifier based on the issuer, serial number and subject key identifier (if present) of the passed in
     * certificate.
     *
     * @param certificate certificate providing the issue and serial number and subject key identifier.
     */
    public JcaSignerId(X509Certificate certificate)
    {
        super(X500Name.getInstance(getPrincipal(certificate).getEncoded()), certificate.getSerialNumber(), CMSUtils.getSubjectKeyId(certificate));
    }
}