org.bouncycastle.asn1.mozilla.PublicKeyAndChallenge Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bcprov-lts8on Show documentation
Show all versions of bcprov-lts8on Show documentation
The Long Term Stable (LTS) Bouncy Castle Crypto package is a Java implementation of cryptographic algorithms. This jar contains the JCA/JCE provider and low-level API for the BC LTS version 2.73.7 for Java 8 and later.
package org.bouncycastle.asn1.mozilla;
import org.bouncycastle.asn1.ASN1IA5String;
import org.bouncycastle.asn1.ASN1Object;
import org.bouncycastle.asn1.ASN1Primitive;
import org.bouncycastle.asn1.ASN1Sequence;
import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo;
/**
* This is designed to parse
* the PublicKeyAndChallenge created by the KEYGEN tag included by
* Mozilla based browsers.
*
* PublicKeyAndChallenge ::= SEQUENCE {
* spki SubjectPublicKeyInfo,
* challenge IA5STRING
* }
*
*
*/
public class PublicKeyAndChallenge
extends ASN1Object
{
private ASN1Sequence pkacSeq;
private SubjectPublicKeyInfo spki;
private ASN1IA5String challenge;
public static PublicKeyAndChallenge getInstance(Object obj)
{
if (obj instanceof PublicKeyAndChallenge)
{
return (PublicKeyAndChallenge)obj;
}
else if (obj != null)
{
return new PublicKeyAndChallenge(ASN1Sequence.getInstance(obj));
}
return null;
}
private PublicKeyAndChallenge(ASN1Sequence seq)
{
pkacSeq = seq;
spki = SubjectPublicKeyInfo.getInstance(seq.getObjectAt(0));
challenge = ASN1IA5String.getInstance(seq.getObjectAt(1));
}
public ASN1Primitive toASN1Primitive()
{
return pkacSeq;
}
public SubjectPublicKeyInfo getSubjectPublicKeyInfo()
{
return spki;
}
public ASN1IA5String getChallengeIA5()
{
return challenge;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy