public class X509CertSupportNatives extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
CERTIFICATE_EXCEPTION
Return value used to signal an error while parsing a certificate
|
static int |
INVALID_KEY_EXCEPTION
Return value used to signal that the provided key is invalid in this context
|
static int |
NO_SUCH_ALGORITHM_EXCEPTION
Return value used to signal that an algorithm is no available on the target
|
static int |
SIGNATURE_EXCEPTION
Return value used to signal an invalid signature
|
| Constructor and Description |
|---|
X509CertSupportNatives() |
| Modifier and Type | Method and Description |
|---|---|
static int |
appendCertToPath(int cpv,
byte[] x509) |
static int |
appendTrustedCertificate(int cpv,
byte[] x509) |
static int |
checkValidity(byte[] cert,
int certLength)
Checks that the certificate is currently valid, i.e.
|
static int |
closeCertPathValidator(int cpv) |
static boolean |
expectForwardCertPath() |
static int |
getKeyData(byte[] cert,
int certLen)
Get X509 key from the encoded data
|
static int |
getX500PrincipalData(byte[] cert,
int certLen,
byte[] principalData,
int principalDataLength,
boolean getIssuer)
Extracts the subject or issuer X500Principal from an X509Certificate.
|
static int |
nativeGetCloseKeyId()
Gets the id of the native close function.
|
static int |
newCertPathValidator() |
static int |
parse(byte[] cert,
int off,
int len)
Parses the given certificate to validate it and returns its encoded format type.
|
static int |
validateCertPath(int cpv) |
static int |
verify(byte[] cert,
int certLength,
int nativeId)
Verify a public key
|
public static final int CERTIFICATE_EXCEPTION
public static final int INVALID_KEY_EXCEPTION
public static final int NO_SUCH_ALGORITHM_EXCEPTION
public static final int SIGNATURE_EXCEPTION
public static int appendCertToPath(int cpv,
byte[] x509)
public static int appendTrustedCertificate(int cpv,
byte[] x509)
public static int checkValidity(byte[] cert,
int certLength)
throws NativeException
cert - the encoded certificate datacertLength - encoded data lengthSecurityErrorConstants.J_SEC_NO_ERROR on success,
SecurityErrorConstants.J_X509_CERT_EXPIRED_ERROR if certificate expired,
SecurityErrorConstants.J_X509_CERT_NOT_YET_VALID_ERROR if certificate is not yet validNativeException - on errorpublic static int closeCertPathValidator(int cpv)
public static boolean expectForwardCertPath()
public static int getKeyData(byte[] cert,
int certLen)
throws NativeException
cert - the encoded certificate datacertLen - encoded data lengthNativeException - on error.public static int getX500PrincipalData(byte[] cert,
int certLen,
byte[] principalData,
int principalDataLength,
boolean getIssuer)
throws NativeException
cert - The certificate data encoded in X509certLen - The certificate encoded data lengthprincipalData - The principal data extracted from the certificate.principalDataLength - The length of principal_data.getIssuer - '1' to get the issuer, '0' to get the subject.NativeException - on error.public static int nativeGetCloseKeyId()
NativeException - on errorpublic static int newCertPathValidator()
public static int parse(byte[] cert,
int off,
int len)
cert - the certificate bufferoff - the offset in the buffer at which the certificate content startedlen - the certificate content length * @param retry true if this operation is called again when the previous
call is not completed.SecurityErrorConstants.J_CERT_PARSE_ERROR if the certificate is not valid or an error occurs.public static int validateCertPath(int cpv)
public static int verify(byte[] cert,
int certLength,
int nativeId)
throws NativeException
cert - the encoded certificate datacertLength - encoded data lengthnativeId - the native resource id. the native resource should be the public key to be verifiedSIGNATURE_EXCEPTION if the Signature is invalid,
CERTIFICATE_EXCEPTION if an error happened while parsing the certificate,
NO_SUCH_ALGORITHM_EXCEPTION if the signature algorithm is not available,
INVALID_KEY_EXCEPTION if an error related to the key is detected.NativeException - on error