Search in sources :

Example 1 with KeymasterCertificateChain

use of android.security.keymaster.KeymasterCertificateChain in project platform_frameworks_base by android.

the class AndroidKeyStoreKeyPairGeneratorSpi method getAttestationChain.

private Iterable<byte[]> getAttestationChain(String privateKeyAlias, KeyPair keyPair, KeymasterArguments args) throws ProviderException {
    KeymasterCertificateChain outChain = new KeymasterCertificateChain();
    int errorCode = mKeyStore.attestKey(privateKeyAlias, args, outChain);
    if (errorCode != KeyStore.NO_ERROR) {
        throw new ProviderException("Failed to generate attestation certificate chain", KeyStore.getKeyStoreException(errorCode));
    }
    Collection<byte[]> chain = outChain.getCertificates();
    if (chain.size() < 2) {
        throw new ProviderException("Attestation certificate chain contained " + chain.size() + " entries. At least two are required.");
    }
    return chain;
}
Also used : ProviderException(java.security.ProviderException) KeymasterCertificateChain(android.security.keymaster.KeymasterCertificateChain)

Example 2 with KeymasterCertificateChain

use of android.security.keymaster.KeymasterCertificateChain in project android_frameworks_base by DirtyUnicorns.

the class AndroidKeyStoreKeyPairGeneratorSpi method getAttestationChain.

private Iterable<byte[]> getAttestationChain(String privateKeyAlias, KeyPair keyPair, KeymasterArguments args) throws ProviderException {
    KeymasterCertificateChain outChain = new KeymasterCertificateChain();
    int errorCode = mKeyStore.attestKey(privateKeyAlias, args, outChain);
    if (errorCode != KeyStore.NO_ERROR) {
        throw new ProviderException("Failed to generate attestation certificate chain", KeyStore.getKeyStoreException(errorCode));
    }
    Collection<byte[]> chain = outChain.getCertificates();
    if (chain.size() < 2) {
        throw new ProviderException("Attestation certificate chain contained " + chain.size() + " entries. At least two are required.");
    }
    return chain;
}
Also used : ProviderException(java.security.ProviderException) KeymasterCertificateChain(android.security.keymaster.KeymasterCertificateChain)

Example 3 with KeymasterCertificateChain

use of android.security.keymaster.KeymasterCertificateChain in project android_frameworks_base by ResurrectionRemix.

the class AndroidKeyStoreKeyPairGeneratorSpi method getAttestationChain.

private Iterable<byte[]> getAttestationChain(String privateKeyAlias, KeyPair keyPair, KeymasterArguments args) throws ProviderException {
    KeymasterCertificateChain outChain = new KeymasterCertificateChain();
    int errorCode = mKeyStore.attestKey(privateKeyAlias, args, outChain);
    if (errorCode != KeyStore.NO_ERROR) {
        throw new ProviderException("Failed to generate attestation certificate chain", KeyStore.getKeyStoreException(errorCode));
    }
    Collection<byte[]> chain = outChain.getCertificates();
    if (chain.size() < 2) {
        throw new ProviderException("Attestation certificate chain contained " + chain.size() + " entries. At least two are required.");
    }
    return chain;
}
Also used : ProviderException(java.security.ProviderException) KeymasterCertificateChain(android.security.keymaster.KeymasterCertificateChain)

Example 4 with KeymasterCertificateChain

use of android.security.keymaster.KeymasterCertificateChain in project android_frameworks_base by AOSPA.

the class AndroidKeyStoreKeyPairGeneratorSpi method getAttestationChain.

private Iterable<byte[]> getAttestationChain(String privateKeyAlias, KeyPair keyPair, KeymasterArguments args) throws ProviderException {
    KeymasterCertificateChain outChain = new KeymasterCertificateChain();
    int errorCode = mKeyStore.attestKey(privateKeyAlias, args, outChain);
    if (errorCode != KeyStore.NO_ERROR) {
        throw new ProviderException("Failed to generate attestation certificate chain", KeyStore.getKeyStoreException(errorCode));
    }
    Collection<byte[]> chain = outChain.getCertificates();
    if (chain.size() < 2) {
        throw new ProviderException("Attestation certificate chain contained " + chain.size() + " entries. At least two are required.");
    }
    return chain;
}
Also used : ProviderException(java.security.ProviderException) KeymasterCertificateChain(android.security.keymaster.KeymasterCertificateChain)

Example 5 with KeymasterCertificateChain

use of android.security.keymaster.KeymasterCertificateChain in project android_frameworks_base by crdroidandroid.

the class AndroidKeyStoreKeyPairGeneratorSpi method getAttestationChain.

private Iterable<byte[]> getAttestationChain(String privateKeyAlias, KeyPair keyPair, KeymasterArguments args) throws ProviderException {
    KeymasterCertificateChain outChain = new KeymasterCertificateChain();
    int errorCode = mKeyStore.attestKey(privateKeyAlias, args, outChain);
    if (errorCode != KeyStore.NO_ERROR) {
        throw new ProviderException("Failed to generate attestation certificate chain", KeyStore.getKeyStoreException(errorCode));
    }
    Collection<byte[]> chain = outChain.getCertificates();
    if (chain.size() < 2) {
        throw new ProviderException("Attestation certificate chain contained " + chain.size() + " entries. At least two are required.");
    }
    return chain;
}
Also used : ProviderException(java.security.ProviderException) KeymasterCertificateChain(android.security.keymaster.KeymasterCertificateChain)

Aggregations

KeymasterCertificateChain (android.security.keymaster.KeymasterCertificateChain)5 ProviderException (java.security.ProviderException)5