rsapublickeystructure.java

来自「进行与数字证书相关开发必须的java源码」· Java 代码 · 共 65 行

JAVA
65
字号
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi 
// Source File Name:   RSAPublicKeyStructure.java

package jit.asn1.x509;

import java.util.Enumeration;
import jit.asn1.*;
import jit.math.BigInteger;

public class RSAPublicKeyStructure
    implements DEREncodable
{

    private BigInteger modulus;
    private BigInteger publicExponent;

    public static RSAPublicKeyStructure getInstance(ASN1TaggedObject obj, boolean explicit)
    {
        return getInstance(ASN1Sequence.getInstance(obj, explicit));
    }

    public static RSAPublicKeyStructure getInstance(Object obj)
    {
        if(obj == null || (obj instanceof RSAPublicKeyStructure))
            return (RSAPublicKeyStructure)obj;
        if(obj instanceof ASN1Sequence)
            return new RSAPublicKeyStructure((ASN1Sequence)obj);
        else
            throw new IllegalArgumentException("Invalid RSAPublicKeyStructure: ".concat(String.valueOf(String.valueOf(obj.getClass().getName()))));
    }

    public RSAPublicKeyStructure(BigInteger modulus, BigInteger publicExponent)
    {
        this.modulus = modulus;
        this.publicExponent = publicExponent;
    }

    public RSAPublicKeyStructure(ASN1Sequence seq)
    {
        Enumeration e = seq.getObjects();
        modulus = ((DERInteger)e.nextElement()).getPositiveValue();
        publicExponent = ((DERInteger)e.nextElement()).getPositiveValue();
    }

    public BigInteger getModulus()
    {
        return modulus;
    }

    public BigInteger getPublicExponent()
    {
        return publicExponent;
    }

    public DERObject getDERObject()
    {
        ASN1EncodableVector v = new ASN1EncodableVector();
        v.add(new DERInteger(getModulus()));
        v.add(new DERInteger(getPublicExponent()));
        return new DERSequence(v);
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?