CryptoService.java 1.25 KB
/*
 * Decompiled with CFR 0_118.
 * 
 * Could not load the following classes:
 *  com.adobe.granite.crypto.CryptoSupport
 *  org.apache.felix.scr.annotations.Component
 *  org.apache.felix.scr.annotations.Reference
 *  org.apache.felix.scr.annotations.Service
 */
package com.adobe.fd.stp.internal;

import com.adobe.granite.crypto.CryptoSupport;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.Service;

@Component(label="AEMFD Internal CryptoService Service", description="AEMFD Internal CryptoService Service")
@Service(value={CryptoService.class})
public class CryptoService {
    @Reference
    CryptoSupport cryptoSupport;

    public String getPlainText(String possiblyProtected) throws Exception {
        if (this.cryptoSupport.isProtected(possiblyProtected)) {
            return this.cryptoSupport.unprotect(possiblyProtected);
        }
        return possiblyProtected;
    }

    protected void bindCryptoSupport(CryptoSupport cryptoSupport) {
        this.cryptoSupport = cryptoSupport;
    }

    protected void unbindCryptoSupport(CryptoSupport cryptoSupport) {
        if (this.cryptoSupport == cryptoSupport) {
            this.cryptoSupport = null;
        }
    }
}